Skip to content

Commit d63191d

Browse files
authored
Merge pull request #2228 from dotty-staging/fix-#2218
Fix #2218: Add fullyDefinedType for class parent types
2 parents 65dc7ad + 35d0acd commit d63191d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ class Namer { typer: Typer =>
843843
val targs1 = targs map (typedAheadType(_))
844844
val ptype = typedAheadType(tpt).tpe appliedTo targs1.tpes
845845
if (ptype.typeParams.isEmpty) ptype
846-
else typedAheadExpr(parent).tpe
846+
else fullyDefinedType(typedAheadExpr(parent).tpe, "class parent", parent.pos)
847847
}
848848

849849
/* Check parent type tree `parent` for the following well-formedness conditions:

tests/pos/i2218.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
trait Rule[In]
2+
3+
class C {
4+
def ruleWithName[In](f: In => Int): Rule[In] = {
5+
new DefaultRule(f) {}
6+
}
7+
8+
class DefaultRule[In](f: In => Int) extends Rule[In]
9+
}

0 commit comments

Comments
 (0)