diff options
author | Martin Odersky <odersky@gmail.com> | 2014-06-12 15:50:37 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-06-12 15:50:37 +0200 |
commit | a77a4f6d8bd8f9990eac23859c399abb3b93df7c (patch) | |
tree | 98f10e70a6daec4df7a27f4774305e30f127c79e /src | |
parent | c4f96837538e953df3473107bd5d622092f74d80 (diff) | |
download | dotty-a77a4f6d8bd8f9990eac23859c399abb3b93df7c.tar.gz dotty-a77a4f6d8bd8f9990eac23859c399abb3b93df7c.tar.bz2 dotty-a77a4f6d8bd8f9990eac23859c399abb3b93df7c.zip |
Fix RefinementType#member
Type members used to always pick the last refined info for a type name.
This is incorrect, as a type might have several refinements for the
same type name, which are not necessarily subsumed by the last one.
We now only pick the last one if it is an alias type (assuming we check
for conflicts elsewhere).
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 8677ec6d2..dda5134c1 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -375,9 +375,10 @@ object Types { def goRefined(tp: RefinedType) = { val pdenot = go(tp.parent) val rinfo = tp.refinedInfo.substThis(tp, pre) - if (name.isTypeName) // simplified case that runs more efficiently - pdenot.asSingleDenotation.derivedSingleDenotation(pdenot.symbol, rinfo) - else + if (name.isTypeName) {// simplified case that runs more efficiently + val jointInfo = if (rinfo.isAlias) rinfo else pdenot.info & rinfo + pdenot.asSingleDenotation.derivedSingleDenotation(pdenot.symbol, jointInfo) + } else pdenot & (new JointRefDenotation(NoSymbol, rinfo, Period.allInRun(ctx.runId)), pre) } def goThis(tp: ThisType) = { |