diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 9792f454e135..7a6a8789d8b0 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -4418,7 +4418,7 @@ object Types { decls.toList.foldLeft(this) { (cinfo, sym) => if sym.isOpaqueAlias then cls.setFlag(Opaque) - def force = + def force(using Context) = if sym.isOpaqueAlias then // could have been reset because of a syntax error sym.infoOrCompleter match case completer: LazyType => @@ -4429,7 +4429,7 @@ object Types { else defn.AnyType // dummy type in case of errors def refineSelfType(selfType: Type) = RefinedType(selfType, sym.name, - TypeAlias(LazyRef(_ => force, reportCycles = true))) + TypeAlias(LazyRef(force(using _), reportCycles = true))) cinfo.selfInfo match case self: Type => cinfo.derivedClassInfo( diff --git a/tests/pos/i9202.scala b/tests/pos/i9202.scala new file mode 100644 index 000000000000..5b744daefb5d --- /dev/null +++ b/tests/pos/i9202.scala @@ -0,0 +1,5 @@ +object i9202 { + opaque type SomeUnrelatedOpaque = Int + class A[T](val d: T) + extension Ex2SameNameToBeToImport on [T] (x: A[T]) { def value: T = x.d } +} \ No newline at end of file