diff options
author | Janek Bogucki <janekdb@gmail.com> | 2016-02-11 13:33:17 +0000 |
---|---|---|
committer | Janek Bogucki <janekdb@gmail.com> | 2016-02-11 13:40:00 +0000 |
commit | b501cb82cd85743a4479efa14a993a1502565775 (patch) | |
tree | 5dd73b02c32f96eaf222fab88ef6a2fb46cfd3a6 /src | |
parent | c0a6ab2376f08013c923de4e10bfdb925d0ee728 (diff) | |
download | scala-b501cb82cd85743a4479efa14a993a1502565775.tar.gz scala-b501cb82cd85743a4479efa14a993a1502565775.tar.bz2 scala-b501cb82cd85743a4479efa14a993a1502565775.zip |
Fix off-by-one documentation error in Product<N>
Sanity check:
scala> case class P2(i: Int, j: Int)
defined class P2
val p2 = P2(1, 3)
p2.productElement(0)
res0: Any = 1
p2.productElement(1)
res1: Any = 3
p2.productElement(2)
java.lang.IndexOutOfBoundsException: 2
at P2.productElement(<console>:10)
Diffstat (limited to 'src')
23 files changed, 23 insertions, 24 deletions
diff --git a/src/build/genprod.scala b/src/build/genprod.scala index b470348e8c..f85a151ae5 100644 --- a/src/build/genprod.scala +++ b/src/build/genprod.scala @@ -15,7 +15,6 @@ import scala.language.postfixOps * where the argument is the desired output directory * * @author Burak Emir, Stephane Micheloud, Geoffrey Washburn, Paul Phillips - * @version 1.1 */ object genprod extends App { val MAX_ARITY = 22 @@ -353,7 +352,7 @@ object ProductTwo extends Product(2) class Product(val i: Int) extends Group("Product") with Arity { val productElementComment = """ - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product1.scala b/src/library/scala/Product1.scala index dbc34ba66a..e82300adf6 100644 --- a/src/library/scala/Product1.scala +++ b/src/library/scala/Product1.scala @@ -24,7 +24,7 @@ trait Product1[@specialized(Int, Long, Double) +T1] extends Any with Product { override def productArity = 1 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product10.scala b/src/library/scala/Product10.scala index 70de79d49a..5fc4874048 100644 --- a/src/library/scala/Product10.scala +++ b/src/library/scala/Product10.scala @@ -24,7 +24,7 @@ trait Product10[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10] extends Any w override def productArity = 10 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product11.scala b/src/library/scala/Product11.scala index 1bb79ac017..dcebc90e3e 100644 --- a/src/library/scala/Product11.scala +++ b/src/library/scala/Product11.scala @@ -24,7 +24,7 @@ trait Product11[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11] extends override def productArity = 11 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product12.scala b/src/library/scala/Product12.scala index d7e1e1b05c..2221170452 100644 --- a/src/library/scala/Product12.scala +++ b/src/library/scala/Product12.scala @@ -24,7 +24,7 @@ trait Product12[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12] e override def productArity = 12 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product13.scala b/src/library/scala/Product13.scala index 8571b45a40..e76f326766 100644 --- a/src/library/scala/Product13.scala +++ b/src/library/scala/Product13.scala @@ -24,7 +24,7 @@ trait Product13[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, + override def productArity = 13 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product14.scala b/src/library/scala/Product14.scala index a2f5140370..a076e2cc7a 100644 --- a/src/library/scala/Product14.scala +++ b/src/library/scala/Product14.scala @@ -24,7 +24,7 @@ trait Product14[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, + override def productArity = 14 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product15.scala b/src/library/scala/Product15.scala index 1c6ad0011c..4568aff1fe 100644 --- a/src/library/scala/Product15.scala +++ b/src/library/scala/Product15.scala @@ -24,7 +24,7 @@ trait Product15[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, + override def productArity = 15 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product16.scala b/src/library/scala/Product16.scala index f03b0b34a2..84dccb0ac8 100644 --- a/src/library/scala/Product16.scala +++ b/src/library/scala/Product16.scala @@ -24,7 +24,7 @@ trait Product16[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, + override def productArity = 16 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product17.scala b/src/library/scala/Product17.scala index 72df1b496a..0d50898bf4 100644 --- a/src/library/scala/Product17.scala +++ b/src/library/scala/Product17.scala @@ -24,7 +24,7 @@ trait Product17[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, + override def productArity = 17 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product18.scala b/src/library/scala/Product18.scala index 0402f90a01..9b32265d71 100644 --- a/src/library/scala/Product18.scala +++ b/src/library/scala/Product18.scala @@ -24,7 +24,7 @@ trait Product18[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, + override def productArity = 18 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product19.scala b/src/library/scala/Product19.scala index b9770db47b..fe6b95669b 100644 --- a/src/library/scala/Product19.scala +++ b/src/library/scala/Product19.scala @@ -24,7 +24,7 @@ trait Product19[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, + override def productArity = 19 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product2.scala b/src/library/scala/Product2.scala index a43a4a285c..091bcc89de 100644 --- a/src/library/scala/Product2.scala +++ b/src/library/scala/Product2.scala @@ -24,7 +24,7 @@ trait Product2[@specialized(Int, Long, Double) +T1, @specialized(Int, Long, Doub override def productArity = 2 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product20.scala b/src/library/scala/Product20.scala index 7b0df201ec..81315e3558 100644 --- a/src/library/scala/Product20.scala +++ b/src/library/scala/Product20.scala @@ -24,7 +24,7 @@ trait Product20[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, + override def productArity = 20 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product21.scala b/src/library/scala/Product21.scala index f81347aac0..b5967c06e1 100644 --- a/src/library/scala/Product21.scala +++ b/src/library/scala/Product21.scala @@ -24,7 +24,7 @@ trait Product21[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, + override def productArity = 21 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product22.scala b/src/library/scala/Product22.scala index 7a25891c6e..c7b9da5ce8 100644 --- a/src/library/scala/Product22.scala +++ b/src/library/scala/Product22.scala @@ -24,7 +24,7 @@ trait Product22[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, + override def productArity = 22 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product3.scala b/src/library/scala/Product3.scala index 9976240935..7154bf5bdf 100644 --- a/src/library/scala/Product3.scala +++ b/src/library/scala/Product3.scala @@ -24,7 +24,7 @@ trait Product3[+T1, +T2, +T3] extends Any with Product { override def productArity = 3 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product4.scala b/src/library/scala/Product4.scala index d6c1543390..046f8c7a7c 100644 --- a/src/library/scala/Product4.scala +++ b/src/library/scala/Product4.scala @@ -24,7 +24,7 @@ trait Product4[+T1, +T2, +T3, +T4] extends Any with Product { override def productArity = 4 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product5.scala b/src/library/scala/Product5.scala index 5f1b11a30d..3e952c8c55 100644 --- a/src/library/scala/Product5.scala +++ b/src/library/scala/Product5.scala @@ -24,7 +24,7 @@ trait Product5[+T1, +T2, +T3, +T4, +T5] extends Any with Product { override def productArity = 5 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product6.scala b/src/library/scala/Product6.scala index efd9408d73..010c68711a 100644 --- a/src/library/scala/Product6.scala +++ b/src/library/scala/Product6.scala @@ -24,7 +24,7 @@ trait Product6[+T1, +T2, +T3, +T4, +T5, +T6] extends Any with Product { override def productArity = 6 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product7.scala b/src/library/scala/Product7.scala index fab0a997a1..24e5a5c05a 100644 --- a/src/library/scala/Product7.scala +++ b/src/library/scala/Product7.scala @@ -24,7 +24,7 @@ trait Product7[+T1, +T2, +T3, +T4, +T5, +T6, +T7] extends Any with Product { override def productArity = 7 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product8.scala b/src/library/scala/Product8.scala index 41391f7050..4a9f65b00e 100644 --- a/src/library/scala/Product8.scala +++ b/src/library/scala/Product8.scala @@ -24,7 +24,7 @@ trait Product8[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8] extends Any with Product override def productArity = 8 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned diff --git a/src/library/scala/Product9.scala b/src/library/scala/Product9.scala index e22538e1ee..9af11f709a 100644 --- a/src/library/scala/Product9.scala +++ b/src/library/scala/Product9.scala @@ -24,7 +24,7 @@ trait Product9[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9] extends Any with Pro override def productArity = 9 - /** Returns the n-th projection of this product if 0 < n <= productArity, + /** Returns the n-th projection of this product if 0 <= n < productArity, * otherwise throws an `IndexOutOfBoundsException`. * * @param n number of the projection to be returned |