diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala index aaadbb66ec12..b42f09da4bdc 100644 --- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala @@ -86,7 +86,7 @@ object RefChecks { */ private def upwardsThisType(cls: Symbol)(implicit ctx: Context) = cls.info match { case ClassInfo(_, _, _, _, tp: Type) if (tp ne cls.typeRef) && !cls.is(ModuleOrFinal) => - SkolemType(cls.typeRef).withName(nme.this_) + SkolemType(cls.appliedRef).withName(nme.this_) case _ => cls.thisType } diff --git a/tests/neg/i3775.scala b/tests/neg/i3775.scala new file mode 100644 index 000000000000..0735e662d1af --- /dev/null +++ b/tests/neg/i3775.scala @@ -0,0 +1,8 @@ +trait Iterator[A] { + def next(): A +} + +class IntMapIterator[T] extends Iterator[T] { + def next: T = ??? // error: overriding method next in trait Iterator of type (): IntMapIterator.this.T; + // method next of type => IntMapIterator.this.T has incompatible type +}