summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | | | | Ignore BoundedWildcardType in erasure type mapAdriaan Moors2017-02-191-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This case can be triggered as illustrated in the test.
* | | | | | | | | | Merge pull request #5711 from retronym/ticket/jrtLukas Rytz2017-02-201-0/+41
|\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / |/| | | | | | | | | Faster and simpler Java 9 classpath implementation
| * | | | | | | | | Faster and simpler Java 9 classpath implementationJason Zaugg2017-02-171-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Take advantage of the `/packages` index provided by the jrt file system to avoid (expensive) Files.exist for non-existent entries across the full list of modules. - Extends ClassPath directly which leads to a simpler implemnentation that using the base class. - Add a unit test that shows we can read classes and packages from the Java standard library. Fixes scala/scala-dev#306 With this change bootstrap time under Java 9 was comparable to Java 8. Before, it was about 40% slower.
* | | | | | | | | | Merge pull request #5717 from som-snytt/issue/10148-followupAdriaan Moors2017-02-191-1/+9
|\ \ \ \ \ \ \ \ \ \ | |_|/ / / / / / / / |/| | | | | | | | | SI-10148 Accept verbose zero
| * | | | | | | | | SI-10148 Accept verbose zeroSom Snytt2017-02-181-1/+9
| | |_|_|_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | The test for non-zero must recognize `-0e+00f` and variants.
* / | | | | | | | Ensure ordering for args to `choose` in DurationTestAdriaan Moors2017-02-171-1/+4
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | Fix scala/scala-dev#296
* | | | | | | | Merge branch '2.12.x' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-1724-1372/+337
|\ \ \ \ \ \ \ \ | | |_|_|_|/ / / | |/| | | | | |
| * | | | | | | Merge pull request #5697 from som-snytt/issue/10164Seth Tisue2017-02-171-3/+9
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-10164 BitSet.tail zigs where it zagged
| | * | | | | | | SI-10164 BitSet.tail zigs where it zaggedSom Snytt2017-02-141-3/+9
| | |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A cut/paste issue, an increment was held over from head, which scans forward, to tail, which scans backward.
| * | | | | | | Merge pull request #5684 from SethTisue/partest-sbt-only-plzSeth Tisue2017-02-161-152/+0
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | run partest from sbt always, command line never
| | * | | | | | | run partest from sbt always, command line neverSeth Tisue2017-02-081-152/+0
| | | |_|_|_|_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | these scripts are (I assume) unused these days and there's no reason to maintain them. and it's risky to have two different ways of running the same thing which could get out of sync with each other sbt forks a JVM to run partest, so it's not like we need these scripts in order to get a more isolated environment in that respect.
| * | | | | | | Merge pull request #5648 from som-snytt/issue/10148Seth Tisue2017-02-163-2/+30
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-10148 Follow Java for float literals
| | * | | | | | | SI-10148 Follow Java for float literalsSom Snytt2017-01-183-2/+30
| | | |_|_|/ / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use `Float.parseFloat` instead of converting from Double. Error when a value rounds to zero.
| * | | | | | | Merge pull request #5687 from retronym/ticket/10177Adriaan Moors2017-02-161-0/+54
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-10177 Override lazy operations to preserve TrieMap's semantics
| | * | | | | | | SI-10177 Override lazy operations to preserve TrieMap's semanticsJason Zaugg2017-02-101-0/+54
| | | |_|_|_|_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling .iterator on a TrieMap gives a read-only snapshot. This then extends to most inherited implementations written in terms of .iterator. However, some inherited methods, such as .values, either defer the call to .iterator or call it more than once. This results in subsequent mutations to the original map being visible I reviewed the inherited implementations from MapLike and found we needed overrides of `values`, `keySet`, `filterKeys`, and `mapValues`. Like `iterator`, these now create a read-only snapshot.
| * | | | | | | Merge pull request #5589 from allisonhb/feature/si-4700Adriaan Moors2017-02-162-0/+66
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-4700 The thrilling continuation to the infix type printing saga.
| | * | | | | | | SI-4700 Make infix notation default for symbolic types.allisonhb2016-12-142-21/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add ability to disable this via the @showAsInfix annotation.
| | * | | | | | | SI-4700 Show infix types with as few parentheses as needed.allisonhb2016-12-132-0/+20
| | | | | | | | |
| | * | | | | | | SI-4700 Add `@infix` annotation for type printingVlad Ureche2016-09-192-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` scala> import scala.annotation.infix import scala.annotation.infix scala> @infix class &&[T, U] defined class $amp$amp scala> def foo: Int && Boolean = ??? foo: Int && Boolean ```
| * | | | | | | | Merge pull request #5546 from som-snytt/issue/9636Adriaan Moors2017-02-164-1/+25
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-9636 More precise error pos on apply inference
| | * | | | | | | | SI-9636 More precise error pos on apply inferenceSom Snytt2016-12-204-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a method type arg is inferred Any, warn about the function and not the innocent arg.
| * | | | | | | | | Merge pull request #5662 from teldosas/SI-9675Adriaan Moors2017-02-163-0/+52
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | SI-9675 warn about non-sensible equals in anonymous functions
| | * | | | | | | | | Add warning about non-sensible equals in anonymous functionsteldosas2017-02-013-0/+52
| | | |_|/ / / / / / | | |/| | | | | | |
| * | | | | | | | | Merge pull request #5692 from lrytz/remove-pyAdriaan Moors2017-02-165-1214/+0
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Delete some unused scripts
| | * | | | | | | | | Delete some unused scriptsLukas Rytz2017-02-135-1214/+0
| | | |_|_|_|/ / / / | | |/| | | | | | |
| * | | | | | | | | Merge pull request #5587 from lrytz/t10072Adriaan Moors2017-02-161-0/+18
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | SI-10072 cast Function nodes to environment in specialization
| | * | | | | | | | | SI-10072 cast Function nodes to environment in specializationLukas Rytz2016-12-071-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit basically make sure the fix for SI-5284 works correctly when a Function node reaches specialization (`-Ydealmbdafy:method` and IndyLambda are default in 2.12.x). To understand it, best read the excellent description in b29c01b. The code that's removed in this commit was added in 13ea590. It prevented `castType` from being invoked on the `Function` node, which is exactly what is needed here. It's also what happens under `-Ydelambdafy:inline`, the `new anonfun()` tree is being casted from `(Int, Int) => Int` to `(Int, A) => Int`.
| * | | | | | | | | | Merge pull request #5542 from retronym/ticket/10066Adriaan Moors2017-02-163-0/+83
| |\ \ \ \ \ \ \ \ \ \ | | |_|_|_|_|_|_|_|_|/ | |/| | | | | | | | | SI-10066 Fix crash in erroneous code with implicits, dynamic
| | * | | | | | | | | SI-10066 Fix crash in erroneous code with implicits, dynamicJason Zaugg2016-11-183-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The compiler support in the typechecker for `scala.Dynamic` is very particular about the `Context` in which it is typechecked. It looks at the `tree` in the enclosing context to find the expression immediately enclosing the dynamic selection. See the logic in `dyna::mkInvoke` for the details. This commit substitutes the result of `resetAttrs` into the tree of the typer context before continuing with typechecking.
* | | | | | | | | | | Merge commit '0965028809' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-1615-4/+757
|\ \ \ \ \ \ \ \ \ \ \
| * | | | | | | | | | | fix IndexedSeqTest to work in both Ant and sbtSeth Tisue2017-02-131-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | follows up on https://github.com/scala/scala/pull/5664; fixes https://github.com/scala/scala-dev/issues/301
| * | | | | | | | | | | Add benchmark for List.mapConserveRory Graves2017-01-281-0/+15
| | | | | | | | | | | |
| * | | | | | | | | | | Optimised implementation of List.filter/filterNotRory Graves2017-01-282-4/+61
| | | | | | | | | | | |
| * | | | | | | | | | | Test IndexedSeq, including ArrayOps, WrappedArray.Mike Skells2017-01-281-0/+567
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically, the `slice` and `take` methods.
| * | | | | | | | | | | SI-1459 two bridges for impl of java generic vararg methodAdriaan Moors2017-01-244-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A Scala method that implements a generic, Java-defined varargs method, needs two bridges: - to convert the collections for the repeated parameters (VBRIDGE) - to bridge the generics gap (BRIDGE) Refchecks emits the varargs "bridges", and erasure takes care of the other gap. Because a VBRIDGE was also an ARTIFACT, it was wrongly considered inert with respect to erasure, because `OverridingPairs` by default excluded artifacts. Removed the artifact flag from those VBRIDGES, so that they qualify for a real bridge. It would also work to include VBRIDGE methods that are artifacts in BridgesCursor.
| * | | | | | | | | | | SI-9013 SI-1459 Tests for inherited @varargs annotationsJason Zaugg2017-01-248-0/+78
| | | | | | | | | | | |
| * | | | | | | | | | | Merge pull request #5630 from adriaanm/rebase-5557Adriaan Moors2017-01-1014-65/+208
| |\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | [backport] SI-10071 SI-8786 varargs methods
| | * | | | | | | | | | | [backport] SI-6412 remove flaky testSeth Tisue2017-01-091-26/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry-picking commit a03e7a0) I have repeatedly seen this fail CI runs, including recently as the comment in the test itself says: "I'm not sure this is a great way to test for memory leaks, since we're also testing how good the JVM's GC is, and this is not easily reproduced between machines/over time"
| | * | | | | | | | | | | SI-10071 Separate compilation for varargs methodsIulian Dragos2017-01-096-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure that methods annotated with varargs are properly mixed-in. This commit splits the transformation into an info transformer (that works on all symbols, whether they come from source or binary) and a tree transformer. The gist of this is that the symbol-creation part of the code was moved to the UnCurry info transformer, while tree operations remained in the tree transformer. The newly created symbol is attached to the original method so that the tree transformer can still retrieve the symbol. A few fall outs: - I removed a local map that was identical to TypeParamsVarargsAttachment - moved the said attachment to StdAttachments so it’s visible between reflect.internal and nsc.transform - a couple more comments in UnCurry to honour the boy-scout rule
| | * | | | | | | | | | | SI-8786 fix generic signature for @varargs forwarder methodsLukas Rytz2017-01-097-39/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When generating a varargs forwarder for def foo[T](a: T*) the parameter type of the forwarder needs to be Array[Object]. If we generate Array[T] in UnCurry, that would be erased to plain Object, and the method would not be a valid varargs. Unfortunately, setting the parameter type to Array[Object] lead to an invalid generic signature - the generic signature should reflect the real signature. This change adds an attachment to the parameter symbol in the varargs forwarder method and special-cases signature generation. Also cleans up the code to produce the varargs forwarder. For example, type parameter and parameter symbols in the forwarder's method type were not clones, but the same symbols from the original method were re-used. Backported from 0d2760dce189cdcb363e54868381175af4b2646f, with a small tweak (checkVarargs) to make the test work on Java 6, as well as later versions.
* | | | | | | | | | | | | Merge commit '36967321c7' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-164-35/+72
|\| | | | | | | | | | | | | |_|/ / / / / / / / / / |/| | | | | | | | | | |
| * | | | | | | | | | | Merge pull request #5632 from adriaanm/ticket/9114Adriaan Moors2017-01-101-0/+31
| |\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | SI-9114 Fix crasher in pattern matcher with type aliases
| | * | | | | | | | | | | SI-9114 Fix crasher in pattern matcher with type aliasesJason Zaugg2017-01-091-0/+31
| | |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When determining whether or not a pattern match requires an equality check of the outer instance of a type in addition to a type test, `needsOuterTest` determines if the intersection of the selector and the pattern types could be populated. Both type arrive at `isPopulated` dealised. However, `isPopulated` recurs when it encounters an existential, and, as seen in thest case, a failure to dealias the quantified type can lead to an assertion failure as we try to relate a typeref to an alias and a typeref to a class. See also SI-7214, which added deliasing of the pattern type before calling `isPopulated`.
| * / / / / / / / / / / SI-9331 Fix canEqual for case classes with HK type paramsJason Zaugg2017-01-093-35/+41
| |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Time for the courage of our convictions: follow the advice of my TODO comment from SI-8244 / f62e280825 and fix `classExistentialType` once and for all. This is the change in the generated `canEquals` method in the test case; we no longer get a kind conformance error. ``` --- sandbox/old.log 2015-05-27 14:31:27.000000000 +1000 +++ sandbox/new.log 2015-05-27 14:31:29.000000000 +1000 @@ -15,7 +15,7 @@ case _ => throw new IndexOutOfBoundsException(x$1.toString()) }; override <synthetic> def productIterator: Iterator[Any] = runtime.this.ScalaRunTime.typedProductIterator[Any](Stuff.this); - <synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[Proxy[PP]]](); + <synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[_ <: [PP]Proxy[PP]]](); override <synthetic> def hashCode(): Int = ScalaRunTime.this._hashCode(Stuff.this); override <synthetic> def toString(): String = ScalaRunTime.this._toString(Stuff.this); override <synthetic> def equals(x$1: Any): Boolean = x$1 match { @@ -38,9 +38,3 @@ } } ``` I also heeded my own advice to pass in a prefix to this method.
| * | | | | | | | | | Merge pull request #5615 from ↵Stefan Zeiger2017-01-092-0/+58
| |\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | monkey-mas/modify-ArrayBuilder-reusability-bug-2016-12-24 [Backport] Modify ArrayBuilder and WrappedArrayBuilder to be reusable
| | * | | | | | | | | | [Backport] Modify ArrayBuilder and WrappedArrayBuilder to be reusableMasaru Nomura2016-12-282-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As they're reusable in 2.12.x with this change[1], it'd be useful to make them reusable in 2.11.x. [1] https://github.com/scala/scala/commit/6eaae1b969b68ed3dc65a40613a8168b09246256 With this change, not only are they reusable but also we can avoid mutation of previously created arrays. Behaviour(Problem): Actual behaviour before this modification is as follows; <ArrayBuilder> ``` scala> import scala.collection.mutable.ArrayBuilder import scala.collection.mutable.ArrayBuilder scala> val builder = new ArrayBuilder.ofInt builder: scala.collection.mutable.ArrayBuilder.ofInt = ArrayBuilder.ofInt scala> builder ++= Vector.range(1, 17) res0: builder.type = ArrayBuilder.ofInt scala> val arr = builder.result() arr: Array[Int] = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) scala> builder.clear() scala> builder += 100 res2: builder.type = ArrayBuilder.ofInt scala> val arr2 = builder.result() arr2: Array[Int] = Array(100) scala> arr res3: Array[Int] = Array(100, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) // arr should be Array(1, .., 16) but was unexpectedly mutated by `+=` operation ``` `arr` was mutated as follows; 1. `result` & `clear` - `arr = elems` - `size = 0` 2. `+=(100)` - `ensureSize(0 + 1)` => `capacity < size || capacity == 0` is `false` as `capacity == 16` and `size == 1` - `elems(0) = 100` this is where `arr(0) = 100` was done because we did not reallocate a new array for `elems` when calling `ensureSize`, which should have happened. - `size = 1` 3. `result` - `mkArray(1)` gives us `arr2 = Array(100)` <WrappedArrayBuilder> We can observe almost the same mutation behaviour of ArrayBuilder. ``` scala> import scala.collection.mutable.WrappedArray import scala.collection.mutable.WrappedArray scala> import scala.collection.mutable.WrappedArrayBuilder import scala.collection.mutable.WrappedArrayBuilder scala> import scala.reflect.ClassTag import scala.reflect.ClassTag scala> val builder = new WrappedArrayBuilder(ClassTag.Int) builder: scala.collection.mutable.WrappedArrayBuilder[Int] = scala.collection.mutable.WrappedArrayBuilder@56cbfb61 scala> builder ++= Vector.range(1, 17) res0: builder.type = scala.collection.mutable.WrappedArrayBuilder@56cbfb61 scala> builder.result() res1: scala.collection.mutable.WrappedArray[Int] = WrappedArray(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) scala> builder.clear() scala> builder += 100 res3: builder.type = scala.collection.mutable.WrappedArrayBuilder@56cbfb61 scala> res1 res4: scala.collection.mutable.WrappedArray[Int] = WrappedArray(100, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) scala> builder.result() res5: scala.collection.mutable.WrappedArray[Int] = WrappedArray(100) ``` Solution: We should reset `capacity` to `0` when calling `result` so that `ensureSize(1)` calls `resize(16)`, which satisfies the property of Builder reusability. Besides mutation of previously created arrays does not happen.
| * | | | | | | | | | | SI-9630 Fix spurious warning related to same-named case accessors [backport]Jason Zaugg2016-12-219-0/+101
| |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hash consing of trees within pattern match analysis was broken, and considered `x1.foo#1` to be the same tree as `x1.foo#2`, even though the two `foo`-s referred to different symbols. The hash consing was based on `Tree#correspondsStructure`, but the predicate in that function cannot veto correspondance, it can only supplement the default structural comparison. I've instead created a custom tree comparison method for use in the pattern matcher that handles the tree shapes that we use. (cherry picked from commit 79a52e6807d2797dee12bab1730765441a0e222d)
* | | | | | | | | | | Merge pull request #5654 from retronym/ticket/10154Adriaan Moors2017-02-142-0/+27
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | SI-10154 Fix implicit search regression for term-owned objects
| * | | | | | | | | | | SI-10154 Fix implicit search regression for term-owned objectsJason Zaugg2017-01-202-0/+27
| | |_|_|_|/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A recent change to fix lookup of companion implicits of term-owned classes (#5550) caused a regression in the enclosed test case. The previous approach of calling `Scope#lookup(companionName)` was replaced by a lookup of the scope entry of the original name followed by a narrower search lookup for the companion name, to ensure that it was a true companion, and not just a same-named module from defined at a different nested scope. However, module class symbols are not themselves entered into scopes, so the first part of the new scheme fails. We need to add a special case modules here. I've chosen to just call `.sourceModule` on module classes. For module classes in the current run (all term owned symbols will fall into this category), this amounts to using the value of the field `ModuleClassSymbol#module`.
* | | | | | | | | | | Correct the AbstractVar error messageJon Pretty2017-02-093-5/+5
| |_|_|_|_|_|_|_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The error currently reads "only classes can have declared but undefined members", which isn't true on two counts: traits can have them, and concrete classes cannot. This corrects the error message to read "only traits and abstract classes can have declared but undefined members".