summaryrefslogtreecommitdiff
path: root/src/library/scala/Tuple2.scala
Commit message (Collapse)AuthorAgeFilesLines
* SI-7301 Make tuple classes finalStefan Zeiger2016-07-071-2/+1
| | | | | This includes undoing the special case for `-Xfuture` introduced in https://github.com/scala/scala/pull/2299 and updating tests to take the new errors into account.
* SI-7294 Deprecate inheritance from TupleN.Jason Zaugg2013-03-241-0/+1
| | | | | | | | The motivation is to provide static warnings in cases like: scala> (1, 2) match { case Seq() => 0; case _ => 1 } res9: Int = 1
* Updated copyright to 2013Carlo Dapor2013-01-021-1/+1
|
* Removes AnyRef specialization from libraryVlad Ureche2012-08-071-1/+1
| | | | | | | | | | As discussed in #999, #1025 and https://groups.google.com/forum/?hl=en&fromgroups#!topic/scala-internals/5P5TS9ZWe_w instrumented.jar is generated from the current source, there's no need for a bootstrap commit. Review by @paulp.
* Optimization of Predef implicits.Paul Phillips2012-04-301-105/+0
| | | | | | | All those wildcards in a default-scoped implicit are expensive, they each lead to a typevar on every search. Restructured the Tuple2/Tuple3 Zipped classes, they're better this way anyway. This also gets all that Tuple[23] code out of genprod.
* @unspecialized annotation.Paul Phillips2012-04-281-11/+2
| | | | | | | | | Suppresses specialization on a per-method basis. I would have preferred to call it @nospecialize, but seeing as the positive form of the annotation is @specialized, that would have sown unnecessary grammatical confusion. @nospecialized sounds a bit too caveman for my tastes. "Grog no specialized! Grog generic!"
* Revert "Moved ancillary methods off specialized traits."Paul Phillips2012-04-271-0/+114
| | | | | | This reverts commit 1d0372f84f9a7325a47beb55169cc454895ef74b. I forgot about polymorphic dispatch. Have to seek another way.
* Moved ancillary methods off specialized traits.Paul Phillips2012-04-241-114/+0
| | | | | | | Moved compose/andThen off Function1, curried/tupled off Function2. Pushed Tuple2 zipped into auxiliary class. Created implicits to plaster over the changes. This drops several hundred classfiles and takes (unoptimized) scala-library.jar from 7.8 Mb to 7.4 Mb.
* Scaladoc feature that shows implicit conversionsVlad Ureche2012-04-131-1/+11
| | | | | | | See https://github.com/VladUreche/scala/tree/feature/doc-implicits for the history. See https://scala-webapps.epfl.ch/jenkins/view/scaladoc/job/scaladoc-implicits-nightly/ for nightlies. Many thanks fly out to Adriaan for his help with implicit search!
* Merge remote-tracking branch 'odersky/topic/inline' into merge-inlinePaul Phillips2012-03-141-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: lib/scala-compiler.jar.desired.sha1 lib/scala-library-src.jar.desired.sha1 lib/scala-library.jar.desired.sha1 src/compiler/scala/reflect/internal/Definitions.scala src/compiler/scala/reflect/internal/Symbols.scala src/compiler/scala/tools/nsc/Global.scala src/compiler/scala/tools/nsc/transform/Constructors.scala src/compiler/scala/tools/nsc/transform/Erasure.scala src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala src/library/scala/Function0.scala src/library/scala/Function1.scala src/library/scala/Function10.scala src/library/scala/Function11.scala src/library/scala/Function12.scala src/library/scala/Function13.scala src/library/scala/Function14.scala src/library/scala/Function15.scala src/library/scala/Function16.scala src/library/scala/Function17.scala src/library/scala/Function18.scala src/library/scala/Function19.scala src/library/scala/Function2.scala src/library/scala/Function20.scala src/library/scala/Function21.scala src/library/scala/Function22.scala src/library/scala/Function3.scala src/library/scala/Function4.scala src/library/scala/Function5.scala src/library/scala/Function6.scala src/library/scala/Function7.scala src/library/scala/Function8.scala src/library/scala/Function9.scala test/files/codelib/code.jar.desired.sha1 test/files/neg/anyval-children-2.check test/files/run/programmatic-main.check
| * Fixes to value classes: Flags now double definitions, private constructors ↵Martin Odersky2012-03-061-1/+1
| | | | | | | | as errors. Fixed erasure scheme.
* | Whitespace commit.Paul Phillips2012-02-291-1/+1
| | | | | | | | | | | | | | Removed all the trailing whitespace to make eugene happier. Will try to keep it that way by protecting at the merge level. Left the tabs in place because they can't be uniformly changed to spaces, some are 2, some are 4, some are 8, whee.
* | Specialize Tuple2 on more types.Paul Phillips2012-02-191-1/+1
| | | | | | | | This one is a no-brainer now.
* | Specialization action.Paul Phillips2012-02-141-1/+1
|/ | | | | | | | | | | | | | | | | | | | | The crickets at http://www.scala-lang.org/node/11901 were in unanimous agreement that I should proceed as suggested. - No arguments to @specialize gets you 10/10, not 9/10 - Fixed bugs in AnyRef specialization revealed by trying to use it - Specialized Function1 on AnyRef. - Changed AnyRef specialization to use OBJECT_TAG, not TVAR_TAG. - Deprecated SpecializableCompanion in favor of Specializable, which has the virtue of being public so it can be referenced from outside the library. - Cooked up mechanism to group specializable types so we don't have to repeat ourselves quite so much, and create a few groups for illustrative purposes. I'm not too serious about those names but I used up all my name-thinking-up brain for the day. - Updated genprod and friends since I had to regenerate Function1. - Put tests for a bunch of remaining specialization bugs in pending. Closes SI-4740, SI-4770, SI-5267.
* Various addenda to soc's patch: regenerating Pr...Paul Phillips2011-04-141-1/+1
| | | | | | | Various addenda to soc's patch: regenerating Product/Tuple/Function classes and AnyVal sources, making versioning consistent, etc. Closes #4477, no review.
* Addressing most of the warnings revealed by the...Paul Phillips2011-03-301-1/+1
| | | | | | Addressing most of the warnings revealed by the patch to warn about unknown scaladoc variables. Updated and reran genprod. No review.
* Moved unlift to the Function companion object, ...Paul Phillips2011-02-201-8/+20
| | | | | | | | | | | | | | Moved unlift to the Function companion object, which might have been better in the first place. Had to make a minor change to genprod, and then I couldn't escape that unscathed. Finished the not very complete undertaking I found there to update the scaladoc. Lots of little changes to the generated text and code. I changed genprod to only put a unique stamp on Function0 so we can stop having a 100 file diff everytime an i is dotted somewhere. Closes #3825, no review.
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* The initial implementation of TraversableOnce c...Paul Phillips2010-11-291-1/+1
| | | | | | | | | | | | | | | | | | The initial implementation of TraversableOnce could not supply concrete methods or even signatures for map and flatMap because they have different signatures in Iterator and TraversableLike. But we can take another approach which works out as nicely: 1) Create implicits which install those methods and flatten on TraversableOnce instances. 2) Generalize the signatures of flatten and flatMap to work with A => TraversableOnce[B] instead of A => Traversable[B]. And voila, you can mix and match Iterators and Traversables in a for comprehension, map, flatMap, and flatten, without the tedious process of sprinkling .iterator or .toList around to appease the compiler. No review.
* Some issues with Tuple2/3.Paul Phillips2010-10-271-14/+3
| | | | | | | | | foreach method in Tuple3, and both classes have what is now a redundant zip method which is also unfortunately completely strict in a not entirely fixable fashion. So "zip" is deprecated in favor of zipped. Closes #3526, but the code which closes that is primarily found in r23228. No review.
* Documentation being generated by genprod was pr...Paul Phillips2010-10-161-2/+1
| | | | | | | Documentation being generated by genprod was pretty busted both in terms of formatting and correctness. Spruced it up. Eliminated some of the more distracting HTML entities in compiler source. No review.
* An overhaul of the collection-oriented methods ...Paul Phillips2010-10-111-41/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An overhaul of the collection-oriented methods in Tuple2/Tuple3 (which still need to be taken all the way to Tuple5.) * Zip semantics: zip and zipped now properly terminate when any collection runs out of elements, even if others are infinite. In addition, short circuiting methods (exists and forall) will terminate if the condition is met, even in the presence of infinity. Example: scala> val ys = Stream from 1 ys: scala.collection.immutable.Stream[Int] = Stream(1, ?) scala> (ys, ys).zipped forall ((x, y) => x+y < 100) res0: Boolean = false scala> (ys, ys).zipped exists ((x, y) => x+y > 100) res1: Boolean = true * There are implicits converting Zipped2/3 to Traversable to expose all the methods which aren't defined in an arity-specific way in the tuple classes. I have mixed feelings about putting these in Predef; but if there is another way to make them visible by default I wasn't able to find it. Example putting said implicit to use: scala> (ys, ys, ys).zipped find { case (x, y, z) => x+y+z > 1000 } res0: Option[(Int, Int, Int)] = Some((334,334,334)) Already reviewed by moors, so no review.
* Proposed implementation of 'unlift' on Function...Paul Phillips2010-09-091-2/+3
| | | | | | | Proposed implementation of 'unlift' on Function1, the inverse function of PartialFunction#lift. Review by rytz and other interested parties. References #3825, but not closing until this is further considered.
* Removed more than 3400 svn '$Id' keywords and r...Antonio Cunei2010-05-121-1/+0
| | | | | Removed more than 3400 svn '$Id' keywords and related junk.
* Added sizeHints to operations where it made sense.Martin Odersky2010-05-101-2/+2
|
* Regenerated FunctionN, AbstractFunctionN, etc.Iulian Dragos2010-04-291-1/+1
| | | | | | | to properly specialize on primitive types (scala.Int, instead of scala.runtime.Int). Now closures should be indeed specialized. No review.
* Regenerated tuples, products and (Abstract)Func...Iulian Dragos2010-04-121-3/+5
| | | | | | | | Regenerated tuples, products and (Abstract)Functions. We needed to have separate files for AbstractFunctionN because the compiler may need their symbol even before their sourcefile is parsed. In such cases it relies on finding a source file with the right name.
* Changed the syntax of the specialized annotation:Iulian Dragos2010-04-091-1/+2
| | | | | | | | | instead of a flaky string, it now takes a repeated parameter list of primitive types: @specialized("Int, Double") becomes @specialized(Int, Double). No review.
* see #2634: updated docs to indicate zipped is s...Adriaan Moors2010-02-261-0/+5
| | | | | see #2634: updated docs to indicate zipped is strict
* Adjectified some parts of speech as discussed o...Paul Phillips2010-01-181-7/+5
| | | | | | | Adjectified some parts of speech as discussed on the mailing list. The methods to call on FunctionN are "curried" and "tupled" with "curry" deprecated and "tuple" gone. Closes #2907. Review by community.
* Updated copyright notices to 2010Antonio Cunei2009-12-071-1/+1
|
* quick fix for #2673: relaxed zipped on Tuple2/T...Adriaan Moors2009-11-251-11/+9
| | | | | | quick fix for #2673: relaxed zipped on Tuple2/Tuple3 (back to using A => B for constraint instead of A <%< B)
* Eliminated warning about Tuple2 and Tuple3 impo...Paul Phillips2009-11-201-1/+1
| | | | | Eliminated warning about Tuple2 and Tuple3 importing Traversable.
* Zipped for Tuple2&Tuple3Adriaan Moors2009-11-101-2/+17
|
* fixed bug in implicit resolution that only mani...Adriaan Moors2009-11-091-43/+67
| | | | | | | | | | | | | fixed bug in implicit resolution that only manifested itself when multiple implicit arguments needed to be resolved and they were intended to instantiate type parameters two problems: - type parameters that could not be inferred where removed from undetparams erroneously - the successfully inferred parameters were not propagated to the the implicit arguments on the right (implicit resolution searches for implicit arguments from left to right, fixing type parameters in the process) this should give the green light for the addition of Zipped to TupleN
* fix cyclic reference errors in scaladoc.Lukas Rytz2009-11-041-1/+0
|
* the essence of tcpoly inference + test casesAdriaan Moors2009-10-221-74/+54
| | | | | | fixes to check files and removed nonapplicable test case Tuple2 impl, but commented out so that we can bootstrap whitespace...
* (1) some changes to interactive compiler interf...Martin Odersky2009-06-181-4/+16
| | | | | | (1) some changes to interactive compiler interface. 2) added (symbol.hasTypeAt 3) Added flatten/transpose/unzip to TraversableClass
* Newly generated Tuple/Product/Function classes ...Paul Phillips2009-06-171-11/+6
| | | | | | Newly generated Tuple/Product/Function classes from new genprod, plus a couple minor tweaks to genprod to keep tests happy.
* In "Iterable" and in all its subclasses, "itera...Gilles Dubochet2009-05-271-12/+12
| | | | | | In "Iterable" and in all its subclasses, "iterator" replaces "elements" (and assorted changes).
* separated mutable and immutable mapsMartin Odersky2009-05-121-1/+1
|
* massive new collections checkin.Martin Odersky2009-05-081-1/+68
|
* Updated copyright notices to 2009Antonio Cunei2009-01-091-1/+1
|
* Modified the implementation of curry so that forGeoffrey Washburn2008-04-231-1/+1
| | | | | | | | | FunctionN, where N > 4, many fewer classes are created statically at the expense of creating more objects dynamically (which seems reasonable given how common such functions are likely to be). This also allows for curry in FunctionN for N > 8 without running into the filename length restriction.
* Really fixed curry this time.Geoffrey Washburn2008-04-221-1/+1
|
* No curry for you! (If you are FunctionN, for N ...Geoffrey Washburn2008-04-221-1/+1
| | | | | No curry for you! (If you are FunctionN, for N < 2 and N > 16)
* Corrected uncurry to be called curry.Geoffrey Washburn2008-04-221-1/+1
| | | | | Generalized curry to FunctionN for N >= 2
* Improvements to genprodGeoffrey Washburn2008-04-161-2/+8
| | | | | Added uncurry to Function2, swap to Tuple2.
* switched to Scala implementation of StringBuildermichelou2008-02-061-3/+3
|
* updated element/arity to productElement/product...michelou2007-04-191-2/+2
| | | | | updated element/arity to productElement/productArity