Skip to content

Commit 79686e6

Browse files
committed
Fix #2948: Use symbol's info when mapping inherited denotations
The test case shows that it is inadmissible to combine the infos of inherited denotations into a new denotation. The problem here is that a type parameter CC was instantiated in an inherited denotation to Traversable, yet the parameter was afterwards instantiated to ListBuffer. This shows that infos from inheroted denotations are useless; instead we have to go back to the inherited symbol's infos and map them with an asSeenFrom. This fix also shows that one of the reasons for abandoning #2947 was wrong. We cannot form denotations from parent denotations in any case, so instantiating early should be fine with the change in this commit.
1 parent 3033412 commit 79686e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ object Denotations {
10051005
case _ => if (symbol.exists) symbol.owner else NoSymbol
10061006
}
10071007
if (!owner.membersNeedAsSeenFrom(pre)) this
1008-
else derivedSingleDenotation(symbol, info.asSeenFrom(pre, owner))
1008+
else derivedSingleDenotation(symbol, symbol.info.asSeenFrom(pre, owner))
10091009
}
10101010

10111011
private def overlaps(fs: FlagSet)(implicit ctx: Context): Boolean = this match {

0 commit comments

Comments
 (0)