summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* 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 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)
* Use ClassTag instead of Manifest in AssertUtil.assertThrows.Sébastien Doeraene2016-12-171-5/+4
| | | | | This allows it to work in Scala.js, which supports `ClassTag`s but not `Manifest`s.
* Merge pull request #5487 from lrytz/java-constantsAdriaan Moors2016-12-1519-0/+278
|\ | | | | SI-3236 constant types for literal final static java fields
| * neg test for parsing constants in Java sourcesLukas Rytz2016-11-027-0/+104
| |
| * SI-3236 constant types for literal final static java fieldsJohannes Rudolph2016-10-2812-0/+174
| | | | | | | | | | | | | | | | | | Since we don't parse Java expressions, fields of Java classes coming from source files never have constant types. This prevents using static java fields in annotation arguments in mixed compilation This PR assigns constant types to final static java fields if the initializer is a simple literal.
* | Merge pull request #5454 from som-snytt/issue/9834-2.11Adriaan Moors2016-12-156-0/+34
|\ \ | | | | | | SI-9834 Improve error on failed op=
| * | SI-9834 Show expansion of update on errorSom Snytt2016-11-251-0/+1
| | |
| * | SI-9834 Improve error on failed op=Som Snytt2016-11-256-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If rewriting `x += y` fails to typecheck, emit error messages for both the original tree and the assignment. If rewrite is not attempted because `x` is a val, then say so. The error message at `tree.pos` is updated with the additional advice. SI-8763 Crash in update conversion When there are already errors, don't attempt mechanical rewrites.
* | | SI-10086 NumericRange.min|max with custom Integral (#5575)Tobias Schlatter2016-12-121-0/+39
| | | | | | | | | SI-10086 NumericRange.min|max with custom Integral
* | | Improve performance of REPL autocompletionJason Zaugg2016-11-221-0/+8
|/ / | | | | | | | | | | | | | | | | | | | | The code used to fuzzily match, e.g, `declasses` with `getDeclaredClasses` was exploring fruitless parts of the search space. The enclosed test case was hanging the REPL. This commit improves this by performing a prefix match of the unconsumed input against the current chunk of the candidate before exploring the `inits`. Fixes scala/scala-dev#271
* | [nomerge] SI-10037 ASR/LSR switched in ICodeReaderSom Snytt2016-11-104-0/+18
| | | | | | | | | | | | | | | | | | | | Noticed when inlining from a class file. The test doesn't work because inlining fails with bytecode unavailable due to: ``` scala.reflect.internal.MissingRequirementError: object X in compiler mirror not found. ```
* | Merge pull request #5478 from dragos/backport/remove-println-SI-8717Adriaan Moors2016-10-282-2/+0
|\ \ | |/ |/| [backport] Replace println with log calls in BrowsingLoaders
| * [backport] Replace println with log calls in BrowsingLoadersIulian Dragos2016-10-252-2/+0
| | | | | | | | | | | | | | This alternative symbol loader is used in the presentation compiler and may generate output even when the compiler should be silent. See SI-8717 for more context, even though this does not really fix the ticket.
* | Merge pull request #5378 from som-snytt/issue/9913Seth Tisue2016-10-261-0/+6
|\ \ | |/ |/| SI-9913 Lead span iterator finishes at state -1
| * SI-9913 Lead span iterator finishes at state -1Som Snytt2016-09-051-0/+6
| | | | | | | | | | Even if no elements fail the predicate (so that the trailing iterator is empty).
* | Merge pull request #5467 from som-snytt/issue/9832-2.11-cleanupSeth Tisue2016-10-191-18/+22
|\ \ | | | | | | SI-9832 Fix line endings in junit test
| * | SI-9832 Fix line endings in junit testSom Snytt2016-10-191-18/+22
| | |
* | | Merge pull request #5343 from milessabin/topic/si-2712-backportAdriaan Moors2016-10-1829-0/+466
|\ \ \ | | | | | | | | SI-2712 Add support for higher order unification
| * | | SI-2712 Add support for higher order unificationMiles Sabin2016-08-1529-0/+466
| | |/ | |/|
* | | Merge pull request #5453 from som-snytt/issue/9832-2.11Adriaan Moors2016-10-181-0/+63
|\ \ \ | | |/ | |/| SI-9832 -Xlint:help shows default
| * | SI-9832 -Xlint:help shows defaultSom Snytt2016-10-111-0/+63
| |/ | | | | | | | | | | Conclude help method with the default list. Extra words are supplied for underscore.
* | Merge pull request #5345 from milessabin/topic/si-7046-backportAdriaan Moors2016-10-1813-1/+176
|\ \ | | | | | | [nomerge] Partial fix for SI-7046
| * | Partial fix for SI-7046Miles Sabin2016-08-1513-1/+176
| |/
* | Merge pull request #5341 from milessabin/topci/si-9760-backportAdriaan Moors2016-10-181-0/+18
|\ \ | | | | | | SI-9760 Fix for higher-kinded GADT refinement
| * | SI-9760 Fix for higher-kinded GADT refinementMiles Sabin2016-08-151-0/+18
| |/
* | Merge pull request #5348 from som-snytt/issue/9841-test-2.11Adriaan Moors2016-10-181-0/+24
|\ \ | | | | | | SI-9841 Regression test for init SO
| * | SI-9841 Regression test for init SOSom Snytt2016-08-241-0/+24
| |/ | | | | | | Verifies example behavior in ticket.
* | Merge pull request #5218 from retronym/ticket/9806Jason Zaugg2016-10-181-0/+18
|\ \ | |/ |/| SI-9806 Fix incorrect codegen with optimizer, constants, try/catch
| * SI-9806 Fix incorrect codegen with optimizer, constants, try/catchJason Zaugg2016-06-071-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The constant optimizer phase performs abstract interpretation of the icode representation of the progam in order to eliminate dead code. For each basic block, the possible and impossible states of each local variable is computed for both a normal and an exceptional exit. A bug in this code incorrectly tracked state for exception exits. This appears to have been an oversight: the new state was computed at each instruction, but it was discarded rather than folded through the intepreter.
* | Merge pull request #5236 from som-snytt/issue/triple-backportLukas Rytz2016-07-131-0/+8
|\ \ | | | | | | [nomerge] Avoid triple-quoting triple quotes
| * | Avoid triple-quoting triple quotesSom Snytt2016-06-171-0/+8
| | | | | | | | | | | | | | | | | | The boolean test for triples was inadvertently flipped. Adds test for pretty printed multiline strings
* | | Use sbt for PR validationStefan Zeiger2016-06-148-7/+37
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Support directories in `-doc-external-doc`: It is documented as accepting a “classpath_entry_path” for the keys but this only worked for JARs and not for individual class files. When checking for external-doc mappings for a Symbol, we now find the root directory relative to a class file instead of using the full class file path. The corresponding tests for SI-191 and SI8557 are also fixed to support individual class files instead of JARs in partest. This is required for the sbt build which runs partest on “quick” instead of “pack”. - Fix version and repository handling for bootstrapping. The bootstrap `scalaInstance` can now be resolved from any repository added to the project (not just the bootstrap repositories) by using a different workaround for https://github.com/sbt/sbt/issues/1872. - Workaround for https://github.com/sbt/sbt/issues/2640 (putting the wrong `scalaInstance` on partest’s classpath). The required `ScalaInstance` constructor is deprecated, so we have to disable deprecation warnings and fatal warnings until there is a better fix. - Add MiMa to the sbt build (port of the old `test.bc` ant task). The sbt-mima plugin doesn’t have all the features we need, so we do it manually in a similar way to what the plugin does. Checks are done in both directions for the `library` and `compiler` projects. The base version has to be set in `build.sbt`. When set to `None`, MiMa checks are skipped. MiMa checks are run sequentially to avoid spurious errors (see https://github.com/typesafehub/migration-manager/issues/115). - Port the OSGi tests to the sbt build. The set of JARs that gets copied into build/osgi as bundles is a bit different from the ant build. We omit the source JARs but add additional modules that are part of the Scala distribution, which seems more correct. - Get rid up `pull-binary-libs.sh` for the sbt build. Add artifacts are resolved from the special bootstrap repository through Ivy. The special `code.jar` and `instrumented.jar` artifacts are copied to the location where partest expects them (because these paths are hardcoded in partest). Other extra JARs for partest in `test/files/lib` are referenced directly from the Ivy cache. - Move common settings that should be available with unqualified names in local `.sbt` files and on the command line into an auto-plugin. - Add an `antStyle` setting to sbt to allow users to easily enable ant-style incremental compilation instead of sbt’s standard name hashing with `set antStyle := true`. - Disable verbose `info`-level logging during sbt startup for both, `validate/test` and `validate/publish-core` jobs. Update logging is no longer disabled when running locally (where it is useful and doesn’t generate excessive output). - Pass optimization flags for scalac down to partest, using the new partest version 1.0.15\6. - Call the new sbt-based PR validation from `scripts/jobs/validate/test`. - Disable the tests `run/t7843-jsr223-service` and `run/t7933` from https://github.com/scala/scala/pull/4959 for now. We need to set up a new test project (either partest or junit) that can run them on a packaged version of Scala, or possibly move them into a separate project that would naturally run from a packaged Scala as part of the community build.
* | Merge pull request #5219 from som-snytt/issue/9245Jason Zaugg2016-06-141-0/+27
|\ \ | | | | | | SI-9245 Fresher name in Try and test
| * | SI-9245 Fresher name in Try and testSom Snytt2016-06-071-0/+27
| |/ | | | | | | | | | | | | | | Fresh name for catcher gets a dollar. "Here, have a dollar." Test due to retronym demonstrates possible conflict. Over the lifetime of the universe, surely at least one code monkey would type in that identifier to catch a banana.
* / SI-9737 [no-merge] Backport stringOf ParIterableNicolas Stucki2016-06-031-0/+57
|/ | | | | | | | | | | | | | Cherry-picked c5f3d3f286ee5c26c8ddcf10f6878058e8f7e040 Edited comment: in stringOf, let GenIterable subsume both Iterable and ParIterable. This change is required for Scala.js compatibility as it does not support parallel collections. Conflicts: src/library/scala/runtime/ScalaRunTime.scala
* Merge pull request #4998 from som-snytt/issue/7898-iLukas Rytz2016-06-015-4/+35
|\ | | | | SI-7898 Read user input during REPL warmup
| * SI-7898 Label for parsing -i sourcesLukas Rytz2016-05-243-0/+34
| | | | | | | | Text-based REPL pre-parses, so use the current label for errors.
| * SI-7898 Report paste errors improvedlySom Snytt2016-05-231-1/+1
| | | | | | | | | | | | | | | | Use a "label" for errors, so that script names are shown. Position is still wrong for scripts in REPL. Initial scripts are run with `ILoop.echo` and results printing turned off, but reporter still enabled.
| * SI-7898 Read user input during REPL warmupSom Snytt2016-05-201-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The compiler is created on main thread and user input is read on an aux thread (opposite to currently). Fixes completion when `-i` is supplied. Now `-i` means pasted and new option `-I` means line-by-line. The temporary reader uses postInit to swap in the underlying reader. Completion is disabled for the temporary reader, rather than blocking while it waits for a compiler. But manically hitting tab is one way of knowing exactly when completion is live.
* | SI-9789 use quadratic probing in OpenHashMapPerformant Data LLC2016-05-264-82/+251
| | | | | | | | | | | | | | | | | | | | | | | | The original probe sequence, taken from Python's hash table code, is exponential, jumping around in the hash table with poor memory locality. This replaces the probe algorithm with the more conventional quadratic probing. This also adds tests to the benchmarking code using AnyRef keys, which have pseudorandom hash codes (unlike Ints, whose hash code is simply the Int itself). The intensity of the benchmarking is reduced to make the tests complete within 9 hours, by removing unnecessary sampling.
* | Merge pull request #4959 from rjolly/scripting15Stefan Zeiger2016-05-252-8/+4
|\ \ | | | | | | Use jarlister in build
| * | Use jarlister in buildRaphael Jolly2016-05-212-8/+4
| |/ | | | | | | | | | | | | The goal of this change is to exercize the "manifest classpath" mechanism, meant to bring the compiler its needed classes as resources, listed in jar manifests, as opposed to files, thus enabling to use the compiler in sandboxed environments (and also the scripting engine for that matter).
* | Merge pull request #5061 from performantdata/benchmark-frameworkJason Zaugg2016-05-257-0/+457
|\ \ | | | | | | JMH-based benchmark framework
| * | Enable full compiler optimizations in JMH benchmarking.Performant Data LLC2016-05-051-1/+1
| | |
| * | Address JMH benchmark reviewer's issues.Performant Data LLC2016-05-033-59/+61
| | | | | | | | | | | | | | | Besides tweaks to the documentation, this tests smaller (25-element) maps, and rewrites OpenHashMapRunner in more idiomatic Scala.
| * | Improve the OpenHashMapBenchmark run times.Performant Data LLC2016-05-031-7/+14
| | | | | | | | | | | | | | | For the warm-up invocations, suppress setup and teardown that is only needed for the measurement iterations. Reduce the number of forks.
| * | Add a JMH runner class to the library benchmark framework.Performant Data LLC2016-05-033-9/+167
| | |