diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index 259ac00b8cce..0c2654d3c42d 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -801,6 +801,7 @@ class TreeUnpickler(reader: TastyReader, ValDef(tpt) case TYPEDEF | TYPEPARAM => if (sym.isClass) { + sym.owner.ensureCompleted() // scalacLinkedClass uses unforcedDecls. Make sure it does not miss anything. val companion = sym.scalacLinkedClass // Is the companion defined in the same Tasty file as `sym`? diff --git a/tests/pos/i6989/Container_1.scala b/tests/pos/i6989/Container_1.scala new file mode 100644 index 000000000000..3495bfd50169 --- /dev/null +++ b/tests/pos/i6989/Container_1.scala @@ -0,0 +1,12 @@ +package mypkg + +object Container { + class StringExtras(val s: String) extends AnyVal { + def op(item: Int): Int = ??? + } +} + +trait Container { + import Container._ + implicit def mkStringExtras(s: String): StringExtras = new StringExtras(s) +} \ No newline at end of file diff --git a/tests/pos/i6989/SimpleTest_2.scala b/tests/pos/i6989/SimpleTest_2.scala new file mode 100644 index 000000000000..4b73d5aeba46 --- /dev/null +++ b/tests/pos/i6989/SimpleTest_2.scala @@ -0,0 +1,5 @@ +package mypkg + +class SimpleTest extends Container { + "foo".op(5) +}