@@ -709,7 +709,7 @@ object Types {
709
709
final def implicitMembers (implicit ctx : Context ): List [TermRef ] = track(" implicitMembers" ) {
710
710
memberDenots(implicitFilter,
711
711
(name, buf) => buf ++= member(name).altsWith(_ is Implicit ))
712
- .toList.map(d => TermRef .withSym (this , d.symbol.asTerm))
712
+ .toList.map(d => TermRef (this , d.symbol.asTerm))
713
713
}
714
714
715
715
/** The set of member classes of this type */
@@ -1141,7 +1141,7 @@ object Types {
1141
1141
1142
1142
/** The type <this . name> with either `sym` or its signed name as designator, reduced if possible */
1143
1143
def select (sym : Symbol )(implicit ctx : Context ): Type =
1144
- NamedType .withSym (this , sym).reduceProjection
1144
+ NamedType (this , sym).reduceProjection
1145
1145
1146
1146
def select (name : TermName )(implicit ctx : Context ): TermRef =
1147
1147
TermRef (this , name, member(name))
@@ -2019,43 +2019,32 @@ object Types {
2019
2019
def apply (prefix : Type , designator : Name , denot : Denotation )(implicit ctx : Context ) =
2020
2020
if (designator.isTermName) TermRef .apply(prefix, designator.asTermName, denot)
2021
2021
else TypeRef .apply(prefix, designator.asTypeName, denot)
2022
- def withSym (prefix : Type , sym : Symbol )(implicit ctx : Context ): NamedType =
2023
- if (sym.isType) TypeRef .withSym(prefix, sym.asType)
2024
- else TermRef .withSym(prefix, sym.asTerm)
2025
2022
}
2026
2023
2027
2024
object TermRef {
2028
2025
2029
- /** Create term ref with given name, without specifying a signature.
2030
- * Its meaning is the (potentially multi-) denotation of the member(s)
2031
- * of prefix with given name.
2032
- */
2026
+ /** Create a term ref with given designator */
2033
2027
def apply (prefix : Type , desig : Designator )(implicit ctx : Context ): TermRef =
2034
2028
ctx.uniqueNamedTypes.enterIfNew(prefix, desig, isTerm = true ).asInstanceOf [TermRef ]
2035
2029
2036
- /** Create term ref to given initial denotation, taking the signature
2037
- * from the denotation if it is completed, or creating a term ref without
2038
- * signature, if denotation is not yet completed.
2030
+ /** Create a term ref with given initial denotation. The name of the reference is taken
2031
+ * from the denotation's symbol if the latter exists, or else it is the given name.
2039
2032
*/
2040
2033
def apply (prefix : Type , name : TermName , denot : Denotation )(implicit ctx : Context ): TermRef =
2041
2034
apply(prefix, if (denot.symbol.exists) denot.symbol.asTerm else name).withDenot(denot)
2042
-
2043
- def withSym (prefix : Type , sym : TermSymbol )(implicit ctx : Context ): TermRef =
2044
- apply(prefix, sym) // ###
2045
2035
}
2046
2036
2047
2037
object TypeRef {
2048
2038
2049
- /** Create type ref with given prefix and name */
2039
+ /** Create a type ref with given prefix and name */
2050
2040
def apply (prefix : Type , desig : Designator )(implicit ctx : Context ): TypeRef =
2051
2041
ctx.uniqueNamedTypes.enterIfNew(prefix, desig, isTerm = false ).asInstanceOf [TypeRef ]
2052
2042
2053
- /** Create a type ref with given name and initial denotation */
2043
+ /** Create a type ref with given initial denotation. The name of the reference is taken
2044
+ * from the denotation's symbol if the latter exists, or else it is the given name.
2045
+ */
2054
2046
def apply (prefix : Type , name : TypeName , denot : Denotation )(implicit ctx : Context ): TypeRef =
2055
2047
apply(prefix, if (denot.symbol.exists) denot.symbol.asType else name).withDenot(denot)
2056
-
2057
- def withSym (prefix : Type , sym : TypeSymbol )(implicit ctx : Context ): TypeRef =
2058
- apply(prefix, sym) // ###
2059
2048
}
2060
2049
2061
2050
// --- Other SingletonTypes: ThisType/SuperType/ConstantType ---------------------------
0 commit comments