aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2017-04-11 17:49:38 +0200
committerGitHub <noreply@github.com>2017-04-11 17:49:38 +0200
commitd63191d1d68a7de0bc622356b5af1599b25cbf25 (patch)
tree9c7e69ef3e37414b7f0c2cda173cab75c4cb725b
parent65dc7ad151a38158a45c5836d5e1f0fd48b8e396 (diff)
parent35d0acdad24717c1843304fd5eb124313658e7d2 (diff)
downloaddotty-d63191d1d68a7de0bc622356b5af1599b25cbf25.tar.gz
dotty-d63191d1d68a7de0bc622356b5af1599b25cbf25.tar.bz2
dotty-d63191d1d68a7de0bc622356b5af1599b25cbf25.zip
Merge pull request #2228 from dotty-staging/fix-#2218
Fix #2218: Add fullyDefinedType for class parent types
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Namer.scala2
-rw-r--r--tests/pos/i2218.scala9
2 files changed, 10 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala
index 19b6dfa71..da9f9f6ac 100644
--- a/compiler/src/dotty/tools/dotc/typer/Namer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala
@@ -843,7 +843,7 @@ class Namer { typer: Typer =>
val targs1 = targs map (typedAheadType(_))
val ptype = typedAheadType(tpt).tpe appliedTo targs1.tpes
if (ptype.typeParams.isEmpty) ptype
- else typedAheadExpr(parent).tpe
+ else fullyDefinedType(typedAheadExpr(parent).tpe, "class parent", parent.pos)
}
/* Check parent type tree `parent` for the following well-formedness conditions:
diff --git a/tests/pos/i2218.scala b/tests/pos/i2218.scala
new file mode 100644
index 000000000..fbede8b9b
--- /dev/null
+++ b/tests/pos/i2218.scala
@@ -0,0 +1,9 @@
+trait Rule[In]
+
+class C {
+ def ruleWithName[In](f: In => Int): Rule[In] = {
+ new DefaultRule(f) {}
+ }
+
+ class DefaultRule[In](f: In => Int) extends Rule[In]
+}