@@ -87,14 +87,15 @@ case class Signature(paramsSig: List[TypeName], resSig: TypeName) {
87
87
88
88
/** Construct a signature by prepending the signature names of the given `params`
89
89
* to the parameter part of this signature.
90
+ *
91
+ * Like Signature#apply, the result is only cacheable if `isUnderDefined == false`.
90
92
*/
91
93
def prepend (params : List [Type ], isJava : Boolean )(implicit ctx : Context ) =
92
94
Signature (params.map(p => sigName(p, isJava)) ++ paramsSig, resSig)
93
95
94
96
/** A signature is under-defined if its paramsSig part contains at least one
95
97
* `tpnme.Uninstantiated`. Under-defined signatures arise when taking a signature
96
- * of a type that still contains uninstantiated type variables. They are eliminated
97
- * by `fixSignature` in `PostTyper`.
98
+ * of a type that still contains uninstantiated type variables.
98
99
*/
99
100
def isUnderDefined (implicit ctx : Context ) =
100
101
paramsSig.contains(tpnme.Uninstantiated ) || resSig == tpnme.Uninstantiated
@@ -116,7 +117,12 @@ object Signature {
116
117
*/
117
118
val OverloadedSignature = Signature (List (tpnme.OVERLOADED ), EmptyTypeName )
118
119
119
- /** The signature of a method with no parameters and result type `resultType`. */
120
+ /** The signature of a method with no parameters and result type `resultType`.
121
+ *
122
+ * The resulting value is only cacheable if `isUnderDefined == false`,
123
+ * otherwise the signature will change once the contained type variables have
124
+ * been instantiated.
125
+ */
120
126
def apply (resultType : Type , isJava : Boolean )(implicit ctx : Context ): Signature = {
121
127
assert(! resultType.isInstanceOf [ExprType ])
122
128
apply(Nil , sigName(resultType, isJava))
0 commit comments