diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-02-17 22:13:19 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-02-17 22:24:17 +0100 |
commit | b31f9ab97912ad2d26df16ef223b874970175388 (patch) | |
tree | 64862658ba844ee760946cca1a8bfa7b68244696 /test/files | |
parent | 6152e9c3153a9c028066abf6b91f6bf105eacdfe (diff) | |
download | scala-b31f9ab97912ad2d26df16ef223b874970175388.tar.gz scala-b31f9ab97912ad2d26df16ef223b874970175388.tar.bz2 scala-b31f9ab97912ad2d26df16ef223b874970175388.zip |
SI-8301 fix regression with refinement subtyping, wildcard type.
In the enclosed test case, the list of candidate implicit is
checked for eligibility with the view by:
pt = Test.sym.type => ?{def asFreeType: ?}
tp = (sym: Test.u.Symbol)Test.u.CompatibleSymbol
matchesPt(tp, pt)
This ends up in `TypeComparers#specializesSym`, which compares:
symLo = asFreeType: => Universe.this.TypeSymbol
symHi = asFreeType: ?
Before the regression in fada1ef6, that method called `isStable`
on both of these to make sure that `symLo` was as least as stable
as `symHi`. Both returned `false`, and, they matched.
After that refactoring, two calls were made. `isStable` *only*
checked for stability, and gave the same results as before.
But, the new check for volatility believes that the low symbol
was more volatile than the high, because `WildCardType` is treated
as non-volatile.
Really, it should have the same volatility as whatever it is
being compared to, so that these sort of comparisons yield true.
This commit ammends `specializesSym` to special case `symHi: ?`,
and ignore the volatilty gap in that case.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/pos/t8301.scala | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/files/pos/t8301.scala b/test/files/pos/t8301.scala new file mode 100644 index 0000000000..2d10864c57 --- /dev/null +++ b/test/files/pos/t8301.scala @@ -0,0 +1,19 @@ +trait Universe { + type Symbol >: Null <: AnyRef with SymbolApi + trait SymbolApi + + type TypeSymbol >: Null <: TypeSymbolApi with Symbol + trait TypeSymbolApi + + implicit class CompatibleSymbol(sym: Symbol) { + def asFreeType: TypeSymbol = ??? + } +} + +object Test extends App { + val u: Universe = ??? + import u._ + + val sym: Symbol = ??? + sym.asFreeType +} |