Skip to content

Commit f42279d

Browse files
authored
Merge pull request #11300 from dotty-staging/fix-11277
Let the info of opaque types always depend on the prefix
2 parents f6ccc8c + 6985b5d commit f42279d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,6 +2304,7 @@ object Types {
23042304
*/
23052305
private def infoDependsOnPrefix(symd: SymDenotation, prefix: Type)(using Context): Boolean =
23062306
symd.maybeOwner.membersNeedAsSeenFrom(prefix) && !symd.is(NonMember)
2307+
|| prefix.isInstanceOf[Types.ThisType] && symd.is(Opaque) // see pos/i11277.scala for a test where this matters
23072308

23082309
/** Is this a reference to a class or object member? */
23092310
def isMemberRef(using Context): Boolean = designator match {

tests/pos/i11277.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Foo {
2+
opaque type Num = Int
3+
4+
val z = Test.id(this)(1)
5+
}
6+
object Test {
7+
def id(f: Foo)(x: f.Num): f.Num = x
8+
}

0 commit comments

Comments
 (0)