Skip to content

Commit 4800912

Browse files
committed
Add documentation
1 parent f4113da commit 4800912

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

library/src/scala/quoted/Quotes.scala

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,10 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
466466
trait ClassDefModule { this: ClassDef.type =>
467467
/** Create a class definition tree
468468
*
469-
* @param cls The class symbol
469+
* @param cls The class symbol. A new class symbol can be created using `Symbol.newClass`.
470470
* @param parents The parents trees class. The trees must align with the parent types of `cls`.
471+
* Parents can be `TypeTree`s if they don't have term parameter,
472+
* otherwise the can be `Term` containing the `New` applied to the parameters of the extended class.
471473
* @param body List of members of the class. The members must align with the members of `cls`.
472474
*/
473475
@experimental def apply(cls: Symbol, parents: List[Tree /* Term | TypeTree */], body: List[Statement]): ClassDef
@@ -2531,6 +2533,11 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
25312533
def typeSymbol: Symbol
25322534
def termSymbol: Symbol
25332535
def isSingleton: Boolean
2536+
2537+
/** This type seen as if it were the type of a member of prefix type `self` declared in class `member.owner`.
2538+
*
2539+
* Also see `typeRef` and `termRef`
2540+
*/
25342541
def memberType(member: Symbol): TypeRepr
25352542

25362543
/** The base classes of this type with the class itself as first element. */
@@ -3701,9 +3708,11 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
37013708
*
37023709
* symbol.tree.tpe
37033710
*
3704-
* It should be replaced by the following code:
3711+
* It should be replaced by one of the following:
37053712
*
37063713
* tp.memberType(symbol)
3714+
* symbol.typeRef
3715+
* symbol.termRef
37073716
*
37083717
*/
37093718
def tree: Tree
@@ -3875,7 +3884,12 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
38753884
/** Case class or case object children of a sealed trait or cases of an `enum`. */
38763885
def children: List[Symbol]
38773886

3878-
/** Type reference to the symbol usable in the scope of its owner. */
3887+
/** Type reference to the symbol usable in the scope of its owner.
3888+
*
3889+
* To get a reference to a symbol from a specific prefix `tp`, use `tp.memberType(symbol)` instead.
3890+
*
3891+
* @pre symbol.isType returns true
3892+
*/
38793893
@experimental
38803894
def typeRef: TypeRef
38813895

0 commit comments

Comments
 (0)