summaryrefslogtreecommitdiff
path: root/test/junit
Commit message (Collapse)AuthorAgeFilesLines
* Make ImplicitInfo hashCode consistent with equals.Miles Sabin2017-04-031-0/+39
|
* Merge pull request #5675 from piyush-jaiswal/issue/9729som-snytt2017-03-101-0/+173
|\ | | | | Add tests for ConsoleReporter.
| * Add tests for ConsoleReporter.piyush-jaiswal2017-03-111-0/+173
| |
* | Merge pull request #5719 from retronym/ticket/10187Adriaan Moors2017-03-101-0/+38
|\ \ | |/ |/| SI-10187 Support mutation of mutable.HashMap in getOrElseUpdate
| * SI-10187 Support mutation of mutable.HashMap in getOrElseUpdateJason Zaugg2017-03-031-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | Scala 2.12.1 included optimizations to `HashMape.getOrElseUpdate` to avoid recomputing the index in the hash table when adding an the element. However, this index could be stale if the callback added elements to the map and triggered a resize. This commit checks that the table is unchanged before reusing the index, restoring the 2.12.0 behaviour.
* | increase timeouts on some sys.process testsSeth Tisue2017-02-231-12/+18
| | | | | | | | | | | | these were occasionally timing out on our Windows CI reference: https://github.com/scala/scala-dev/issues/313
* | Revert "SI-10133 Require escaped single quote char lit"Adriaan Moors2017-02-211-1/+1
| |
* | Merge pull request #5640 from optimizely/repl-import-handlerAdriaan Moors2017-02-201-0/+25
|\ \ | | | | | | SI-9881 Fix ImportHandler's reporting of importedNames and importedSymbols
| * | Fix SIOOBE in Name#pos for substrings of length 1Jason Zaugg2017-01-101-0/+25
| | |
* | | Merge pull request #5629 from som-snytt/issue/10120-quote-errAdriaan Moors2017-02-201-1/+1
|\ \ \ | | | | | | | | SI-10133 Require escaped single quote char lit
| * | | SI-10120 ReplReporter handles message indentSom Snytt2017-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of indenting source code to make messages align on output, let the reporter add indentation, only if the source is the console (and not a pastie or a loaded file). Previously, syntax errors were not indented. ``` $ skala Welcome to Scala 2.12.2-20170108-010722-939abf1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111). Type in expressions for evaluation. Or try :help. scala> 'abc' <console>:1: error: unclosed character literal (or use " for string literal "abc") 'abc' ^ scala> :quit $ scala Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111). Type in expressions for evaluation. Or try :help. scala> 'abc' <console>:1: error: unclosed character literal 'abc' ^ ```
* | | | 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 branch '2.12.x' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-172-3/+63
|\ \ \ \
| * \ \ \ 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 #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 commit '0965028809' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-161-0/+578
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | 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
| * | | | Test IndexedSeq, including ArrayOps, WrappedArray.Mike Skells2017-01-281-0/+567
| | | | | | | | | | | | | | | | | | | | Specifically, the `slice` and `take` methods.
| * | | | [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.
* | | | | Merge pull request #5522 from ruippeixotog/issue/9886Stefan Zeiger2017-02-081-0/+6
|\ \ \ \ \ | | | | | | | | | | | | SI-9507 Make Stream #:: and #::: allow type widening
| * | | | | SI-9507 Make Stream #:: and #::: allow type wideningRui Gonçalves2017-02-021-0/+6
| | |/ / / | |/| | |
* | | | | Merge pull request #5585 from som-snytt/issue/10097Adriaan Moors2017-02-071-1/+1
|\ \ \ \ \ | |/ / / / |/| | | | SI-10097 Error if no non-implicit case class param
| * | | | SI-10097 Error if no non-implicit case class paramSom Snytt2016-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Case class must have a non-implicit param list. Error early, error often. Also update spec to say that class implicitly gets a non-implicit parameter section if it doesn't have one, and that a case class must have one.
* | | | | SI-10113 mutable.TreeMap.range does not workEvgeny Slutsky2017-01-092-0/+54
| |_|_|/ |/| | | | | | | | | | | added missing overrides for TreeMapView
* | | | SI-9936 LinearSeqOptimized.indexWhereSom Snytt2016-12-301-0/+19
| |_|/ |/| | | | | | | | | | | | | | Also suffered from the negative `from` bug. Prefer `math.max` to avoid `RichInt`.
* | | Merge pull request #5583 from lrytz/t10093Adriaan Moors2016-12-211-2/+38
|\ \ \ | | | | | | | | SI-10093 don't move member traits to constructor body in constructors
| * | | SI-10093 don't move member traits to constructor body in constructorsLukas Rytz2016-12-061-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a regression introduced in c8e6050. Member traits with only abstract definitions (`isInterface`) were moved into the primary constructor by mistake. (Flatten moved the classes back.) The member trait was duplicated into the constructor of specialized subclasses, causing it to be generated multiple times. Also removes some unnecessary `isMixinConstructor` checks: the mixin constructor is always the primary constructor. This commit also clarifies (and tests) what `isInterface` means: for scala-defined traits, it means there are only abstract members. For java-defined interfaces, it is always true.
* | | | Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2016-12-202-5/+43
|\ \ \ \ | |_|/ / |/| | / | | |/ | |/| | | | | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20161220 Conflicts: bincompat-backward.whitelist.conf build.xml src/compiler/scala/tools/nsc/typechecker/Typers.scala src/library/scala/collection/immutable/NumericRange.scala
| * | 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.
| * | SI-10086 NumericRange.min|max with custom Integral (#5575)Tobias Schlatter2016-12-121-0/+39
| | | | | | | | | SI-10086 NumericRange.min|max with custom Integral
* | | Merge pull request #5531 from tabdulradi/SI-10060Lukas Rytz2016-12-121-0/+42
|\ \ \ | |_|/ |/| | SI-10060 Fixes NumricRange.max bug on empty ranges
| * | fixup! SI-10060 Fixes NumericRange.max bug on empty rangesTamer Mohammed Abdul-Radi2016-11-161-2/+14
| | |
| * | SI-10060 Fixes NumericRange.max bug on empty rangesTamer AbdulRadi2016-11-161-0/+30
| | |
* | | Don't exclude super calls to trait methods from inliningLukas Rytz2016-11-291-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 8020cd6, the inliner was changed to make sure trait methods bodies are not duplicated into the static super accessors, and from there into mixin forwarders. The check for mixin forwarders was too wide. In `def t = super.m`, where `m` is a trait method annotated `@inline`, we want to inline `m`. Note that `super.m` is translated to an `invokestatic T.m$`. The current check incorrectly identifies `t` as a mixin forwarder, and skip inlining.
* | | Merge commit '57290a1' into topic/merge-2.11.x-to-2.12.x-20161129Jason Zaugg2016-11-291-0/+8
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | Conflicts: spec/_layouts/default.yml test/junit/scala/tools/nsc/interpreter/CompletionTest.scala Fixes scala/scala-dev#272
| * | 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
* | | Merge pull request #5544 from retronym/ticket/8779Jason Zaugg2016-11-292-1/+53
|\ \ \ | | | | | | | | SI-8779 Enable inlining of code within a REPL session
| * | | SI-8779 Enable inlining of code within a REPL sessionJason Zaugg2016-11-282-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The REPL has a long running instance of Global which outputs classfiles by default to a VirtualDirectory. The inliner did not find any of these class files when compiling calls to methods defined in previous runs (ie, previous lines of input.) This commit: - Adds a hook to augment the classpath that the optimizer searches, and uses this in the REPL to add the output directory - Fixes the implementation of `findClassFile` in VirtualDirectory, which doesn't seem to have been used in anger before. I've factored out some common code into a new method on `AbstractFile`. - Fixes a similar problem getSubDir reported by Li Haoyi - Adds missing unit test coverage. This also fixes a bug in REPL autocompletion for types defined in packages >= 2 level deep (with the `:paste -raw` command). I've added a test for this case.
* | | | Better inliner support for 2.12 trait encodingLukas Rytz2016-11-255-34/+153
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some changes to the trait encoding came late in the 2.12 cycle, and the inliner was not adapted to support it in the best possible way. In 2.12.0 concrete trait methods are encoded as interface T { default int m() { return 1 } static int m$(T $this) { <invokespecial $this.m()> } } class C implements T { public int m() { return T.m$(this) } } If a trait method is selected for inlining, the 2.12.0 inliner would copy its body into the static super accessor `T.m$`, and from there into the mixin forwarder `C.m`. This commit special-cases the inliner: - We don't inline into static super accessors and mixin forwarders. - Insted, when inlining an invocation of a mixin forwarder, the inliner also follows through the two forwarders and inlines the trait method body. There was a difficulty implementing this: inlining the static static super accessor would copy an `invokespecial` instruction into a different classfile, which is not legal / may change semantics. That `invokespecial` is supposed to disappear when inlining the actual default method body. However, this last step may fail, for example because the trait method body itself contains instructions that are not legal in a different classfile. It is very difficult to perform all necessary checks ahead of time. So instead, this commit implements the ability to speculatively inline a callsite and roll back if necessary. The commit also cleans up the implementation of inliner warnings a little. The previous code would always emit a warning when a method annotated `@inline` was not picked by the heuristics - this was a problem when the callsite in the static super accessor was no longer chosen.
* | | Merge pull request #5481 from som-snytt/issue/10007-processLukas Rytz2016-11-182-0/+26
|\ \ \ | | | | | | | | SI-10007 sys.process thread sync
| * | | SI-10007 sys.process thread syncSom Snytt2016-11-172-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A previous change to replace `SyncVar.set` with `SyncVar.put` breaks things. This commit tweaks the thread synchronizing in `sys.process` to actually use `SyncVar` to sync and pass a var. Joining the thread about to exit is superfluous. A result is put exactly once, and consumers use non-destructive `get`. Note that as usual, avoid kicking off threads in a static context, since class loading cycles are somewhat dicier with 2.12 lambdas. In particular, REPL is a static context by default. SI-10007 Clarify deprecation message The message on `set` was self-fulfilling, as it didn't hint that `put` has different semantics. So explain why `put` helps avoid errors instead of creating them. SI-10007 Always set exit value Always put a value to exit code, defaulting to None. Also clean up around tuple change to unfortunately named Future.apply. Very hard to follow those types. Date command pollutes output, so tweak test.
* | | | Merge pull request #5330 from som-snytt/issue/9885Jason Zaugg2016-11-181-0/+19
|\ \ \ \ | | | | | | | | | | SI-9885 Don't return offset past EOF
| * | | | SI-9885 Don't return offset past EOFSom Snytt2016-08-121-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | On bad line number, `lineToOffset` should not return an offset past EOF (which was sentinel, internally).
* | | | | Revert "SI-9750 isJavaAtLeast(Int)"Jason Zaugg2016-11-161-8/+3
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | This reverts commit 656162bb48fbbd703790a2c94d4563e40ddfdfc2. Adding new APIs is not possible until a major release.
* | | | Merge pull request #5335 from rumoku/SI-9888Jason Zaugg2016-11-111-0/+15
|\ \ \ \ | | | | | | | | | | SI-9888. Prevent OOM on ParRange. Improve toString.
| * | | | SI-9888. Prevent OOM on ParRange. Improve toString.Vladimir Glushak2016-10-021-0/+15
| | | | |
* | | | | Merge commit 'b9a16c4' into 2.12.xJason Zaugg2016-11-081-0/+6
|\ \ \ \ \ | |_|_|/ / |/| | | / | | |_|/ | |/| |