aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-11-24 14:45:25 +0100
committerGitHub <noreply@github.com>2016-11-24 14:45:25 +0100
commit3588832eb3c45b151d78e66b5cde1f4e772d52a8 (patch)
tree9cc2674ac3108d38705bec31c5ae3a1979f81332 /compiler/src/dotty
parent3599c243c86ae0a926ef45a435d38b7878dc322f (diff)
parenta911a701e775b5151bc146dc221745110f304057 (diff)
downloaddotty-3588832eb3c45b151d78e66b5cde1f4e772d52a8.tar.gz
dotty-3588832eb3c45b151d78e66b5cde1f4e772d52a8.tar.bz2
dotty-3588832eb3c45b151d78e66b5cde1f4e772d52a8.zip
Merge pull request #1740 from dotty-staging/fix-#1737
Fix #1737: Enable GADT checking for objects
Diffstat (limited to 'compiler/src/dotty')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Typer.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index 9f5a942d6..ccc74cfff 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1830,7 +1830,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
ctx.typeComparer.GADTused = false
if (ctx.mode is Mode.Pattern) {
tree match {
- case _: RefTree | _: Literal if !isVarPattern(tree) =>
+ case _: RefTree | _: Literal
+ if !isVarPattern(tree) &&
+ !(tree.tpe <:< pt)(ctx.addMode(Mode.GADTflexible)) =>
checkCanEqual(pt, wtp, tree.pos)(ctx.retractMode(Mode.Pattern))
case _ =>
}