Skip to content

Commit 18cf1b4

Browse files
committed
Put back test in instantiate
1 parent 21f542b commit 18cf1b4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4919,7 +4919,12 @@ object Types {
49194919
* is also a singleton type.
49204920
*/
49214921
def instantiate(fromBelow: Boolean)(using Context): Type =
4922-
instantiateWith(typeToInstantiateWith(fromBelow))
4922+
val tp = typeToInstantiateWith(fromBelow)
4923+
if myInst.exists then // The line above might have triggered instantiation of the current type variable
4924+
Member
4925+
myInst
4926+
else
4927+
instantiateWith(tp)
49234928

49244929
/** Widen unions when instantiating this variable in the current context? */
49254930
def widenUnions(using Context): Boolean = !ctx.typerState.constraint.isHard(this)

0 commit comments

Comments
 (0)