aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/typer/TypeAssigner.scala2
-rw-r--r--tests/pos/i0306.scala17
2 files changed, 18 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala
index 46aa2e953..f4b0ef4f2 100644
--- a/src/dotty/tools/dotc/typer/TypeAssigner.scala
+++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala
@@ -43,7 +43,7 @@ trait TypeAssigner {
}
def apply(tp: Type) = tp match {
case tp: TermRef if toAvoid(tp) && variance > 0 =>
- apply(tp.info)
+ apply(tp.info.widenExpr)
case tp: TypeRef if (forbidden contains tp.symbol) || toAvoid(tp.prefix) =>
tp.info match {
case TypeAlias(ref) =>
diff --git a/tests/pos/i0306.scala b/tests/pos/i0306.scala
new file mode 100644
index 000000000..5a242fa83
--- /dev/null
+++ b/tests/pos/i0306.scala
@@ -0,0 +1,17 @@
+object bar {
+
+ class C[T <: Seq[_]]
+
+ val x: AnyRef = new C
+
+ val y = x match {
+ case x: C[u] =>
+ def xx: u = xx
+ xx
+ }
+
+ val z= {
+ def xx: String = xx
+ xx
+ }
+}