Skip to content

Commit 4870ade

Browse files
committed
use isProv only for caching
1 parent b50da7e commit 4870ade

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Diff for: compiler/src/dotty/tools/dotc/core/TypeErasure.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ object TypeErasure {
9696
val arity2 = tupleArity(tp.tp2)
9797
if arity1 == arity2 then arity1 else math.min(-1, math.min(arity1, arity2))
9898
case tp: WildcardType => -2
99-
case tp: TypeVar if !tp.inst.exists => -2
99+
case tp: TypeVar if !tp.isInstantiated => -2
100100
case _ =>
101101
if defn.isTupleNType(tp) then tp.dealias.argInfos.length
102102
else tp.dealias match
103-
case tp: TypeVar if !tp.inst.exists => -2
103+
case tp: TypeVar if !tp.isInstantiated => -2
104104
case _ => -1
105105

106106
def normalizeClass(cls: ClassSymbol)(using Context): ClassSymbol = {
@@ -660,8 +660,8 @@ class TypeErasure(sourceLanguage: SourceLanguage, semiEraseVCs: Boolean, isConst
660660
erasePolyFunctionApply(refinedInfo)
661661
case RefinedType(parent, nme.apply, refinedInfo: MethodType) if defn.isErasedFunctionType(parent) =>
662662
eraseErasedFunctionApply(refinedInfo)
663-
case tp: TypeVar if !tp.inst.exists =>
664-
assert(inSigName, i"Cannot erase non-permanently instantiated type variable $tp")
663+
case tp: TypeVar if !tp.isInstantiated =>
664+
assert(inSigName, i"Cannot erase uninstantiated type variable $tp")
665665
null
666666
case tp: TypeProxy =>
667667
this(tp.underlying)
@@ -945,7 +945,7 @@ class TypeErasure(sourceLanguage: SourceLanguage, semiEraseVCs: Boolean, isConst
945945
sigName(underlyingOfTermRef(tp))
946946
case ExprType(rt) =>
947947
sigName(defn.FunctionOf(Nil, rt))
948-
case tp: TypeVar if !tp.inst.exists =>
948+
case tp: TypeVar if !tp.isInstantiated =>
949949
tpnme.Uninstantiated
950950
case tp @ RefinedType(parent, nme.apply, _) if parent.typeSymbol eq defn.PolyFunctionClass =>
951951
// we need this case rather than falling through to the default

Diff for: compiler/src/dotty/tools/dotc/core/Types.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,7 @@ object Types {
22632263

22642264
if ctx.runId != mySignatureRunId then
22652265
mySignature = computeSignature
2266-
if !mySignature.isUnderDefined then mySignatureRunId = ctx.runId
2266+
if !mySignature.isUnderDefined && !isProvisional then mySignatureRunId = ctx.runId
22672267
mySignature
22682268
end signature
22692269

@@ -3765,17 +3765,17 @@ object Types {
37653765
case SourceLanguage.Java =>
37663766
if ctx.runId != myJavaSignatureRunId then
37673767
myJavaSignature = computeSignature
3768-
if !myJavaSignature.isUnderDefined then myJavaSignatureRunId = ctx.runId
3768+
if !myJavaSignature.isUnderDefined && !isProvisional then myJavaSignatureRunId = ctx.runId
37693769
myJavaSignature
37703770
case SourceLanguage.Scala2 =>
37713771
if ctx.runId != myScala2SignatureRunId then
37723772
myScala2Signature = computeSignature
3773-
if !myScala2Signature.isUnderDefined then myScala2SignatureRunId = ctx.runId
3773+
if !myScala2Signature.isUnderDefined && !isProvisional then myScala2SignatureRunId = ctx.runId
37743774
myScala2Signature
37753775
case SourceLanguage.Scala3 =>
37763776
if ctx.runId != mySignatureRunId then
37773777
mySignature = computeSignature
3778-
if !mySignature.isUnderDefined then mySignatureRunId = ctx.runId
3778+
if !mySignature.isUnderDefined && !isProvisional then mySignatureRunId = ctx.runId
37793779
mySignature
37803780
end signature
37813781

0 commit comments

Comments
 (0)