summaryrefslogtreecommitdiff
path: root/test/junit
Commit message (Collapse)AuthorAgeFilesLines
* Remove deprecationWarning, currentReporting from ReportingAdriaan Moors2014-07-041-0/+7
| | | | | | | | This moves us a bit closer to the goal of having a single entry point to reporting. Must modularize Reporting a bit so it can be used in Variances (need a reference to `currentRun` in `reflect.internal.Reporting`).
* Uniformly route reporting through reporter.Adriaan Moors2014-07-041-0/+5
| | | | | | | | | | | | Sharpen interfaces, reduce footprint of Reporting trait. Ideally, all reporting should indirect through reporter, and the `Reporting` trait itself should be restricted to a single method that retrieves the current `reporter`. Pull up some more reporting to reflect.internal. Would like to do more, but need to move partest to the reflect.internal interface first. (Its `errorCount` relies on `ERROR.count` in `tools.nsc.Reporter`.)
* Merge pull request #3736 from VladimirNik/print-types-issue-2.11.xAdriaan Moors2014-07-031-26/+51
|\ | | | | SI-8447 fix TypeTree printing (2.11.x)
| * TypeTree printing modified (SI-8447)VladimirNik2014-05-091-26/+51
| |
* | SI-8611 Avoid accidental patmat unification with refinement typesJason Zaugg2014-06-101-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the enclosed test, t8611a.scala, the patterns `O.{A, B}` were incorrect treated as equivelent by the combination of `uniqueTpForTree` and `Const.uniqueTpForTree`. `uniqueTpForTree` used `Type#narrow` to try to create a distinct type for each new pattern tree it encountered. However, narrowing a `RefinedType` does not create a distinct type as we are used to when narrowing, e.g. a class type. // Type def narrow: Type = if (phase.erasedTypes) this else { val cowner = commonOwner(this) refinedType(this :: Nil, cowner, EmptyScope, cowner.pos).narrow } // CompoundType override def narrow: Type = typeSymbol.thisType This commit creates a fresh existential type symbol rather than trying to use `narrow`. I've included a unit test to show the sublteties of narrowing refinment types.
* | Merge pull request #3743 from ruippeixotog/issue/8553Ichoran2014-06-041-0/+16
|\ \ | | | | | | SI-8553 WrappedArray throws exception on lastIndexWhere when index out of range
| * | SI-8553 WrappedArray throws exception on lastIndexWhere when index out of rangeRui Gonçalves2014-05-121-0/+16
| |/ | | | | | | | | | | | | | | | | Adds a check in `IndexedSeqOptimized#lastIndexWhere(A => Boolean, Int)` to begin searching in the end of the collection if `end` is greater than the collection's length. Discussed in https://groups.google.com/d/topic/scala-internals/-MacXivbY0Q/discussion.
* | Merge pull request #3796 from som-snytt/issue/8630Adriaan Moors2014-06-031-0/+5
|\ \ | | | | | | SI-8630 lineToString no longer long by one at eof
| * | SI-8630 lineToString no longer long by one at eofSom Snytt2014-05-271-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One more EOL crasher, or lack-of-EOL crasher, when the text is at EOF. It was not caught by the last round of excellent and thorough tests because ``` // If non-whitespace tokens run all the way up to EOF, // positions go wrong because the correct end of the last // token cannot be used as an index into the char array. // The least painful way to address this was to add a // newline to the array. ```
* | | Merge pull request #3795 from som-snytt/issue/8475Adriaan Moors2014-06-031-0/+8
|\ \ \ | | | | | | | | SI-8475 GroupedIterator is also lazy when padded
| * | | SI-8475 GroupedIterator is also lazy when paddedSom Snytt2014-05-271-0/+8
| |/ / | | | | | | | | | | | | | | | | | | | | | This is the related case which dnlgtm in the previous fix. The old code seems to be tilting for laziness, but we have to fill the buffer with the current group anyway, so there is no reason to be coy about calling ArrayBuffer.length.
* | | Merge pull request #3774 from lrytz/opt/backendWipLukas Rytz2014-06-013-6/+210
|\ \ \ | |/ / |/| | More type safe implementation of BType, cleanups in GenBCode
| * | Unit tests for reflect/internal/NamesLukas Rytz2014-06-011-0/+95
| | |
| * | Unit tests for new BType classesLukas Rytz2014-06-012-6/+115
| | |
* | | Merge pull request #3733 from retronym/topic/pr-3712-resubmitJason Zaugg2014-05-271-0/+20
|\ \ \ | | | | | | | | SI-8475 Fix off by one in GroupedIterator when Streaming
| * | | SI-8475 Fix off by one in GroupedIterator when StreamingJean-Remi Desjardins2014-05-091-0/+20
| | | | | | | | | | | | | | | | This also affected sliding and grouped since they defer to GroupedIterator
* | | | Optimize nested scope creationJason Zaugg2014-05-261-0/+54
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can copy the hash table from the parent scope, rather than constructing it from scratch. This takes us to: % rm -rf /tmp/pkg; (for i in {1..50}; do for j in {1..100}; do echo "package pkg { class A_${i}_${j}___(val a: Int, val b: Int) }"; done; done) > sandbox/A1.scala && time qbin/scalac -Ybackend:GenASM -J-Xmx1G -J-XX:MaxPermSize=400M -d /tmp sandbox/A1.scala; real 0m19.639s // head~1 was 0m35.662s user 0m41.683s // head~1 was 0m58.275s sys 0m1.886s In more detail, this commit: - Removes the unused `fingerprint` constructor parameter from scopes. This is a remnant from a previous optimization attempt - Leave only one constructor on Scope which creates an empty scope - Update the factory method, `newNestedScope`, to copy the hash table from the parent if it exists. We can rely on the invariant that `outer.hashTable != null || outer.size < MIN_HASH)`, so we don't need `if (size >= MIN_HASH) createHash()` anymore. This used to be needed in `Scope#<init>`, which accepted an aribitrary `initElems: ScopeEntry`. - Update subclasses and factories of `Scope` in runtime reflection to accomodate the change. Pleasingly, we could actually remove the override for `newNestedScope`. - Unit tests the functionality I'm touching
* | | SI-8507 Avoid lazy val in StringContextSom Snytt2014-05-131-0/+51
| |/ |/| | | | | | | | | | | | | | | This mild refactor eliminates the lazy val StringBuilder and arguably makes the code easier to read. There is a small unit test but no benchmark to prove anything useful about performance. The ticket notes contention due to lazy implementation.
* | SI-8504 fix NPE in the Java wrapper for a Scala Map.Antoine Gourlay2014-04-291-0/+10
|/ | | | MapWrapper blindly calls .hashCode on keys that can very well be null.
* Printers tests uncommentedVladimirNik2014-03-132-1171/+1163
|
* SI-8386 fixedVladimirNik2014-03-111-268/+612
|
* Merge pull request #3566 from adriaanm/t6455Grzegorz Kossakowski2014-02-251-0/+35
|\ | | | | SI-6455 no longer rewrite .withFilter to .filter
| * SI-6455 util.Try supports withFilterAdriaan Moors2014-02-241-0/+35
| |
* | PrintersTest commentedVladimirNik2014-02-201-1151/+809
| |
* | printOwners support added to Printers; whitespaces removedVladimirNik2014-02-201-155/+155
| |
* | lazy vals printing fixed for typechecked treesVladimirNik2014-02-201-1/+24
| |
* | printers flag processing improvements: printRootPkg flag fixed, comments to ↵VladimirNik2014-02-201-2/+7
| | | | | | | | flags metadata printing added
* | Attributed val/var processing for syntactics (SI-8180)VladimirNik2014-02-201-820/+1134
|/ | | | | | TypedTreesPrinter added changes based on pull request comments: print root packages flag; tests for syntactics; SyntacticEmptyTypeTree added to Printers
* Merge pull request #3452 from xeno-by/topic/palladium0Jason Zaugg2014-02-193-836/+850
|\ | | | | SI-8063 and its seventy friends
| * Merge remote-tracking branch 'origin/master' into topic/palladium0Eugene Burmako2014-02-161-0/+7
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/reflect/macros/compiler/Resolvers.scala src/compiler/scala/reflect/macros/contexts/Typers.scala src/compiler/scala/tools/reflect/ToolBoxFactory.scala src/reflect/scala/reflect/api/BuildUtils.scala
| * | establishes scala.reflect.api#internalEugene Burmako2014-02-142-836/+844
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reflection API exhibits a tension inherent to experimental things: on the one hand we want it to grow into a beautiful and robust API, but on the other hand we have to deal with immaturity of underlying mechanisms by providing not very pretty solutions to enable important use cases. In Scala 2.10, which was our first stab at reflection API, we didn't have a systematic approach to dealing with this tension, sometimes exposing too much of internals (e.g. Symbol.deSkolemize) and sometimes exposing too little (e.g. there's still no facility to change owners, to do typing transformations, etc). This resulted in certain confusion with some internal APIs living among public ones, scaring the newcomers, and some internal APIs only available via casting, which requires intimate knowledge of the compiler and breaks compatibility guarantees. This led to creation of the `internal` API module for the reflection API, which provides advanced APIs necessary for macros that push boundaries of the state of the art, clearly demarcating them from the more or less straightforward rest and providing compatibility guarantees on par with the rest of the reflection API. This commit does break source compatibility with reflection API in 2.10, but the next commit is going to introduce a strategy of dealing with that.
| * | Merge remote-tracking branch 'origin/master' into topic/palladium0Eugene Burmako2014-02-141-1/+18
| |\ \
| * | | additional class tags for reflection APIEugene Burmako2014-02-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces a test that iterates all abstract types in reflection API and makes sure that every one of them has an associated class tag. After being introduced, the test has immediately failed exposing the lack of tags for TreeCopier, Mirror and RuntimeClass, which has been subsequently fixed in this commit.
* | | | Group settings should honor user-set individual optionsJason Zaugg2014-02-171-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the last commit, we added the ability to explicitly disable boolean settings form the command line. This commit changes group settings (like -optimize), to leave them alone if set explicitly. Examples: `scalac -Xlint -Ywarn-unused:false -optimize -Yinline:false` The mechanism for such settings has also been refactored to `MutableSettings`, to let use reuse this for `-Xlint`.
* | | | Expose a means to disable boolean settingsJason Zaugg2014-02-171-0/+28
| |_|/ |/| | | | | | | | | | | | | | Enables `-Yboolean-setting:{true,false}`. This will be exploited in the next commit to enable one to turn off a single component of a group setting, such as `-Xlint` or `-optimize`.
* | | SI-8264 scala.collection.immutable.HashSet#- returns broken SetRex Kerr2014-02-141-0/+7
| |/ |/| | | | | | | | | Was an error in HashSet's handling of removal of an element when a HashTrieSet should turn into a HashSet1. Also slightly modified HashMap's filter0 to more closely match HashSet (by adding the same comment).
* | Merge pull request #3437 from Ichoran/issue/6736Adriaan Moors2014-02-121-1/+18
|\ \ | |/ |/| SI-6736 Range.contains is wrong
| * Reasonable Range operations consistently work when overfull.Rex Kerr2014-02-091-3/+15
| | | | | | | | | | | | Operations are reasonable when they don't require indexing or conversion into a collection. These include head, tail, init, last, drop, take, dropWhile, takeWhile, dropRight, takeRight, span. Tests added also to verify the new behavior.
| * SI-6736 Range.contains is wrongRex Kerr2014-02-091-1/+6
| | | | | | | | Removed once-used private method that was calculating ranges in error and corrected the contains method (plus improved performance).
* | Merge pull request #3409 from xeno-by/ticket/6411Jason Zaugg2014-02-101-0/+1
|\ \ | | | | | | SI-6411 SI-7328 value class fixes for runtime reflection
| * | SI-6411 reflection is now aware of posterasureEugene Burmako2014-01-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `transformedType` method, which is used to bring Scala types to Java world, was written in pre-valueclass times. Therefore, this method only called transforms from erasure, uncurry and refChecks. Now runtime reflection becomes aware of posterasure and as a consequence methods, which have value classes in their signatures, can be called without having to wrap them in catch-a-crash clause. Another facet to this fix was the realization that value classes need to be unwrapped, e.g. C(2) needs to be transformed to just 2, when they are used naked in method signatures (i.e. `c` in `def foo(c: C)` needs to be unwrapped, whereas `cs: List[C]`, `cs: C*` and even `cs: Array[C]` do not).
* | | SI-8154 AnyRefMap iterates its way to ((null, null))Rex Kerr2014-02-091-1/+20
| |/ |/| | | | | | | | | Changed logic to prevent mutation between hasNext and next from delivering invalid results. Also fixed superscripts in scaladoc.
* | SI-8213 AnyRefMap.getOrElseUpdate is faultyRex Kerr2014-01-301-0/+12
| | | | | | | | | | | | Altered getOrElseUpdate to be robust to the map changing out from under it as a result of calling the default value method. Side-effects FTW! Made a comparable change in LongMap also, as it was also affected. And added a test to SetMapConsistencyTest.
* | SI-8205 Don't include CR in lineSom Snytt2014-01-291-0/+22
| | | | | | | | | | | | | | | | | | | | | | More penance. Extend the unit test and don't include CR in the line text. This is obvious, which shows how dangerous it is to refactor without unit tests. My very favorite bugs are off-by-one and EOL handling, followed closely by off-by-Int.MaxValue.
* | SI-8205 Avoid long, slow march to AIIOBE in SourceFile#lineContentJason Zaugg2014-01-291-0/+33
|/ | | | | | | | | | | | | | | | | | Fixing a regression from SI-8015. The failure mode is kind of amusing: a while loop in `lineToString` would count all the way to `Int.MaxValue`, and integer overflow would foil a bounds check when looking for the 'LF' in 'CR'-'LF'. Given that we're not a style checker to enforce that source files end in a new-line, this commit accounts for EOF, and fixed the overflow problem too. A JUnit test exercises the bug and a few other variations of `lineContent`. While i was in the neighbourhood, I opted for a more efficient means to slice out that line.
* Problem with EOL in tests for Printers is fixedVladimirNik2014-01-171-2/+7
|
* SI-4370 Range bug: Wrong result for Long.MinValue to Long.MaxValue by ↵Rex Kerr2014-01-151-0/+123
| | | | | | | | | | | | | | Int.MaxValue Fixed by rewriting the entire logic for the count method. This is necessary because the old code was making all kinds of assumptions about what numbers were, but the interface is completely generic. Those assumptions still made have been explicitly specified. Note that you have to make some or you end up doing a binary search, which is not exactly fast. The existing routine is 10-20% slower than the old (broken) one in the worst cases. This seems close enough to me to not bother special-casing Long and BigInt, though I note that this could be done for improved performance. Note that ranges that end up in Int ranges defer to Range for count. We can't assume that one is the smallest increment, so both endpoints and the step need to be Int. A new JUnit test has been added to verify that the test works. It secretly contains an alternate BigInt implementation, but that is a lot slower (>5x) than Long.
* Merge pull request #3316 from Ichoran/topic/big-decimal-correctnessAdriaan Moors2014-01-151-0/+225
|\ | | | | Quasi-comprehensive BigDecimal soundness/correctness fix.
| * Quasi-comprehensive BigDecimal soundness/correctness fix.Rex Kerr2014-01-141-0/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes issues SI-6153, SI-6173, SI-6456, SI-6699, and SI-8116, along with a number of other similar possible issues. Relevant changes include * Changes to avoid heap explosion when working with BigInt - to isWhole - to hashCode - to equals - to BigInt's equals * Changes to enable equality matching hashCode - Only for sufficiently small BigInt - For identical values with different precision * Changes to isValidDouble - Takes precision into account now - New methods added to test whether even if the Double is not represented exactly, it's a representation of a certain type - New companion methods added to allow intended expansion of Double (binary/decimal difference) * Changes to constructor - Null arguments are not allowed (these can throw NPEs later at awkward/unexpected times) * New JUnit test to test all these things * Fixed existing tests to expect new behavior * Modified scaladocs to explain the issues * Deprecated problematic methods * Made application of MathContext more consistent (it is where you expect it and not where you don't) These changes are coordinated, for the most part, hence the monolithic commit.
* | Merge pull request #3321 from VladimirNik/sprinterJason Zaugg2014-01-151-0/+815
|\ \ | |/ |/| Add tree-based code generation