diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-06-07 16:05:50 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-06-07 16:05:50 +0200 |
commit | 2b3c5c60cea83b3add2774bbfa840aa91312cb01 (patch) | |
tree | 248547afd974775aec6c2c60b79835f2aa80a9a7 /src/dotty/tools/dotc/typer/Typer.scala | |
parent | 2414bfeda301410fe64f8adddd22a24a15621850 (diff) | |
download | dotty-2b3c5c60cea83b3add2774bbfa840aa91312cb01.tar.gz dotty-2b3c5c60cea83b3add2774bbfa840aa91312cb01.tar.bz2 dotty-2b3c5c60cea83b3add2774bbfa840aa91312cb01.zip |
Move GADT check to `typeTyped`
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 734f1c660..07710d3b1 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -448,6 +448,10 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit return typed(untpd.Apply(untpd.TypedSplice(arg), tree.expr), pt) case _ => } + case tref: TypeRef if tref.symbol.isClass && !ctx.isAfterTyper => + val setBefore = ctx.mode is Mode.GADTflexible + tpt1.tpe.<:<(pt)(ctx.addMode(Mode.GADTflexible)) + if (!setBefore) ctx.retractMode(Mode.GADTflexible) case _ => } ascription(tpt1, isWildcard = true) @@ -1653,10 +1657,7 @@ 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.tpe.<:<(pt)(ctx.addMode(Mode.GADTflexible)) - ) tree + if (pt.isInstanceOf[ProtoType] && !failure.isInstanceOf[AmbiguousImplicits]) tree else err.typeMismatch(tree, pt, failure) } } |