File tree 2 files changed +18
-1
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1063,7 +1063,16 @@ object Denotations {
1063
1063
info.asSeenFrom(pre, owner),
1064
1064
if (symbol.is(Opaque ) || this .prefix != NoPrefix ) pre else this .prefix)
1065
1065
1066
- if (! owner.membersNeedAsSeenFrom(pre) || symbol.is(NonMember )) this
1066
+ // Tt could happen that we see the symbol with prefix `this` as a member a different class
1067
+ // through a self type and that it then has a different info. In this case we have to go
1068
+ // through the asSeenFrom to switch the type back. Test case is pos/i9352.scala.
1069
+ def hasOriginalInfo : Boolean = this match
1070
+ case sd : SymDenotation => true
1071
+ case _ => info eq symbol.info
1072
+
1073
+ if ! owner.membersNeedAsSeenFrom(pre) && ((pre ne owner.thisType) || hasOriginalInfo)
1074
+ || symbol.is(NonMember )
1075
+ then this
1067
1076
else derived(symbol.info)
1068
1077
}
1069
1078
}
Original file line number Diff line number Diff line change
1
+ abstract class Foo [B ] extends Bar [B ]
2
+
3
+ trait Bar [A ]:
4
+ self : Foo [A ] =>
5
+
6
+ def foo : Unit = bar(??? )
7
+ def bar (f : A ) : Unit
8
+
You can’t perform that action at this time.
0 commit comments