summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* SI-10069 Fix code gen errors with array updates, NothingJason Zaugg2016-12-022-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | Crashes in ASM or VerifyErrors used to occur when assigning an expression of type Nothing to an element of a primitive array. This commit adapts the RHS of the assignment to the element type to correct this. `adapt` contains logic to insert an `ATHROW` of the slot of type `Nothing$`, which makes everything line up. The subsequent array stores become dead code and are dropped later on in code gen, so the test case compiles to: public void foo0(double[]); Code: 0: bipush 42 2: istore_2 3: aload_1 4: iconst_0 5: aload_0 6: invokevirtual #30 // Method throwExpected:()Lscala/runtime/Nothing$; 9: athrow I found a similar bug in the emission of primitive unboxing and fixed that too.
* Merge pull request #5532 from retronym/ticket/SD-264Adriaan Moors2016-11-161-8/+3
|\ | | | | Reinstate MiMa and address problems
| * 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 #5449 from som-snytt/issue/9953Lukas Rytz2016-11-163-0/+20
|\ \ | | | | | | SI-9953 Any Any aborts warn on equals
| * | SI-9953 Any Any aborts warn on equalsSom Snytt2016-10-073-0/+20
| | | | | | | | | | | | | | | | | | | | | Don't warn about equals if any `Any` is involved. cf SI-8965 The condition for warning is that both types lub to a supertype of Object.
* | | Merge pull request #5440 from som-snytt/issue/9944Lukas Rytz2016-11-162-0/+19
|\ \ \ | | | | | | | | SI-9944 Scan after interp expr keeps CR
| * | | SI-9944 Scan after interp expr keeps CRSom Snytt2016-10-012-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | In an interpolated expression `s"""${ e }"""`, the scanner advances input past the RBRACE. If a multiline string as shown, get the next raw char, because CR is significant.
* | | | Merge pull request #5533 from som-snytt/issue/broken-9915Seth Tisue2016-11-161-1/+3
|\ \ \ \ | | | | | | | | | | SI-9915 Fix test on windows
| * | | | SI-9915 Fix test on windowsSom Snytt2016-11-161-1/+3
| | |_|/ | |/| | | | | | | | | | | | | | Use `javac: -encoding UTF-8` tool args comment so javac uses correct source encoding.
* | | | Merge pull request #5534 from lrytz/t10059Lukas Rytz2016-11-162-0/+12
|\ \ \ \ | |/ / / |/| | | SI-10059 reset the `DEFERRED` flag for Java varargs forwarders
| * | | SI-10059 reset the `DEFERRED` flag for Java varargs forwardersLukas Rytz2016-11-162-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an abstract method is annotated `@varargs`, make sure that the generated synthetic Java varargs method does not have the `DEFERRED` flag (`ACC_ABSTRACT` in bytecode). The flag lead to an NPE in the code generator, because the ASM framework leaves certain fields `null` for abstract methods (`localVariables` in this case). Interestingly this did not crash in 2.11.x: the reason is that the test whether to emit a method body or not has changed in the 2.12 backend (in c8e6050). val isAbstractMethod = [..] methSymbol.isDeferred [..] // 2.11 val isAbstractMethod = rhs == EmptyTree // 2.12 So in 2.11, the varargs forwarder method was actually left abstract in bytecode, leading to an `AbstractMethodError: T.m([I)I` at run-time.
* | | | Merge pull request #5384 from som-snytt/issue/9915Seth Tisue2016-11-142-0/+30
|\ \ \ \ | | | | | | | | | | SI-9915 Utf8_info are modified UTF8
| * | | | SI-9915 Utf8_info are modified UTF8Som Snytt2016-10-202-0/+30
| | |_|/ | |/| | | | | | | | | | | | | | | | | | Use DataInputStream.readUTF to read CONSTANT_Utf8_info. This fixes reading embedded null char and supplementary chars.
* | | | SI-8433 SI-9689 Progressive testsSom Snytt2016-11-125-0/+82
| | | | | | | | | | | | | | | | Because no one votes against a progressive test.
* | | | Typo and spelling correctionsJanek Bogucki2016-11-111-1/+1
| | | |
* | | | Merge pull request #5335 from rumoku/SI-9888Jason Zaugg2016-11-113-8/+23
|\ \ \ \ | | | | | | | | | | SI-9888. Prevent OOM on ParRange. Improve toString.
| * | | | SI-9888. Prevent OOM on ParRange. Improve toString.Vladimir Glushak2016-10-023-8/+23
| | | | |
* | | | | Merge pull request #5460 from som-snytt/issue/6978Jason Zaugg2016-11-103-0/+13
|\ \ \ \ \ | | | | | | | | | | | | SI-6978 No linting of Java parens
| * | | | | SI-6978 No linting of Java parensSom Snytt2016-10-153-0/+13
| | |/ / / | |/| | | | | | | | | | | | | | | | | | Don't lint overriding of nullary by non-nullary when non-nullary is Java-defined. They can't help it.
* | | | | Merge pull request #5486 from som-snytt/issue/6734-synthsJason Zaugg2016-11-101-0/+17
|\ \ \ \ \ | | | | | | | | | | | | SI-6734 Synthesize companion near case class
| * | | | | SI-6734 CommentSom Snytt2016-10-311-15/+9
| | | | | |
| * | | | | SI-6734 Synthesize companion near case classSom Snytt2016-10-271-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tweak the "should I synthesize now" test for case modules, so that the tree is inserted in the same tree as the case class.
* | | | | | Merge pull request #5509 from lrytz/t10032Lukas Rytz2016-11-102-0/+246
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-10032 Fix code gen with returns in nested try-finally blocks
| * | | | | | Fix returns from within finalizersLukas Rytz2016-11-092-13/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a return in a finalizer was reached through a return within the try block, the backend ignored the return in the finalizer: try { try { return 1 } finally { return 2 } } finally { println() } This expression should evaluate to 2 (it does in 2.11.8), but in 2.12.0 it the result is 1. The Scala spec is currently incomplete, it does not say that a finalizer should be exectuted if a return occurs within a try block, and it does not specify what happens if also the finally block has a return. So we follow the Java spec, which basically says: if the finally blocks completes abruptly for reason S, then the entire try statement completes abruptly with reason S. An abrupt termination of the try block for a different reason R is discarded. Abrupt completion is basically returning or throwing.
| * | | | | | SI-10032 Fix code gen with returns in nested try-finally blocksLukas Rytz2016-11-082-0/+162
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Return statements within `try` or `catch` blocks need special treatement if there's also a `finally` try { return 1 } finally { println() } For the return, the code generator emits a store to a local and a jump to a "cleanup" version of the finally block. There will be 3 versions of the finally block: - One reached through a handler, if the code in the try block throws; re-throws at the end - A "cleanup" version reached from returns within the try; reads the local and returns the value at the end - One reached for ordinary control flow, if there's no return and no exception within the try If there are multiple enclosing finally blocks, a "cleanup" version is emitted for each of them. The nested ones jump to the enclosing ones, the outermost one reads the local and returns. A global variable `shouldEmitCleanup` stores whether cleanup versions are required for the curren finally blocks. By mistake, this variable was not reset to `false` when emitting a `try-finally` nested within a `finally`: try { try { return 1 } finally { println() } // need cleanup version } finally { // need cleanup version try { println() } finally { println() } // no cleanup version needed! } In this commit we ensure that the variable is reset when emitting nested `try-finally` blocks.
* | | | | | Merge pull request #5507 from viktorklang/wip-SI-10034-√Jason Zaugg2016-11-101-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-10034: Regression: Make Future.failed(e).failed turn into a success instead of failure
| * | | | | | Regression: Make Future.failed(e).failed turn into a success instead of failureViktor Klang2016-11-081-1/+1
| |/ / / / /
* | | | | | Merge commit 'b9a16c4' into 2.12.xJason Zaugg2016-11-081-0/+6
|\ \ \ \ \ \ | |/ / / / / |/| | | | |
| * | | | | 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 #5469 from adriaanm/java-scan-tailrecAdriaan Moors2016-11-043-0/+18
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No StackOverflowError in Java doc comment scanning Fixes SI-10020 SI-10027
| * | | | | | | Add regression tests for SI-10027Jakob Odersky2016-11-033-0/+18
| | | | | | | |
* | | | | | | | Merge pull request #5482 from lrytz/sd248-frontendLukas Rytz2016-10-2816-0/+69
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Frontend fixes for scala-dev#248
| * | | | | | | | For scala classfiles, only parse the scala signature annotationLukas Rytz2016-10-2810-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Skipping other annotations not only saves some cycles / GC, but also prevents some spurious warnings / errors related to cyclic dependencies when parsing annotation arguments refering to members of the class.
| * | | | | | | | SI-7139 test case, fixed by one of the recent commitsLukas Rytz2016-10-273-0/+28
| | | | | | | | |
| * | | | | | | | Ensure companionClass returns a class, not a type aliasLukas Rytz2016-10-263-0/+10
| | |_|_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes scala/scala-dev#248, where a type alias reached the backend through this method. This is very similar to the fix for SI-5031, which changed it only in ModuleSymbol, but not in Symbol. The override in ModuleSymbol is actually unnecessary (it's identical), so it's removed in this commit. It was added for unclear reasons in 296b706.
* | | | | | | | Merge pull request #5276 from som-snytt/issue/9750Seth Tisue2016-10-261-28/+74
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | SI-9750 scala.util.Properties.isJavaAtLeast works with JDK9
| * | | | | | | SI-9750 Spec check major.minor.securitySom Snytt2016-07-211-8/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't assume spec is just major, but allow arbitrary version number for both spec value and user value to check. Only the first three dot-separated fields are considered, after skipping optional leading value "1" in legacy format. Minimal validity checks of user arg are applied. Leading three fields, if present, must be number values, but subsequent fields are ignored. Note that a version number is not a version string, which optionally includes pre and build info, `9-ea+109`.
| * | | | | | | SI-9750 isJavaAtLeast(Int)Som Snytt2016-07-151-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A good opportunity to simplify the API. Versions are strings, but a spec version is just a number.
| * | | | | | | SI-9750 Tweak tests for what is a numberSom Snytt2016-07-151-21/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Leaves the error string as is, but adds test to show how it looks. Java calls it a version number. `Not a version: 1.9`. Don't strip `1.` prefix recursively. (That was Snytt's fault.)
| * | | | | | | SI-9750 scala.util.Properties.isJavaAtLeast works with JDK9Pavel Petlinsky2016-07-131-17/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The utility method compares javaSpecVersion, which has the form "1.8" previously and "9" going forward. The method accepts "1.n" for n < 9. More correctly, the string argument should be a single number. Supports JEP-223.
* | | | | | | | assorted typo fixes, cleanup, updating of commentsSeth Tisue2016-10-244-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | just in time for Halloween. "boostrap" is definitely the most adorable typo evah -- and one of the most common, too. but we don't want to scare anybody.
* | | | | | | | re-enable (or simplify) various tests now that STARR is bumpedSeth Tisue2016-10-241-206/+185
| | | | | | | |
* | | | | | | | Merge pull request #5466 from dragos/issue/remove-println-SI-8717Lukas Rytz2016-10-212-2/+0
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Replace println with log calls in BrowsingLoaders
| * | | | | | | | Replace println with log calls in BrowsingLoadersIulian Dragos2016-10-192-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 #5393 from som-snytt/issue/nowarn-thistype-discardLukas Rytz2016-10-211-0/+6
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | No warn when discarding r.f(): r.type
| * | | | | | | | No warn when discarding r.f(): r.typeSom Snytt2016-09-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The paradigm is `def add(x: X): Unit = listBuffer += x`. The value that is discarded is not new information. Also cleans up the recent tweaks to help messaging. Adds newlines in case they ask for multiple helps.
* | | | | | | | | Merge pull request #5400 from sjrd/rewrite-traversablelike-stringprefixSeth Tisue2016-10-201-5/+41
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Rewrite TraversableLike.stringPrefix not to blow up code size in Scala.js.
| * | | | | | | | | Rewrite TraversableLike.stringPrefix not to blow up code size in Scala.js.Sébastien Doeraene2016-09-151-5/+41
| |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit 30876fe2dd8cbe657a6cad6b11bbc34f10c29b36 changed `TraversableLike.stringPrefix` to report nicer results for inner classes and method-local classes. The changes included calls to `String.split()`, `Character.isDigit()` and `Character.isUpperCase()`. This was particularly bad for Scala.js, because those methods bring with them huge parts of the JDK (the `java.util.regex.*` implementation on the one hand, and the Unicode database on the other hand), which increased generated code size by 6 KB after minimification and gzip for an application that does not otherwise use those methods. This sudden increase is tracked in the Scala.js bug tracker at https://github.com/scala-js/scala-js/issues/2591. This commit rewrites `TraversableLike.stringPrefix` in a very imperative way, without resorting to those methods. The behavior is (mostly) preserved. There can be different results when `getClass().getName()` contains non-ASCII lowercase letters and/or digits. Those will now be recognized as user-defined instead of likely compiler-synthesized (which is a progression). There still are false positives for ASCII lowercase letters, which cause the `stringPrefix` to be empty (as before). Since the new implementation is imperative anyway, at least I made it not allocate anything but the result `String` in the common case where the result does not contain any `.`.
* | | | | | | | | Merge pull request #5439 from som-snytt/issue/fields-fieldwidthSeth Tisue2016-10-205-5/+5
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Shorten fields phase description