summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2016-05-25 11:55:47 -0700
committerSom Snytt <som.snytt@gmail.com>2016-05-25 12:06:32 -0700
commit54dff8120786501f0e273166869b73b5f3accd17 (patch)
treec9464d96ab684c11ddfa43dd3adc86455abccc1f
parent808f3d071e97aa23b797f2c0616c207ff1f20229 (diff)
downloadscala-54dff8120786501f0e273166869b73b5f3accd17.tar.gz
scala-54dff8120786501f0e273166869b73b5f3accd17.tar.bz2
scala-54dff8120786501f0e273166869b73b5f3accd17.zip
SI-9382 Privatize enhanced x in Tuple2Zipped.Ops
Probably there should be an Abide rule to avoid leaking the "underlying value" of a value class. The spec or SIP defines "underlying type" but doesn't mention the underlying value. The argument for concealing the member is that it is redundant and makes autocompletion results harder to read. Also, possibly an additional implicit might want to add a member so-named.
-rw-r--r--src/library/scala/runtime/Tuple2Zipped.scala2
-rw-r--r--src/library/scala/runtime/Tuple3Zipped.scala2
-rw-r--r--test/files/neg/t9382.check10
-rw-r--r--test/files/neg/t9382.scala6
4 files changed, 18 insertions, 2 deletions
diff --git a/src/library/scala/runtime/Tuple2Zipped.scala b/src/library/scala/runtime/Tuple2Zipped.scala
index 15331d4160..41ed9644aa 100644
--- a/src/library/scala/runtime/Tuple2Zipped.scala
+++ b/src/library/scala/runtime/Tuple2Zipped.scala
@@ -115,7 +115,7 @@ final class Tuple2Zipped[El1, Repr1, El2, Repr2](val colls: (TraversableLike[El1
}
object Tuple2Zipped {
- final class Ops[T1, T2](val x: (T1, T2)) extends AnyVal {
+ final class Ops[T1, T2](private val x: (T1, T2)) extends AnyVal {
def invert[El1, CC1[X] <: TraversableOnce[X], El2, CC2[X] <: TraversableOnce[X], That]
(implicit w1: T1 <:< CC1[El1],
w2: T2 <:< CC2[El2],
diff --git a/src/library/scala/runtime/Tuple3Zipped.scala b/src/library/scala/runtime/Tuple3Zipped.scala
index 62bee5ff0e..89f401ea80 100644
--- a/src/library/scala/runtime/Tuple3Zipped.scala
+++ b/src/library/scala/runtime/Tuple3Zipped.scala
@@ -123,7 +123,7 @@ final class Tuple3Zipped[El1, Repr1, El2, Repr2, El3, Repr3](val colls: (Travers
}
object Tuple3Zipped {
- final class Ops[T1, T2, T3](val x: (T1, T2, T3)) extends AnyVal {
+ final class Ops[T1, T2, T3](private val x: (T1, T2, T3)) extends AnyVal {
def invert[El1, CC1[X] <: TraversableOnce[X], El2, CC2[X] <: TraversableOnce[X], El3, CC3[X] <: TraversableOnce[X], That]
(implicit w1: T1 <:< CC1[El1],
w2: T2 <:< CC2[El2],
diff --git a/test/files/neg/t9382.check b/test/files/neg/t9382.check
new file mode 100644
index 0000000000..93bf48926a
--- /dev/null
+++ b/test/files/neg/t9382.check
@@ -0,0 +1,10 @@
+t9382.scala:3: error: value x is not a member of (List[Int], List[Int])
+ def f = (List(1,2,3), List(4,5,6)).x
+ ^
+t9382.scala:4: error: value x is not a member of (List[Int], List[Int], List[Int])
+ def g = (List(1,2,3), List(4,5,6), List(7,8,9)).x
+ ^
+t9382.scala:5: error: value x is not a member of (Int, Int)
+ def huh = (1,2).x
+ ^
+three errors found
diff --git a/test/files/neg/t9382.scala b/test/files/neg/t9382.scala
new file mode 100644
index 0000000000..19703525e4
--- /dev/null
+++ b/test/files/neg/t9382.scala
@@ -0,0 +1,6 @@
+
+trait T {
+ def f = (List(1,2,3), List(4,5,6)).x
+ def g = (List(1,2,3), List(4,5,6), List(7,8,9)).x
+ def huh = (1,2).x
+}