diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 59f8c37cbf55..e5b826e4f2b1 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -2299,6 +2299,7 @@ object Types { */ private def infoDependsOnPrefix(symd: SymDenotation, prefix: Type)(using Context): Boolean = symd.maybeOwner.membersNeedAsSeenFrom(prefix) && !symd.is(NonMember) + || prefix.isInstanceOf[Types.ThisType] && symd.is(Opaque) // see pos/i11277.scala for a test where this matters /** Is this a reference to a class or object member? */ def isMemberRef(using Context): Boolean = designator match { diff --git a/tests/pos/i11277.scala b/tests/pos/i11277.scala new file mode 100644 index 000000000000..b1dd6a2a119f --- /dev/null +++ b/tests/pos/i11277.scala @@ -0,0 +1,8 @@ +class Foo { + opaque type Num = Int + + val z = Test.id(this)(1) +} +object Test { + def id(f: Foo)(x: f.Num): f.Num = x +} \ No newline at end of file