summaryrefslogtreecommitdiff
path: root/test/files/scalacheck
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #5135 from soc/topic/biased-eitherStefan Zeiger2016-07-131-3/+67
|\ | | | | Right-bias Either
| * Right-bias EitherSimon Ochsenreither2016-05-271-3/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add operations like map, flatMap which assume right-bias - Deprecate {Left,Right}Projection - Deprecate left and right in favor of swap - Add contains, toOption, toTry, toSeq and filterOrElse - toSeq returns collection.immutable.Seq instead of collection.Seq - Don't add get There are no incompatible changes. The only possibility of breakage that exists is when people have added extension methods named map, flatMap etc. to Either in the past doing something different than the methods added to Either now. One detail that moved the scales in favor of deprecating LeftProjection and RightProjection was the desire to have toSeq return scala.collection.immutable.Seq instead of scala.collection.Seq like LeftProjection and RightProjection do. Therefore keeping LeftProjection and RightProjection would introduce inconsistency. filter is called filterOrElse because filtering in a for-comprehension doesn't work if the method needs an explicit argument. contains was added as safer alternative to if (either.isRight && either.right.get == $something) ... While adding filter with an implicit zero value is possible, it's dangerous as it would require that developers add a "naked" implicit value of type A to their scope and it would close the door to a future in which the Scala standard library ships with Monoid and filter could exist with an implicit Monoid parameter.
* | Fix ParVector#padToJason Zaugg2016-06-286-42/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was throwing a UnsupportedOperationError for small operations. The parallel collections test suite sets `-minSuccessfulTests 5` in test/files/scalacheck/parallel-collections/pc.scala, which is far lower thatn the default of 100, and means that we are less likely to falsify properties. This parameter seems to have been added in #2476, assuming I'm reading it correctly. Not sure of the motiviation, perhaps just to make the slowest part of the scalacheck test suite run faster? I haven't changed the paramater now, but instead have included a one element collection in generator. I also found that when the test failed, Scalacheck would try to minimize the example, but did so assuming that the elements of the tuple of test data could be independentally shrunk. This breaks the invariant that the two collections contain equal elements, and led to spurious error reports. I have disabled shrinking in all tests tests affected by this.
* | SI-9776: Fix type of PriorityQueue.newBuilder and improve performancechrisokasaki2016-05-221-0/+102
|/ | | | | | | | | | | | | - Fix the return type of mutable.PriorityQueue.newBuilder to be Builder[A, PriorityQueue[A]] rather than PriorityQueue[A]. - Improve performance of bulk inserts from O(N log N) to O(N), primarily in the builder, ++=, and reverse. These changes indirectly benefit the many other methods that use the builder or ++=. - Improve performance of clone. - Fix SI-9757 space leak in dequeue.
* Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-181-1/+1
| | | | | | | | | | - Language imports are preceding other imports - Deleted empty file: InlineErasure - Removed some unused private[parallel] methods in scala/collection/parallel/package.scala This removes hundreds of warnings when compiling with "-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
* Merge commit '03aaf05' into merge-2.11-to-2.12-sep-22Lukas Rytz2015-09-221-1/+16
|\
| * SI-9388 Fix Range behavior around Int.MaxValueRex Kerr2015-09-191-1/+16
| | | | | | | | | | | | | | | | | | | | terminalElement (the element _after_ the last one!) was used to terminate foreach loops and sums of non-standard instances of Numeric. Unfortunately, this could result in the end wrapping around and hitting the beginning again, making the first element bad. This patch fixes the behavior by altering the loop to end after the last element is encountered. The particular flavor was chosen out of a few possibilities because it gave the best microbenchmarks on both large and small ranges. Test written. While testing, a bug was also uncovered in NumericRange, and was also fixed. In brief, the logic around sum is rather complex since division is not unique when you have overflow. Floating point has its own complexities, too. Also updated incorrect test t4658 that insisted on incorrect answers (?!) and added logic to make sure it at least stays self-consistent, and fixed the range.scala test which used the same wrong (overflow-prone) formula that the Range collection did.
* | SI-9473 Cleaner references to statically owned symbolsJason Zaugg2015-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Ever wonder why `identity("")` typechecks to `scala.this.Predef.identity("")`? It turns out that `mkAttributedRef` was importing `q"$scalaPackageClass.this.Predef._"` for all these years, rather than `q"$scalaModule.Predef._"`. This commit makes `mkAttributedRef` special case static owners by referring the the corresponding module, instead.
* | SI-7155 Remove deprecated private s.c.m.AVLTreeSimon Ochsenreither2015-09-051-112/+0
| |
* | SI-6938 Use mutable red-black tree in TreeSetRui Gonçalves2015-07-282-2/+234
| | | | | | | | | | | | | | | | The previous implementation of `mutable.TreeSet` uses a mutable reference to an immutable red-black tree as its underlying data structure. That leads to unnecessary objects being created, which can be a problem in systems with limited resources. It also has reduced performance when compared with common mutable implementations. In this commit `mutable.TreeSet` is changed so that it uses the recently created `mutable.RedBlackTree` as its underlying data structure. Specialized red-black tree methods were created for working with keys for efficiency reasons. The new implementation is source-compatible with the previous one, although its serialized representation obviously changes. Closes [SI-6938](https://issues.scala-lang.org/browse/SI-6938).
* | Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2015-07-133-5/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20150713 Conflicts: src/eclipse/partest/.classpath src/eclipse/repl/.classpath test/files/run/nothingTypeNoFramesNoDce.scala test/files/run/repl-javap-app.check Also fixup two .classpath files with updated partest, xml and parser combinators JARs.
| * Fix 25 typos (s)Janek Bogucki2015-07-062-4/+4
| |
| * Fix 27 typos (p-r)Janek Bogucki2015-06-301-1/+1
| |
* | Fix size update on `mutable.TreeMap#clear()`Rui Gonçalves2015-06-261-2/+2
| | | | | | | | | | | | The previous implementation has a major bug - although `clear()` sets the root node to `null`, the `size` attribute of the `Tree` was not updated. This effectively meant that even after a `map.clear()`, a call to `map.size` would still yield the old size of the map. The scalacheck test suite was updated to contemplate this issue.
* | Merge pull request #4504 from ruippeixotog/mutable-treemapAdriaan Moors2015-06-251-0/+329
|\ \ | | | | | | SI-4147 Add an implementation of `mutable.TreeMap`
| * | SI-4147 Add an implementation of `mutable.TreeMap`Rui Gonçalves2015-05-301-0/+329
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains an implementation of a mutable red-black tree with focus on performance. It also contains a new `mutable.TreeMap` Scala collection that is backed by the aforementioned tree. The common generic factories and traits related to mutable sorted maps didn't exist yet, so this commit also adds them. Regarding performance, `TreeMap` overrides (from `MapLike` and `SortedMapLike`) all of the most common methods for maps and also those whose default implementations are asymptotically worse than direct red-black tree algorithms (e.g. `last`, `clear`). The `rangeImpl` method of `TreeMap` returns an instance of `TreeMapView`, an inner class of `TreeMap`. This view is backed by the same `RedBlackTree.Tree` instance, and therefore changes to the original map are reflected in the view and vice-versa. The semantics of mutating a view by adding and removing keys outside the view's range are the same of the current `mutable.TreeSet`. A bit less focus was given on the performance of views - in particular, getting the `size` of a `TreeMapView` is O(n) on the number of elements inside the view bounds. That can be improved in the future. In a future commit, `mutable.TreeSet` can be changed to be backed by this red-black tree implementation.
* | | Merge branch '2.11.x' into merge/2.11.x-to-2.12.x-20150624Jason Zaugg2015-06-241-1/+1
|\ \ \ | |/ / |/| / | |/
| * Fix 25 typos (g-i)Janek Bogucki2015-06-221-1/+1
| |
| * [backport] Update versions.properitesLukas Rytz2015-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | The tagged revisions of the modules integrate the latest release of the sbt-scala-modules sbt plugin. This enables building with a new scala binary version (e.g. 2.12.0-M1) without failinig MiMa. Also updates the other external dependencies. Backport of 8da073cd6bfaaaf3789fc8b70a61ebb66a2f0ded
* | Update versions.properitesLukas Rytz2015-04-301-1/+1
| | | | | | | | | | | | | | | | The tagged revisions of the modules integrate the latest release of the sbt-scala-modules sbt plugin. This enables building with a new scala binary version (e.g. 2.12.0-M1) without failinig MiMa. Also updates the other external dependencies.
* | Merge commit 'fcc20fe' into merge/2.11-to-2.12-apr-1Lukas Rytz2015-04-011-0/+19
|\|
| * Fix SI-7943 -- make `TrieMap.getOrElseUpdate` atomic.Aleksandar Prokopec2015-02-181-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | Override `getOrElseUpdate` method in `TrieMap`. The signature and contract of this method corresponds closely to the `computeIfAbsent` from `java.util.concurrent.ConcurrentMap`. Eventually, `computeIfAbsent` should be added to `scala.collection.concurrent.Map`. Add tests. Review by @Ichoran
* | Fix SI-9147 Override `getOrElseUpdate` in `concurrent.Map`.Aleksandar Prokopec2015-02-121-0/+76
|/ | | | Also, add a ScalaCheck test.
* SI-9087 Fix min/max of reversed Double/Float orderingsJason Zaugg2015-01-201-8/+8
| | | | | | | | | | | | As diagnosed by the reporter, we needed additional overrides due to the way these orderings are implemented. I've added tests to show other methods and other orderings are working correctly. After writing that, I found a scalacheck test related to NaN handling that also covers `Ordering`. I had to correct the assertion in the tests of `reverse.{min,max}`.
* Fix many typos in docs and commentsmpociecha2014-12-141-1/+1
| | | | | | | | | | | | | This commit corrects many typos found in scaladocs, comments and documentation. It should reduce a bit number of PRs which fix one typo. There are no changes in the 'real' code except one corrected name of a JUnit test method and some error messages in exceptions. In the case of typos in other method or field names etc., I just skipped them. Obviously this commit doesn't fix all existing typos. I just generated in IntelliJ the list of potential typos and looked through it quickly.
* Merge pull request #3858 from densh/si/8703Jason Zaugg2014-07-151-0/+7
|\ | | | | SI-8703 add support for blocks with just a single expression to quasiquotes
| * SI-8703 add support for blocks with just a single expression to quasiquotesDenys Shabalin2014-07-021-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously it was impossible to match a block that was constructed as Block(Nil, term) Due to the fact that quasiquotes always flatten those into just term. This is a correct behaviour for construction (for sake of consistency with parser) but doing it in deconstruction mode make it impossible to match such blocks which could have been constructed manually somewhere. To fix this we just disable block flattening in deconstruction mode. Interestingly enough this doesn't break existing code due to the fact that quasiquote's block matcher also matches expressions as single-element blocks. This allows to match single-element blocks with patterns like q"{ $foo }".
* | SI-8609 Fix flattening of definitions and imports in quasiquotesDenys Shabalin2014-05-211-0/+12
|/ | | | | | | | | | | | | | | | | | | | Quasiquotes allow to unquote trees with ..$ with block flattening semantics to simplify composition: val onetwo = q"1; 2" val onetwothree = q"..$onetwo; 3" // same as q"1; 2; 3" If there is no block it will be equivalent to $ unquoting: val one = q"1" val onetwo = q"..$one; 2" // same as q"1; 2" But the inconsistency here is that currently only terms support this single-element semantics. This commit extends this functionality to also support definitions and imports. So that following code works: val q1 = q"val x = 1" val q2 = q"..$q1; val y = 2" // same as q"val x = 1; val y = 2"
* Re-enable typechecked types part of quasiquote test suiteDenys Shabalin2014-04-201-5/+4
| | | | It was accidentally disabled.
* SI-8466 fix quasiquote crash on recursively iterable unliftingDenys Shabalin2014-04-022-0/+15
| | | | | | | | | | | | | In order to handle unquoting quasiquotes needs to know if type is iterable and whats the depth of the iterable nesting which is called rank. (e.g. List[List[Tree]] is rank 2 iterable of Tree) The logic that checks depth of iterable nesting didn't take a situation where T is in fact Iterable[T] which caused infinite recursion in stripIterable function. In order to fix it stripIterable now always recurs no more than non-optional limit times.
* Merge pull request #3657 from xeno-by/ticket/8388Jason Zaugg2014-03-281-20/+76
|\ | | | | SI-8388 consistently match type trees by originals
| * SI-8388 consistently match type trees by originalsDenys Shabalin2014-03-251-20/+76
| | | | | | | | | | | | | | | | | | | | | | | | Due to the fact that all TypTrees are transformed into TypeTrees during typechecking one couldn't treat typed type trees in the same way as they treat untyped type trees. This change implements support for pattern matching of TypeTrees as their corresponding TypTree equivalent using tree preserved in the original. The implementation itself is a trivial wrapping of regular TypTree extractors into MaybeTypeTreeOriginal.
* | Merge pull request #3656 from densh/si/8387-8350Jason Zaugg2014-03-271-0/+24
|\ \ | | | | | | SI-8350 SI-8387 tweak handling of new trees
| * | SI-8387 don't match new as a function applicationDenys Shabalin2014-03-251-0/+7
| | |
| * | SI-8350 treat single parens equivalently to no-parens in newDenys Shabalin2014-03-251-0/+17
| | | | | | | | | | | | | | | q"new C" and q"new C()" have identical trees after parsing. This commit adds knowledge of this invariant to SyntacticNew.
* | | SI-8451 quasiquotes now handle quirks of secondary constructorsEugene Burmako2014-03-273-0/+28
| |/ |/| | | | | | | | | Apparently even though the rhs of a secondary constructor looks like an expr, it always gets wrapped in a block by the parser. This works just fine with the typer, but crashes in uncurry. This commit brings quasiquotes in line with the parser.
* | Merge pull request #3647 from densh/si/8411Jason Zaugg2014-03-251-0/+5
|\ \ | | | | | | SI-8411 match desugared partial functions
| * | SI-8411 match desugared partial functionsDenys Shabalin2014-03-221-0/+5
| |/
* | Merge pull request #3653 from densh/si/8200Jason Zaugg2014-03-252-5/+13
|\ \ | | | | | | SI-8200 provide an identity liftable for trees
| * | SI-8200 provide an identity liftable for treesDenys Shabalin2014-03-242-5/+13
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This liftable hasn't been originally included in the set of standard liftables due to following contradiction: 1. On one hand we can have identity lifting that seems to be quite consistent with regular unquoting: q"..${List(1,2)}" <==> q"1; 2" q"${List(1,2)}" <==> q"s.c.i.List(1, 2)" q"..${List(q"a", q"b")}” <==> q"a; b" q"${List(q"a", q"b")}" <==> q"s.c.i.List(a, b)" This is also consistent with how lisp unquoting works although they get lifting for free thanks to homoiconicity: // scala scala> val x = List(q"a", q"b); q"f($x)" q"f(s.c.i.List(a, b))" // scheme > (let [(x (list a b))] `(f ,x)) '(f (list a b)) 2. On the other hand lifting is an operation that converts a value into a code that when evaluated turns into the same value. In this sense Liftable[Tree] means reification of a tree into a tree that represents it, i.e.: q"${List(q"a", q"b")}" <==> q"""s.c.i.List(Ident(TermName("a")), Ident(TermName("b")))""" But I belive that such lifting will be very confusing for everyone other than a few very advanced users. This commit introduces the first option as a default Liftable for trees.
* / SI-8420 don't crash on unquoting of non-liftable native typeDenys Shabalin2014-03-171-0/+21
|/ | | | | | Previously quasiquote's type-based dispatch failed to handle situation where unquotee's type is native but non-liftable and was used to splice with non-zero cardinality.
* Add more tests for partial functionsDenys Shabalin2014-03-102-0/+10
|
* SI-8366 make partial function and match trees disjointDenys Shabalin2014-03-102-6/+14
| | | | | | | | | | | | | | | | Previously one could match a partial function with match quasiquote: scala> val q"$scrutinee match { case ..$cases }" = q"{ case Foo => Bar }" scrutinee: universe.Tree = <empty> cases: List[universe.CaseDef] = List(case Foo => Bar) This was quite annoying as it leaked encoding of partial functions as Match trees with empty tree in place of scrutinee. This commit make sure that matches and partial functions are disjoint and don't match one another (while preserving original encoding under the hood out of sight of the end user.)
* Merge pull request #3611 from densh/si/8385Adriaan Moors2014-03-101-0/+8
|\ | | | | SI-8385 make sure $quasiquote$tuple gets reified properly
| * SI-8385 make sure $quasiquote$tuple gets reified properlyDenys Shabalin2014-03-091-0/+8
| | | | | | | | | | | | Previously due to greediness of SyntacticApplied there was a chance that quasiquote tuple placeholder got reified as its representation rather than its meaning.
* | SI-8331 make sure type select & applied type doesn't match termsDenys Shabalin2014-03-092-0/+24
|/ | | | | | Due to tree re-use it used to be the fact that type quasiquotes could match term trees. This commit makes sure selections and applied type and type applied are all non-overlapping between q and tq.
* Merge pull request #3592 from densh/si/8281Eugene Burmako2014-03-031-0/+12
|\ | | | | SI-8281 check for unbound placeholder parameters in quasiquote parser
| * SI-8281 check for unbound placeholder parameters in quasiquote parserDenys Shabalin2014-02-281-0/+12
| |
* | SI-8332 implicit class param unquoting in quasiquotesDenys Shabalin2014-03-022-2/+17
| | | | | | | | | | | | A new api that simplifies handling of implicit parameters has been mistakingly supporting just methods parameters. This commit adds support for class parameters too.
* | Merge pull request #3596 from densh/si/8333Eugene Burmako2014-03-011-1/+5
|\ \ | | | | | | SI-8333 can't use modifiers if class is in a block