diff --git a/community-build/community-projects/fastparse b/community-build/community-projects/fastparse index 5bb27834d584..d13f34b47079 160000 --- a/community-build/community-projects/fastparse +++ b/community-build/community-projects/fastparse @@ -1 +1 @@ -Subproject commit 5bb27834d58422282bc12a1b5a03a69dc081338e +Subproject commit d13f34b470790536bf64deed062b7da53b098c05 diff --git a/compiler/src/dotty/tools/dotc/typer/Inferencing.scala b/compiler/src/dotty/tools/dotc/typer/Inferencing.scala index 45c7c74ae459..06c9f1e51443 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inferencing.scala @@ -433,7 +433,14 @@ trait Inferencing { this: Typer => else if (!hasUnreportedErrors) if (v.intValue != 0) { typr.println(i"interpolate $tvar in $state in $tree: $tp, fromBelow = ${v.intValue == 1}, $constraint") - tvar.instantiate(fromBelow = v.intValue == 1) + if (true) { + val fromBelow = v.intValue == 1 + val instType = ctx.typeComparer.instanceType(tvar.origin, fromBelow) + if (!(fromBelow && instType.isRef(defn.NothingClass))) + tvar.instantiateWith(instType) + } + else + tvar.instantiate(fromBelow = v.intValue == 1) } else typr.println(i"no interpolation for nonvariant $tvar in $state") } diff --git a/tests/pos/i536.scala b/tests/neg/i536.scala similarity index 62% rename from tests/pos/i536.scala rename to tests/neg/i536.scala index f2b8f9ce6b28..e96ff48d12f7 100644 --- a/tests/pos/i536.scala +++ b/tests/neg/i536.scala @@ -8,5 +8,5 @@ object Max { val m1 = max(xs) val m2 = max(null) - java.util.Collections.max(null) + java.util.Collections.max(null) // error: Type argument Comparable[_] does not conform to upper bound Comparable[_ >: LazyRef(Comparable[_])] } diff --git a/tests/pos/enum-interop.scala b/tests/pending/pos/enum-interop.scala similarity index 100% rename from tests/pos/enum-interop.scala rename to tests/pending/pos/enum-interop.scala diff --git a/tests/run/type-propagation.scala b/tests/run/type-propagation.scala new file mode 100644 index 000000000000..b01d716269ac --- /dev/null +++ b/tests/run/type-propagation.scala @@ -0,0 +1,7 @@ +object Test extends App { + def foo: String = { + "abc".asInstanceOf + } + + assert(foo == "abc") +}