Skip to content

Commit 0e290dc

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 e58ece8 commit 0e290dc

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
@@ -3678,7 +3678,7 @@ class Typer extends Namer
36783678
return readapt(tree.cast(target))
36793679

36803680
def recover(failure: SearchFailureType) =
3681-
if canDefineFurther(wtp) then readapt(tree)
3681+
if canDefineFurther(wtp) || canDefineFurther(pt) then readapt(tree)
36823682
else err.typeMismatch(tree, pt, failure)
36833683

36843684
pt match

0 commit comments

Comments
 (0)