8000 [ci: last-only] merge 2.11.x onto 2.12.x (February 14, 2017) by SethTisue · Pull Request #5701 · scala/scala · GitHub
[go: up one dir, main page]

Skip to content

[ci: last-only] merge 2.11.x onto 2.12.x (February 14, 2017) #5701

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 51 commits into from
Feb 17, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
014ebc4
Small cleanups to pattern matcher
adriaanm Dec 21, 2016
80ce231
More robust outer test for patmat
adriaanm Dec 21, 2016
da98683
SI-9630 Fix spurious warning related to same-named case accessors [ba…
retronym Jan 27, 2016
23040fe
[Backport] Modify ArrayBuilder and WrappedArrayBuilder to be reusable
monkey-mas Dec 24, 2016
f618939
Fix documentation of immutable.Queue
Jasper-M Jan 3, 2017
8367bf6
Merge pull request #5624 from Jasper-M/patch-1
lrytz Jan 3, 2017
18269ea
Merge pull request #5612 from adriaanm/patmat_cleanup
adriaanm Jan 4, 2017
cb7192c
Restarr on 2.11.8-18269ea
adriaanm Jan 5, 2017
f31745a
SI-8774 Null link fields in mutable hash maps on removal.
Jul 21, 2016
5fd422b
Optimized HashTable.index
l0rinc Nov 22, 2016
26ad9cc
Changed modulo to bitwise AND in hash calculation
l0rinc Nov 22, 2016
276db03
Changed hashing bit rotation to use Integer.rotateRight
l0rinc Dec 6, 2016
02c30a1
Changed HashMap.getOrElseUpdate to only calculate the index once
l0rinc Nov 16, 2016
1e82a92
Simplify HashTable.index further
l0rinc Dec 6, 2016
1b6b19b
Merge pull request #5626 from adriaanm/rebase-5566
adriaanm Jan 6, 2017
4f5c30e
Merge pull request #5615 from monkey-mas/modify-ArrayBuilder-reusabil…
szeiger Jan 9, 2017
f841dab
support --show-log for partest command
adriaanm Jan 9, 2017
de361df
SI-8786 fix generic signature for @varargs forwarder methods
lrytz Jul 5, 2016
5b972dc
SI-10071 Separate compilation for varargs methods
dragos Nov 21, 2016
c603449
Don’t run the uncurry info transformer on Java symbols.
dragos Nov 24, 2016
8ad55f8
Simplify creation of varargs forwarder symbol
retronym Nov 24, 2016
8138e24
SI-9331 Fix canEqual for case classes with HK type params
retronym May 27, 2015
9165886
SI-9114 Fix crasher in pattern matcher with type aliases
retronym Jan 27, 2015
2113a7c
SI-9762 Update to JLine 2.14.3
retronym Apr 27, 2016
f070a76
SI-9762 Remove workaround after upstream fix in jline
retronym Apr 27, 2016
359b0bc
[backport] SI-6412 remove flaky test
SethTisue Oct 26, 2016
32a7461
Merge pull request #5635 from adriaanm/jline-2.14.3
adriaanm Jan 10, 2017
fac487e
Merge pull request #5633 from adriaanm/ticket/9331
adriaanm Jan 10, 2017
3696732
Merge pull request #5632 from adriaanm/ticket/9114
adriaanm Jan 10, 2017
a5d38ea
Merge pull request #5630 from adriaanm/rebase-5557
adriaanm Jan 11, 2017
648eba6
Fix the size of the stack used by RedBlackTree.iteratorFrom.
sjrd Jan 16, 2017
90a764b
Merge pull request #5645 from sjrd/avoid-array-oob-in-rbtree-iterator…
adriaanm Jan 24, 2017
dc7ff5d
SI-9013 SI-1459 Tests for inherited @varargs annotations
retronym Jan 10, 2017
a75d3fd
SI-1459 two bridges for impl of java generic vararg method
adriaanm Jan 12, 2017
6644017
Merge pull request #5631 from adriaanm/ticket/9013
adriaanm Jan 27, 2017
e803cf6
Avoid creating ListBuffer in List.mapConserve
rorygraves Sep 27, 2016
4f9faff
Test IndexedSeq, including ArrayOps, WrappedArray.
mkeskells Jan 25, 2017
d540bf0
Optimize slice and take in ArrayOps, WrappedArray
mkeskells Jan 25, 2017
eb5c513
Optimised implementation of List.filter/filterNot
rorygraves Oct 17, 2016
7e89663
Add benchmark for List.mapConserve
rorygraves Jan 28, 2017
f24c260
Handle WrappedArray the same way as ArrayOps for binary compatibility
szeiger Feb 2, 2017
214a158
Merge pull request #5664 from adriaanm/rework-coll-perf
adriaanm Feb 8, 2017
e08bccb
fix IndexedSeqTest to work in both Ant and sbt
SethTisue Feb 13, 2017
0965028
Merge pull request #5695 from SethTisue/fix-indexedseqtest-under-ant
SethTisue Feb 14, 2017
e04e281
Merge commit '8367bf68c1' into merge-2.11.x-to-2.12.x-20170214
SethTisue Feb 16, 2017
3fc5059
Merge commit '014ebc4' into merge-2.11.x-to-2.12.x-20170214
SethTisue Feb 16, 2017
2324405
Merge commit '32a7461037' into merge-2.11.x-to-2.12.x-20170214
SethTisue Feb 16, 2017
3e99598
Merge commit '36967321c7' into merge-2.11.x-to-2.12.x-20170214
SethTisue Feb 16, 2017
6be69d6
Merge commit 'a5d38ea334' into merge-2.11.x-to-2.12.x-20170214
SethTisue Feb 16, 2017
04c45e1
Merge commit '0965028809' into merge-2.11.x-to-2.12.x-20170214
SethTisue Feb 16, 2017
71a8a44
Merge branch '2.12.x' into merge-2.11.x-to-2.12.x-20170214
SethTisue Feb 17, 2017
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
Prev Previous commit
Next Next commit
SI-9630 Fix spurious warning related to same-named case accessors [ba…
…ckport]

Hash consing of trees within pattern match analysis was broken, and
considered `x1.foo#1` to be the same tree as `x1.foo#2`, even though
the two `foo`-s referred to different symbols.

The hash consing was based on `Tree#correspondsStructure`, but the
predicate in that function cannot veto correspondance, it can only
supplement the default structural comparison.

I've instead created a custom tree comparison method for use in
the pattern matcher that handles the tree shapes that we use.

(cherry picked from commit 79a52e6)
  • Loading branch information
retronym authored and adriaanm committed Dec 22, 2016
commit da986839d17dbbd41877df809e3efed8d63deb4e
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ trait ScalaLogic extends Interface with Logic with TreeAndTypeAnalysis {
// if X is mutable.
freshExistentialSubtype(t.tpe)
}
else trees find (a => a.correspondsStructure(t)(sameValue)) match {
else trees find (a => equivalentTree(a, t)) match {
case Some(orig) =>
debug.patmat("unique tp for tree: " + ((orig, orig.tpe)))
orig.tpe
Expand Down
16 changes: 10 additions & 6 deletions src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,15 @@ trait TreeAndTypeAnalysis extends Debugging {
tp <:< tpImpliedNormalizedToAny
}

// TODO: improve, e.g., for constants
def sameValue(a: Tree, b: Tree): Boolean = (a eq b) || ((a, b) match {
case (_ : Ident, _ : Ident) => a.symbol eq b.symbol
case _ => false
})
def equivalentTree(a: Tree, b: Tree): Boolean = (a, b) match {
case (Select(qual1, _), Select(qual2, _)) => equivalentTree(qual1, qual2) && a.symbol == b.symbol
case (Ident(_), Ident(_)) => a.symbol == b.symbol
case (Literal(c1), Literal(c2)) => c1 == c2
case (This(_), This(_)) => a.symbol == b.symbol
case (Apply(fun1, args1), Apply(fun2, args2)) => equivalentTree(fun1, fun2) && args1.corresponds(args2)(equivalentTree)
// Those are the only cases we need to handle in the pattern matcher
case _ => false
}

trait CheckableTreeAndTypeAnalysis {
val typer: Typer
Expand Down Expand Up @@ -277,7 +281,7 @@ trait MatchApproximation extends TreeAndTypeAnalysis with ScalaLogic with MatchT

// hashconsing trees (modulo value-equality)
def unique(t: Tree, tpOverride: Type = NoType): Tree =
trees find (a => a.correspondsStructure(t)(sameValue)) match {
trees find (a => equivalentTree(a, t)) match {
case Some(orig) =>
// debug.patmat("unique: "+ (t eq orig, orig))
orig
Expand Down
1 change: 1 addition & 0 deletions test/files/pos/t9399.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Xfatal-warnings
17 changes: 17 additions & 0 deletions test/files/pos/t9399.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sealed abstract class TA
sealed abstract class TB extends TA
case object A extends TA
case object B extends TB

sealed trait C
case class CTA(id: Int, da: TA) extends C
case class CTB(id: Int, da: TB) extends C

class Test {
def test(c: C): Unit = c match {
case CTA(_, A) =>
case CTA(_, B) =>
case CTB(_, B) =>
}
}

1 change: 1 addition & 0 deletions test/files/pos/t9411a.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Xfatal-warnings
27 changes: 27 additions & 0 deletions test/files/pos/t9411a.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
object OhNoes {

sealed trait F
sealed abstract class FA extends F
sealed abstract class FB extends F

case object FA1 extends FA
case object FB1 extends FB
case object FB2 extends FB

sealed trait G
case object G1 extends G
case object G2 extends G

sealed trait H
case class H1(a: FB, b: G) extends H
case class H2(a: F) extends H

val demo: H => Unit = {
case H1(FB1, G1) =>
case H1(FB2, G2) =>
case H2(_: FB) =>
case H2(_: FA) =>
case H1(FB1, G2) =>
case H1(FB2, G1) =>
}
}
1 change: 1 addition & 0 deletions test/files/pos/t9411b.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Xfatal-warnings
36 changes: 36 additions & 0 deletions test/files/pos/t9411b.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
object OhNoes {

sealed trait F
sealed abstract class FA extends F
sealed abstract class FB extends F

case object FA1 extends FA
case object FB1 extends FB
case object FB2 extends FB

sealed trait G
case object G1 extends G
case object G2 extends G

sealed trait H
case class H1(a: FB, b: G) extends H
case class H2(b: F) extends H

val demo: H => Unit = {
case H1(FB1, G1) =>
case H1(FB2, G2) =>
case H2(_: FB) =>
case H2(_: FA) =>
case H1(FB1, G2) =>
case H1(FB2, G1) =>
}

val demo2: H => Unit = {
case H2(_: FA) =>
case H2(_: FB) =>
case H1(FB1, G1) =>
case H1(FB2, G1) =>
case H1(FB1, G2) =>
case H1(FB2, G2) =>
}
}
1 change: 1 addition & 0 deletions test/files/pos/t9630.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Xfatal-warnings
9 changes: 9 additions & 0 deletions test/files/pos/t9630/t9630a.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

sealed trait Base
final case class Base_1(sameName: Some[Any]) extends Base
final case class Base_2(sameName: Nested) extends Base

sealed trait Nested
final case class Nested_1(x: Any) extends Nested
final case class Nested_2(y: Any) extends Nested

8 changes: 8 additions & 0 deletions test/files/pos/t9630/t9630b.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

class Test {
def test(b: Base): Unit = b match {
case Base_1(Some(_)) =>
case Base_2(Nested_1(_)) =>
case Base_2(Nested_2(_)) =>
}
}
0