aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 4f27912f1..734f1c660 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -1653,7 +1653,10 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
case SearchSuccess(inferred, _, _) =>
adapt(inferred, pt)
case failure: SearchFailure =>
- if (pt.isInstanceOf[ProtoType] && !failure.isInstanceOf[AmbiguousImplicits]) tree
+ if (
+ pt.isInstanceOf[ProtoType] && !failure.isInstanceOf[AmbiguousImplicits] ||
+ tree.tpe.<:<(pt)(ctx.addMode(Mode.GADTflexible))
+ ) tree
else err.typeMismatch(tree, pt, failure)
}
}