summaryrefslogtreecommitdiff
path: root/test/files/jvm
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #4554 from som-snytt/issue/1931Seth Tisue2015-08-061-3/+3
|\ | | | | SI-1931 Hide Predef.any2stringadd in REPL
| * SI-1931 Hide Predef.any2stringadd in REPLSom Snytt2015-07-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | User imports that reference Predef are relocated to the top of the wrapping template so that they can hide implicits defined in Predef. Only one import from Predef is retained for special treatment. This is simple and sane. The test shows that `import Predef._` restores Predef implicits even if a user-defined term would normally be in scope. A smart `:import` command to turn off or quarantine imports explicitly would allow fine-grained control.
* | SI-9393 fix modifiers of ClassBTypes for Java annotationsLukas Rytz2015-07-241-3/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Scala classfile and java source parsers make Java annotation classes (which are actually interfaces at the classfile level) look like Scala annotation classes: - the INTERFACE / ABSTRACT flags are not added - scala.annotation.Annotation is added as superclass - scala.annotation.ClassfileAnnotation is added as interface This makes type-checking @Annot uniform, whether it is defined in Java or Scala. This is a hack that leads to various bugs (SI-9393, SI-9400). Instead the type-checking should be special-cased for Java annotations. This commit fixes SI-9393 and a part of SI-9400, but it's still easy to generate invalid classfiles. Restores the assertions that were disabled in #4621. I'd like to leave these assertions in: they are valuable and helped uncovering the issue being fixed here. A new flag JAVA_ANNOTATION is introduced for Java annotation ClassSymbols, similar to the existing ENUM flag. When building ClassBTypes for Java annotations, the flags, superclass and interfaces are recovered to represent the situation in the classfile. Cleans up and documents the flags space in the area of "late" and "anti" flags. The test for SI-9393 is extended to test both the classfile and the java source parser.
* Merge pull request #4596 from janekdb/2.11.x-typos-p-rSeth Tisue2015-07-011-1/+1
|\ | | | | Fix 27 typos (p-r)
| * Fix 27 typos (p-r)Janek Bogucki2015-06-301-1/+1
| |
* | Merge pull request #4576 from som-snytt/issue/9206-moreSeth Tisue2015-07-013-6/+0
|\ \ | |/ |/| SI-9206 REPL custom bits
| * SI-9206 Update REPL welcome messageSom Snytt2015-06-243-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Everyone knows that a `help` command will result in `more information`. This commit moves the version string to the second line and adds some verve to the welcome. If anyone can't live without the old banner, they are now able to configure it explicitly, so there is still no blood on our hands. ``` $ scala Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). Type in expressions to have them evaluated. Type :help for more information. scala> :quit $ skala Welcome to Scala! version 2.11.7-20150623-155244-eab44dd092 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). Type in expressions for evaluation. Or try :help. scala> :quit ``` REPL tests now lop off the actual length of the welcome header; or, if necessary, remove the version number from a header embedded in output.
* | Merge pull request #4574 from janekdb/2.11.x-typos-g-iJason Zaugg2015-06-232-2/+2
|\ \ | |/ |/| Fix 25 typos (g-i)
| * Fix 25 typos (g-i)Janek Bogucki2015-06-222-2/+2
| |
* | Merge pull request #4564 from som-snytt/issue/promptv2.11.7Adriaan Moors2015-06-221-9/+9
|\ \ | |/ |/| SI-9206 Fix REPL code indentation
| * SI-9206 Fix REPL code indentationSom Snytt2015-06-191-9/+9
| | | | | | | | | | | | | | | | | | | | To make code in error messages line up with the original line of code, templated code is indented by the width of the prompt. Use the raw prompt (without ANSI escapes or newlines) to determine the indentation. Also, indent only once per line.
* | Fix 36 typos (d-f)Janek Bogucki2015-06-211-1/+1
|/
* Fix some typos (a-c)Janek Bogucki2015-06-182-2/+2
|
* Make two tests work under -Ydelambdafy:methodJason Zaugg2015-05-264-61/+66
| | | | | | | | | | | | | | | | | | Recently, in 029cce7, I changed uncurry to selectively fallback to the old method of emitting lambdas when we detect that `-Ydelambdafy:method`. The change in classfile names breaks the expectations of the test `innerClassAttribute`. This commit changes that test to avoid using specialized functions, so that under -Ydelambdafy:method all functions are uniform. This changes a few fresh suffixes for anonymous class names under both `-Ydelambdafy:{inline,method}`, so the expectations have been duly updated. Similarly, I have changed `javaReflection` in the same manner. Its checkfiles remained unchanged.
* Fix several tests under GenBCodeLukas Rytz2015-05-265-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | - private-inline, t8601-closure-elim, inline-in-constructors - test closure inlining / elimination, which is not yet implemented in GenBCode. noted in https://github.com/scala-opt/scala/issues/14. - constant-optimization, t7006 - no constant folding in GenBCode yet. noted in https://github.com/scala-opt/scala/issues/29. - patmat_opt_ignore_underscore, patmat_opt_no_nullcheck, patmat_opt_primitive_typetest - not all optimizations in GenBCode yet. noted in https://github.com/scala-opt/scala/issues/30. - t3234 - tests a warning of trait inlining - trait inlining works in GenBCode - synchronized - ignore inliner warnings (they changed a bit) - t6102 - account for the changed outputo of -Ydebug has under GenBCode
* Fix many typosMichał Pociecha2015-04-212-3/+3
| | | | | This commit corrects many typos found in scaladocs and comments. There's also fixed the name of a private method in ICodeCheckers.
* SI-8689 Make a Future test case determisticJason Zaugg2015-03-311-2/+7
| | | | | | | | | As discussed: https://groups.google.com/forum/#!topic/scala-internals/m8I_3GQR4vQ We need to ensure a happens-before relationship between the callback that prints "success" and the end of the main method.
* Merge commit 'ad845ff' into merge/2.10.x-to-2.11.x-20150224Jason Zaugg2015-02-243-8/+81
|\ | | | | | | | | | | Conflicts: src/library/scala/concurrent/Promise.scala test/files/jvm/future-spec/PromiseTests.scala
| * SI-8689 Avoid internal error in Promise after sequence of completionsViktor Klang2015-02-043-9/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling `completeWith` when the `DefaultPromise` is already completed, leads to callbacks not being properly executed. This happened because `Future.InternalCallbackExecutor` extends `BatchingExecutor`[1] which assumes `unbatchedExecute` to be async, when in this case it is sync, and if there is an exception thrown by executing the batch, it creates a new batch with the remaining items from the current batch and submits that to `unbatchedExecute` and then rethrows, but if you have a sync `unbatchedExecute`, it will fail since it is not reentrant, as witnessed by the failed `require` as reported in this issue. This commit avoids problem by delegating `completeWith` to `tryComplete`, which has the effect of using `onComplete` + `tryComplete` i.s.o. `complete`, which means that when it fails (because of a benign race condition between completers) it won't throw an exception. It has been tested by the minimized reproducer. [1] Actually, in the 2.10.x branch where this patch is starting out, "The BatchingExecutor trait had to be inlined into InternalCallbackExecutor for binary compatibility.". This comment will be more literally correct in the context of 2.11.x and beyond
* | Test java reflection on scala library / reflect / compiler jarsLukas Rytz2015-02-071-0/+65
| | | | | | | | | | | | | | Run a number of Java reflection operations on all classes in scala library / reflect / compiler. The test is based on a draft by Jason.
* | Fix InnerClass / EnclosingMethod for closures nested in value classesLukas Rytz2015-02-074-13/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Members of value classes are moved over to the companion object early. This change ensures that closure classes nested in value classes appear that way to Java reflection. This commit also changes the EnclosingMethod attribute for classes (and anonymous functions) nested in anonymous function bodies. Before, the enclosing method was in some cases the function's apply method. Not always though: () => { class C ... val a = { class D ...} } The class C used to be nested in the function's apply method, but not D, because the value definition for a was lifted out of the apply. After this commit, we uniformly set the enclosing method of classes nested in function bodies to `null`. This is consistent with the source-level view of the code. Note that under delambdafy:method, closures never appear as enclosing classes (this didn't change in this commit).
* | Fix InnerClass/EnclosingMethod for trait impl and specialized classesLukas Rytz2015-02-072-2/+124
| | | | | | | | | | | | | | | | | | | | Trait implementation classes and specialized classes are always considered top-level in terms of the InnerClass / EnclosingMethod attributes. These attributes describe source-level properties, and such classes are a compilation artifact. Note that the same is true for delambdafy:method closure classes (they are always top-level).
* | SI-9124 fix EnclosingMethod of classes nested in implOnly trait defsLukas Rytz2015-02-072-0/+48
| | | | | | | | | | | | | | | | | | | | Private trait methods are not added to the generated interface, they end up only in the implementation class. For classes nested in such methods, the EnclosingMethod attribute was incorrect. Since the EnclosingMethod attribute expresses a source-level property, but the actual enclosing method does not exist in the bytecode, we set the enclosing method to null.
* | SI-9105 Fix EnclosingMethod for classes defined in lambdasLukas Rytz2015-02-075-19/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes both GenASM and GenBCode, except for the change to renaming in LamdaLift mentioned below. The reason for an inconsistent EnclosingMethod attribute was the symbol owner chain. Initially, closure class symbols don't exist, they are only created in UnCurry (delambdafy:inline). So walking the originalOwner of a definition does not yield closure classes. The commit also fixes uses of isAnonymousClass, isAnonymousFunction and isDelambdafyFunction in two ways: 1. by phase-travelling to an early phase. after flatten, the name includes the name of outer classes, so the properties may become accidentally true (they check for a substring in the name) 2. by ensuring that the (destructive) renames during LambdaLift don't make the above properties accidentally true. This was in fact the cause for SI-8900.
* | Merge pull request #4233 from kanielc/SI-7770Lukas Rytz2015-02-032-2/+2
|\ \ | | | | | | SI-7770 mutable.BitSet.toImmutable isn't immutable
| * | SI-7770 mutable.BitSet.toImmutable isn't immutableDenton Cockburn2015-01-072-2/+2
| | | | | | | | | | | | | | | Mark method as deprecated due to it not providing the expected result, while fixing it will break existing code.
* | | Construct ClassBTypes from parsed classfilesLukas Rytz2015-01-163-20/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This infrastructure is required for the inliner: when inlining code from a classfile, the corresponding ClassBType is needed for various things (eg access checks, InnerClass attribute). The test creates two ClassBTypes for the same class: once using the (unpickled) Symbol, once using the parsed ASM ClassNode, and verifies that the two are the same. There's a cleanup to the InnerClass attribute: object T { class Member; def foo = { class Local } } class T For Java compatibility the InnerClass entry for Member says the class is nested in T (not in the module class T$). We now make sure to add that entry only to T, not to T$ (unless Member is actually referenced in the classfile T$, in that case it will be added, as required).
* | | SI-9044 Fix order of interfaces in classfilesLukas Rytz2014-12-181-0/+6
|/ / | | | | | | | | | | | | | | | | | | It was reversed since ced3ca8ae1. The reason is that the backend used `mixinClasses` to obtain the parents of a class, which returns them in linearization order. `mixinClasses` als returns all ancestors (not only direct parents), which means more work for `minimizeInterfaces`. This was introduced in cd62f52 for unclear reasons. So we switch back to using `parents`.
* | Fix lambda names under delambdafy:method in innerClassAttribute testLukas Rytz2014-10-101-3/+3
| | | | | | | | This should have been done in 63207e1
* | Update check files for -Ydelambdafy:methodLukas Rytz2014-10-101-2/+2
| | | | | | | | Should have been done in 63207e1.
* | SI-8568 unreachable test now passes in GenBCodeLukas Rytz2014-09-101-1/+0
| |
* | JUnit tests for dead code elimination.Lukas Rytz2014-09-102-5/+5
| | | | | | | | JUnit tests may use tools from partest-extras (ASMConverters)
* | SI-8786 disable part of test that's failing the jdk8 buildLukas Rytz2014-09-041-1/+3
| |
* | Fix InnerClass / EnclosingMethod attributesLukas Rytz2014-09-017-39/+815
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit seems bigger than it is. Most of it is tests, and moving some code around. The actual changes are small, but a bit subtle. The InnerClass and EnclosingMethod attributes should now be close to the JVM spec (which is summarized in BTypes.scala). New tests make sure that changes to these attributes, and changes to the way Java reflection sees Scala classfiles, don't go unnoticed. A new file, BCodeAsmCommon, holds code that's shared between the two backend (it could hold more, future work). In general, the difficulty with emitting InnerClass / EnclosingMethod is that we need to find out source-level properties. We need to make sure to do enough phase-travelling, and work around destructive changes to the ownerchain in lambdalift (we use originalOwner a lot). The change to JavaMirrors is prompted by the change to the EnclosingMethod attribute, which changes Java reflection's answer to getEnclosingMethod and getEnclosingConstructor. Classes defined in field initializers no longer have an enclosing method, just an enclosing class, which broke an assumption in JavaMirrors. There's one change in erasure. Before this change, when an object declaration implements / overrides a method, and a bridge is required, then the bridge method was actually a ModuleSymbol (it would get the lateMETHOD flag and be emitted as a method anyway). This is confusing, when iterating through the members of a class, you can find two modules with the same name, and one of them doesn't have a module class. Now, such bridge methods will be MethodSymbols. Removed Symbol.originalEnclosingMethod, that is a backend thing and doesn't need to live in the symbol API.
* | Merge pull request #3927 from lrytz/innerClassesTestLukas Rytz2014-08-123-0/+310
|\ \ | | | | | | test for InnerClass and EnclosingMethod attributes
| * | test for InnerClass and EnclosingMethod attributesLukas Rytz2014-08-123-0/+310
| | | | | | | | | | | | | | | | | | Some parts of the test assert (current) buggy behavior. This is marked in the test file with TODO. It will be fixed in later work on the backend.
* | | SI-4563 friendlier behavior for Ctrl+D in the REPLAntoine Gourlay2014-07-293-3/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Closing the REPL with Ctrl+D does not issue a newline, so the user's prompt displays on the same line as the `scala>` prompt. This is bad. We now force a newline before closing the interpreter, and display `:quit` while we're at it so that people know how to exit the REPL (since `exit` doesn't exist anymore). The tricky part was to only add a newline when the console is interrupted, and *not* when it is closed by a command (like `:quit`), since commands are processed after their text (including newline) has been sent to the console.
* | SI-8743 Fix crasher with poly-methods annotated with @varargsJason Zaugg2014-07-233-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The code that generated the Java varargs forwarder was basing things on the `ValDef-s` of the parameters of the source method. But, their types refer to a type parameter skolems of the enclosing method, which led to a type mismatch when typechecking the forwarder. Instead, I've reworked the code to simply use the `DefDef`-s symbol's info, which *doesn't* refer to skolems. This actually simplifies the surrounding code somewhat; rather than repeated symbols in a map we can just time travel the pre-uncurry method signatures to figure out which params are releated.
* | Merge pull request #3866 from Blaisorblade/issue/8677-backportLukas Rytz2014-07-091-0/+5
|\ \ | | | | | | SI-8677 Duration: Zero - Inf should be MinusInf
| * | [backport] SI-8677 Duration: Zero - Inf should be MinusInfPaolo G. Giarrusso2014-07-041-0/+5
| | | | | | | | | | | | | | | Fixes #8677. Add basic tests. This is a backport from 2.12.x of dead39dc5f21c6eac41788e93426c50ddd398c24.
* | | Use countElementsAsString for summarized warnings.Adriaan Moors2014-07-043-3/+3
|/ /
* | SI-8185 Correct grammar for single-warning compilation runFrançois Garillot2014-05-145-6/+6
| |
* | Move t8582 to test/files/jvmLukas Rytz2014-05-132-0/+125
| |
* | Fix BeanInfo generation for GenBCodeLukas Rytz2014-05-133-0/+32
| |
* | Disable 'unreachable' test for GenBCodeLukas Rytz2014-05-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | GenICode has some logic to eliminate some dead code directly at code gen (introduced in b50a0d811f for SI-7006). This has not been ported over to GenBCode. GenBCode with the new optimizer (in Miguel's branch) also eliminates such dead code. Before adding such functionality to GenBCode I'd like to investigate the cost of running DCE. Maybe we can keep the code generator simple. I created SI-8568 to keep track of this.
* | PR #3233 cleanupPavel Pavlov2014-02-051-1/+1
| | | | | | | | | | - `::.head` became a `val`; excessive accessor removed - SerializationProxy moved to `object List`
* | Merge pull request #3316 from Ichoran/topic/big-decimal-correctnessAdriaan Moors2014-01-151-1/+0
|\ \ | | | | | | Quasi-comprehensive BigDecimal soundness/correctness fix.
| * | Quasi-comprehensive BigDecimal soundness/correctness fix.Rex Kerr2014-01-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | SI-8035 Deprecate automatic () insertion in argument listsSimon Ochsenreither2014-01-095-142/+137
|/ / | | | | | | | | | | | | | | | | | | | | | | | | This promotes the () insertion warning from -Ywarn-adapted-args to a deprecation warning. -Xfuture tunrs it into a compiler error. Auto tupling remains unchanged for now. The tests have been fixed the following way: - Warnings caused by general sloppiness (Try(), Future(), ...) have been fixed. - Warnings which raise interesting questions (x == (), ...) received an updated checkfile for now.
* | Use t- prefix instead of si- prefix for test filesDen Shabalin2013-12-162-0/+0
| |