Skip to content

Commit 33d7e9c

Browse files
committed
Yckeck cannot reliably check returned types agains polyParams.
Check is now done only after erasure.
1 parent 1b52f09 commit 33d7e9c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/dotty/tools/dotc/transform/TreeChecker.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ class TreeChecker extends Phase with SymTransformer {
211211
val ret = super.typedReturn(tree)
212212
val from = if(ret.from.isEmpty) ctx.owner.enclosingMethod else ret.from.symbol
213213
val rType = from.info.finalResultType
214-
assert(ret.expr.tpe <:< rType)
214+
if(ctx.erasedTypes) // before erasure resultType could be a PolyParam. Nothing could be done about it.
215+
assert(ret.expr.tpe <:< rType)
215216
ret
216217
}
217218

0 commit comments

Comments
 (0)