@@ -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 */
@@ -1135,7 +1135,7 @@ object Types {
1135
1135
1136
1136
/** The type <this . name> with either `sym` or its signed name as designator, reduced if possible */
1137
1137
def select (sym : Symbol )(implicit ctx : Context ): Type =
1138
- NamedType .withSym (this , sym).reduceProjection
1138
+ NamedType (this , sym).reduceProjection
1139
1139
1140
1140
def select (name : TermName )(implicit ctx : Context ): TermRef =
1141
1141
TermRef (this , name, member(name))
@@ -2010,43 +2010,32 @@ object Types {
2010
2010
def apply (prefix : Type , designator : Name , denot : Denotation )(implicit ctx : Context ) =
2011
2011
if (designator.isTermName) TermRef .apply(prefix, designator.asTermName, denot)
2012
2012
else TypeRef .apply(prefix, designator.asTypeName, denot)
2013
- def withSym (prefix : Type , sym : Symbol )(implicit ctx : Context ): NamedType =
2014
- if (sym.isType) TypeRef .withSym(prefix, sym.asType)
2015
- else TermRef .withSym(prefix, sym.asTerm)
2016
2013
}
2017
2014
2018
2015
object TermRef {
2019
2016
2020
- /** Create term ref with given name, without specifying a signature.
2021
- * Its meaning is the (potentially multi-) denotation of the member(s)
2022
- * of prefix with given name.
2023
- */
2017
+ /** Create a term ref with given designator */
2024
2018
def apply (prefix : Type , desig : Designator )(implicit ctx : Context ): TermRef =
2025
2019
ctx.uniqueNamedTypes.enterIfNew(prefix, desig, isTerm = true ).asInstanceOf [TermRef ]
2026
2020
2027
- /** Create term ref to given initial denotation, taking the signature
2028
- * from the denotation if it is completed, or creating a term ref without
2029
- * signature, if denotation is not yet completed.
2021
+ /** Create a term ref with given initial denotation. The name of the reference is taken
2022
+ * from the denotation's symbol if the latter exists, or else it is the given name.
2030
2023
*/
2031
2024
def apply (prefix : Type , name : TermName , denot : Denotation )(implicit ctx : Context ): TermRef =
2032
2025
apply(prefix, if (denot.symbol.exists) denot.symbol.asTerm else name).withDenot(denot)
2033
-
2034
- def withSym (prefix : Type , sym : TermSymbol )(implicit ctx : Context ): TermRef =
2035
- apply(prefix, sym) // ###
2036
2026
}
2037
2027
2038
2028
object TypeRef {
2039
2029
2040
- /** Create type ref with given prefix and name */
2030
+ /** Create a type ref with given prefix and name */
2041
2031
def apply (prefix : Type , desig : Designator )(implicit ctx : Context ): TypeRef =
2042
2032
ctx.uniqueNamedTypes.enterIfNew(prefix, desig, isTerm = false ).asInstanceOf [TypeRef ]
2043
2033
2044
- /** Create a type ref with given name and initial denotation */
2034
+ /** Create a type ref with given initial denotation. The name of the reference is taken
2035
+ * from the denotation's symbol if the latter exists, or else it is the given name.
2036
+ */
2045
2037
def apply (prefix : Type , name : TypeName , denot : Denotation )(implicit ctx : Context ): TypeRef =
2046
2038
apply(prefix, if (denot.symbol.exists) denot.symbol.asType else name).withDenot(denot)
2047
-
2048
- def withSym (prefix : Type , sym : TypeSymbol )(implicit ctx : Context ): TypeRef =
2049
- apply(prefix, sym) // ###
2050
2039
}
2051
2040
2052
2041
// --- Other SingletonTypes: ThisType/SuperType/ConstantType ---------------------------
0 commit comments