Skip to content

Commit b253252

Browse files
committed
Merge pull request #309 from dotty-staging/fix/#306-avoidance-problem
Avpid returning ExprTypes from blocks.
2 parents 344b055 + 0424e5b commit b253252

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/dotty/tools/dotc/typer/TypeAssigner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ trait TypeAssigner {
4343
}
4444
def apply(tp: Type) = tp match {
4545
case tp: TermRef if toAvoid(tp) && variance > 0 =>
46-
apply(tp.info)
46+
apply(tp.info.widenExpr)
4747
case tp: TypeRef if (forbidden contains tp.symbol) || toAvoid(tp.prefix) =>
4848
tp.info match {
4949
case TypeAlias(ref) =>

tests/pos/i0306.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
object bar {
2+
3+
class C[T <: Seq[_]]
4+
5+
val x: AnyRef = new C
6+
7+
val y = x match {
8+
case x: C[u] =>
9+
def xx: u = xx
10+
xx
11+
}
12+
13+
val z= {
14+
def xx: String = xx
15+
xx
16+
}
17+
}

0 commit comments

Comments
 (0)