Skip to content

Commit ab2ddb9

Browse files
committed
Signature: Fix documentation
`fixSignature` no longer exists. Instead, we expect the users of signatures to not cache underdefined signatures.
1 parent fe26a84 commit ab2ddb9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

compiler/src/dotty/tools/dotc/core/Signature.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,15 @@ case class Signature(paramsSig: List[TypeName], resSig: TypeName) {
8787

8888
/** Construct a signature by prepending the signature names of the given `params`
8989
* to the parameter part of this signature.
90+
*
91+
* Like Signature#apply, the result is only cacheable if `isUnderDefined == false`.
9092
*/
9193
def prepend(params: List[Type], isJava: Boolean)(implicit ctx: Context) =
9294
Signature(params.map(p => sigName(p, isJava)) ++ paramsSig, resSig)
9395

9496
/** A signature is under-defined if its paramsSig part contains at least one
9597
* `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.
9899
*/
99100
def isUnderDefined(implicit ctx: Context) =
100101
paramsSig.contains(tpnme.Uninstantiated) || resSig == tpnme.Uninstantiated
@@ -116,7 +117,12 @@ object Signature {
116117
*/
117118
val OverloadedSignature = Signature(List(tpnme.OVERLOADED), EmptyTypeName)
118119

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+
*/
120126
def apply(resultType: Type, isJava: Boolean)(implicit ctx: Context): Signature = {
121127
assert(!resultType.isInstanceOf[ExprType])
122128
apply(Nil, sigName(resultType, isJava))

0 commit comments

Comments
 (0)