Skip to content

Commit f38d849

Browse files
committed
Generalize use of canDefineFurther in recover
We should retry adapt if we can instantiate typevars in either the type of the tree or the expected type
1 parent 7a58237 commit f38d849

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3685,7 +3685,7 @@ class Typer extends Namer
36853685
return readapt(tree.cast(target))
36863686

36873687
def recover(failure: SearchFailureType) =
3688-
if canDefineFurther(wtp) then readapt(tree)
3688+
if canDefineFurther(wtp) || canDefineFurther(pt) then readapt(tree)
36893689
else err.typeMismatch(tree, pt, failure)
36903690

36913691
pt match

0 commit comments

Comments
 (0)