Skip to content

Fix #939. Allows IntMap and LongMap to compile #1022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/dotty/tools/dotc/transform/PatternMatcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,8 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
// - Scala's arrays are invariant (so we don't drop type tests unsoundly)
if (extractorArgTypeTest) mkDefault
else expectedTp match {
case ThisType(tref) if tref.symbol.flags is Flags.Module => and(mkEqualsTest(ref(tref.symbol)), mkTypeTest) // must use == to support e.g. List() == Nil
case ThisType(tref) if tref.symbol.flags is Flags.Module =>
and(mkEqualsTest(ref(tref.symbol.companionModule)), mkTypeTest) // must use == to support e.g. List() == Nil
case ConstantType(Constant(null)) if isAnyRef => mkEqTest(expTp(Literal(Constant(null))))
case ConstantType(const) => mkEqualsTest(expTp(Literal(const)))
case t:SingletonType => mkEqTest(singleton(expectedTp)) // SI-4577, SI-4897
Expand Down
8 changes: 3 additions & 5 deletions test/dotc/scala-collections.whitelist
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,11 @@
./scala-scala/src/library/scala/collection/immutable/HashMap.scala
./scala-scala/src/library/scala/collection/immutable/HashSet.scala

# https://github.com/lampepfl/dotty/issues/939 -> @darkdimius
#./scala-scala/src/library/scala/collection/immutable/IntMap.scala

./scala-scala/src/library/scala/collection/immutable/IntMap.scala
./scala-scala/src/library/scala/collection/immutable/ListMap.scala
./scala-scala/src/library/scala/collection/immutable/ListSet.scala

# https://github.com/lampepfl/dotty/issues/939 -> @darkdimius
#./scala-scala/src/library/scala/collection/immutable/LongMap.scala
./scala-scala/src/library/scala/collection/immutable/LongMap.scala

./scala-scala/src/library/scala/collection/immutable/Map.scala
./scala-scala/src/library/scala/collection/immutable/MapLike.scala
Expand Down
8 changes: 8 additions & 0 deletions tests/pos/i939.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
object IntMap {
private case object Nil {
override def equals(that : Any) = that match {
case _: this.type => true
case _ => super.equals(that)
}
}
}