diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index d4fa6a819dc4..b9f4ce48092b 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -118,10 +118,9 @@ object Types { if t.mightBeProvisional then t.mightBeProvisional = t match case t: TypeRef => - !t.currentSymbol.isStatic && { + t.currentSymbol.isProvisional || !t.currentSymbol.isStatic && { (t: Type).mightBeProvisional = false // break cycles - t.symbol.isProvisional - || test(t.prefix, theAcc) + test(t.prefix, theAcc) || t.denot.infoOrCompleter.match case info: LazyType => true case info: AliasingBounds => test(info.alias, theAcc) diff --git a/tests/pos/i16950.scala b/tests/pos/i16950.scala new file mode 100644 index 000000000000..ac95a477136e --- /dev/null +++ b/tests/pos/i16950.scala @@ -0,0 +1,11 @@ +object Foo: + def bar(x : Bar.YOf[Any]): Unit = ??? + +trait K: + type CType <: Bar.YOf[Any] + def foo : K = + val x : CType = ??? + x // was: error: Found: CType, Expected: K + +object Bar: + type YOf[T] = K { type M }