Skip to content

Commit fb6fff4

Browse files
committed
Fix #7159: Add missing asSeenFrom when updating denotations
1 parent beba63a commit fb6fff4

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,13 +1918,19 @@ object Types {
19181918
finish(symd.current)
19191919
}
19201920

1921+
def current(sd: SingleDenotation) = finish {
1922+
sd.current match
1923+
case sdc: SymDenotation if prefix ne sdc.owner.thisType => sdc.asSeenFrom(prefix)
1924+
case sdc => sdc
1925+
}
1926+
19211927
lastDenotation match {
19221928
case lastd0: SingleDenotation =>
19231929
val lastd = lastd0.skipRemoved
1924-
if (lastd.validFor.runId == ctx.runId && (checkedPeriod != Nowhere)) finish(lastd.current)
1930+
if (lastd.validFor.runId == ctx.runId && (checkedPeriod != Nowhere)) current(lastd)
19251931
else lastd match {
19261932
case lastd: SymDenotation =>
1927-
if (ctx.stillValid(lastd) && (checkedPeriod != Nowhere)) finish(lastd.current)
1933+
if (ctx.stillValid(lastd) && (checkedPeriod != Nowhere)) current(lastd)
19281934
else finish(memberDenot(lastd.initial.name, allowPrivate = false))
19291935
case _ =>
19301936
fromDesignator

tests/pos/i7159.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
trait CompilerInterface {
2+
type Tree22
3+
}
4+
5+
class Reflect(val internal: CompilerInterface) {
6+
opaque type Tree22 = internal.Tree22
7+
def show(t: Tree22): String = ???
8+
}
9+
10+
object App {
11+
val refl: Reflect = ???
12+
import refl._
13+
14+
show(??? : Tree22)
15+
}

0 commit comments

Comments
 (0)