Skip to content

Commit 79281da

Browse files
authored
Merge pull request #3776 from dotty-staging/fix-upwardsThisType
Fix #3775: Fix RefChecks#upwardsThisType
2 parents 6ca9478 + d733e70 commit 79281da

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ object RefChecks {
8686
*/
8787
private def upwardsThisType(cls: Symbol)(implicit ctx: Context) = cls.info match {
8888
case ClassInfo(_, _, _, _, tp: Type) if (tp ne cls.typeRef) && !cls.is(ModuleOrFinal) =>
89-
SkolemType(cls.typeRef).withName(nme.this_)
89+
SkolemType(cls.appliedRef).withName(nme.this_)
9090
case _ =>
9191
cls.thisType
9292
}

tests/neg/i3775.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
trait Iterator[A] {
2+
def next(): A
3+
}
4+
5+
class IntMapIterator[T] extends Iterator[T] {
6+
def next: T = ??? // error: overriding method next in trait Iterator of type (): IntMapIterator.this.T;
7+
// method next of type => IntMapIterator.this.T has incompatible type
8+
}

0 commit comments

Comments
 (0)