summaryrefslogtreecommitdiff
path: root/test/files/jvm
Commit message (Collapse)AuthorAgeFilesLines
* Revert "SI-10133 Require escaped single quote char lit"Adriaan Moors2017-02-211-4/+4
|
* Merge pull request #5629 from som-snytt/issue/10120-quote-errAdriaan Moors2017-02-201-4/+4
|\ | | | | SI-10133 Require escaped single quote char lit
| * SI-10120 ReplReporter handles message indentSom Snytt2017-01-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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' ^ ```
* | adjust to partest 1.1.0's new mixed Java/Scala compilationLukas Rytz2017-01-272-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | upgrades partest from 1.0.17 to 1.1.0 https://github.com/scala/scala-partest/pull/69 changed the mode for mixed compilation, which used to be 1. scalac *.java *.scala -d o 2. javac *.java -d o -cp o 3. scalac *.scala -d o -cp o Now the third step is skipped. This required some adjustments to existing tests. - t7014 is split in two groups, the fix is for separate compilation. - t7582 is also split. It tests inliner warnings when inling code that accesses Java-defined package-private code. Inlining from Java only works in separate compilation (no bytecode available in mixed compilation). - Java compiler warnings of "run" tests were not reported in the old scheme, now they are. Deprecation / unchecked warnings were removed from t6240, t8786, varargs. - t4788 required a .check file update to pass, which hints at a bug. I will re-open SI-4788 and investigate later.
* SI-10071 Separate compilation for varargs methodsIulian Dragos2016-11-254-0/+27
| | | | | | | | | | | | | | | | | | 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
* Merge pull request #5335 from rumoku/SI-9888Jason Zaugg2016-11-112-8/+8
|\ | | | | SI-9888. Prevent OOM on ParRange. Improve toString.
| * SI-9888. Prevent OOM on ParRange. Improve toString.Vladimir Glushak2016-10-022-8/+8
| |
* | Regression: Make Future.failed(e).failed turn into a success instead of failureViktor Klang2016-11-081-1/+1
| |
* | Fields phase expands lazy vals like modulesAdriaan Moors2016-08-292-10/+10
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They remain ValDefs until then. - remove lazy accessor logic now that we have a single ValDef for lazy vals, with the underlying machinery being hidden until the fields phase leave a `@deprecated def lazyAccessor` for scala-refactoring - don't skolemize in purely synthetic getters, but *do* skolemize in lazy accessor during typers Lazy accessors have arbitrary user code, so have to skolemize. We exempt the purely synthetic accessors (`isSyntheticAccessor`) for strict vals, and lazy accessors emitted by the fields phase to avoid spurious type mismatches due to issues with existentials (That bug is tracked as https://github.com/scala/scala-dev/issues/165) When we're past typer, lazy accessors are synthetic, but before they are user-defined to make this hack less hacky, we could rework our flag usage to allow for requiring both the ACCESSOR and the SYNTHETIC bits to identify synthetic accessors and trigger the exemption. see also https://github.com/scala/scala-dev/issues/165 ok 7 - pos/existentials-harmful.scala ok 8 - pos/t2435.scala ok 9 - pos/existentials.scala previous attempt: skolemize type of val inside the private[this] val because its type is only observed from inside the accessor methods (inside the method scope its existentials are skolemized) - bean accessors have regular method types, not nullary method types - must re-infer type for param accessor some weirdness with scoping of param accessor vals and defs? - tailcalls detect lazy vals, which are defdefs after fields - can inline constant lazy val from trait - don't mix in fields etc for an overridden lazy val - need try-lift in lazy vals: the assign is not seen in uncurry because fields does the transform (see run/t2333.scala) - ensure field members end up final in bytecode - implicit class companion method: annot filter in completer - update check: previous error message was tangled up with unrelated field definitions (`var s` and `val s_scope`), now it behaves consistently whether those are val/vars or defs - analyzer plugin check update seems benign, but no way to know... - error message gen: there is no underlying symbol for a deferred var look for missing getter/setter instead - avoid retypechecking valdefs while duplicating for specialize see pos/spec-private - Scaladoc uniformly looks to field/accessor symbol - test updates to innerClassAttribute by Lukas
* Merge pull request #5141 from adriaanm/fieldsAdriaan Moors2016-08-112-1/+53
|\ | | | | Introducing: the fields phase [ci: last-only]
| * Test EnclosingMethod attribute for classes in lazy valsLukas Rytz2016-08-112-1/+53
| | | | | | | | | | | | | | | | | | | | | | Local and anonymous classes need to have an EnclosingMethod attribute denoting the enclosing class and method. In fact, the enclosing class must always be defined for local and anonymous classes, but the enclosing method may be null (for local / anonymous classes defined in field initializers or local blocks within a class body). The new test here ensures that classes declared within a lazy val initializer block indeed have the enclosing method set to null.
* | Merge pull request #5260 from szeiger/issue/9068Seth Tisue2016-08-111-2/+2
|\ \ | | | | | | SI-9068 Deprecate scala.collection.mutable.Stack
| * | SI-9068 Deprecate scala.collection.mutable.StackStefan Zeiger2016-08-101-2/+2
| |/
* | Merge pull request #5272 from som-snytt/issue/8829Adriaan Moors2016-08-111-2/+2
|\ \ | | | | | | SI-8829 Defaultly scala -feature -deprecation
| * | SI-8829 Let reporter customize retry messageSom Snytt2016-07-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | "Re-run with -deprecation" is not always appropriate. REPL gets to customize the message. The API includes the setting and its name, because reflect Settings do not have names. (!)
* | | Merge pull request #5262 from lrytz/t8786Adriaan Moors2016-08-117-39/+156
|\ \ \ | |_|/ |/| | SI-8786 fix generic signature for @varargs forwarder methods
| * | SI-8786 fix generic signature for @varargs forwarder methodsLukas Rytz2016-08-117-39/+156
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When generating a varargs forwarder for def foo[T](a: T*) the parameter type of the forwarder needs to be Array[Object]. If we gnerate 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 cleanes 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.
* | Reduce deprecations and warningsSimon Ochsenreither2016-08-022-2/+2
| |
* | Deprecate scala.remoteLukas Rytz2016-07-202-0/+4
|/
* SI-9390 Avoid needless outer capture with local classesJason Zaugg2016-06-031-12/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An existing optimization in `Constructors` elides the outer field in member and local classes, if the class doesn't use the outer reference. (Member classes also need to be final, which is a secret handshake to say we're also happy to weaken prefix matching in the pattern matcher.) That optimization leaves the constructor signature as is: the constructor still accepts the outer instance, but does not store it. For member classes, this means that we can separately compile code that calls the constructor. Local classes need not be hampered by this constraint, we could remove the outer instance from the constructor call too. Why would we want to do this? Let's look at the case before and after this commit. Before: ``` class C extends Object { def foo(): Function1 = $anonfun(); final <static> <artifact> def $anonfun$foo$1($this: C, x: Object): Object = new <$anon: Object>($this); def <init>(): C = { C.super.<init>(); () } }; final class anon$1 extends Object { def <init>($outer: C): <$anon: Object> = { anon$1.super.<init>(); () } } ``` After: ``` class C extends Object { def foo(): Function1 = $anonfun(); final <static> <artifact> def $anonfun$foo$1(x: Object): Object = new <$anon: Object>(null); def <init>(): C = { C.super.<init>(); () } }; final class anon$1 extends Object { def <init>($outer: C): <$anon: Object> = { anon$1.super.<init>(); () } } ``` However, the status quo means that a lambda that This in turn makes lambdas that refer to such classes serializable even when the outer class is not itself serialiable. I have not attempted to extend this to calls to secondary constructors.
* Add since arg to deprecationWarning and use itSimon Ochsenreither2016-05-294-4/+10
|
* SI-9084 Add `since` (if available) to deprecation warningsSimon Ochsenreither2016-05-281-1/+1
|
* Rename -Yopt to -opt, -Yopt-warnings to -opt-warningsLukas Rytz2016-05-252-2/+2
| | | | Keep -Yopt-inline-heuristics and -Yopt-trace unchanged
* Merge pull request #5175 from som-snytt/issue/9656-range-toStringStefan Zeiger2016-05-242-8/+8
|\ | | | | SI-9656 Distinguish Numeric with step type
| * SI-9656 Range.toString distinguishes Numeric stepSteve Robinson2016-05-192-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | For Range and NumericRange, toString will indicate the step if it is not 1. Additionally, indicate empty ranges and ranges which are not "exact". For a "mapped" range, used by `Range.Double`, toString includes the underlying range and the simple type of the step (to distinguish Double from BigDecimal).
* | Merge pull request #5164 from viktorklang/wip-future-docs-√Adriaan Moors2016-05-232-1/+32
|\ \ | |/ |/| Improve Future documentation (+ minor code cleanups)
| * Improves the test cases for the scala-concurrent-tckViktor Klang2016-05-132-1/+32
| |
* | Merge pull request #5103 from ruippeixotog/improve-list-map-set-perfLukas Rytz2016-05-172-8/+8
|\ \ | | | | | | Improve performance and behavior of ListMap and ListSet
| * | Make ListMap and ListSet implementations similarRui Gonçalves2016-05-172-4/+4
| | | | | | | | | | | | ListSet and ListMap are two collections which share the exact same internal structure. This commit makes the two approaches as similar as possible by renaming and reordering internal methods, improving their Scaladoc and their code style. The Scaladoc of the classes and companion objects is also improved in order to alert users of the time complexity of the collections' operations.
| * | Improve performance and behavior of ListMap and ListSetRui Gonçalves2016-05-172-4/+4
| |/ | | | | | | | | | | | | | | Makes the immutable `ListMap` and `ListSet` collections more alike one another, both in their semantics and in their performance. In terms of semantics, makes the `ListSet` iterator return the elements in their insertion order, as `ListMap` already does. While, as mentioned in SI-8985, `ListMap` and `ListSet` doesn't seem to make any guarantees in terms of iteration order, I believe users expect `ListSet` and `ListMap` to behave in the same way, particularly when they are implemented in the exact same way. In terms of performance, `ListSet` has a custom builder that avoids creation in O(N^2) time. However, this significantly reduces its performance in the creation of small sets, as its requires the instantiation and usage of an auxilliary HashSet. As `ListMap` and `ListSet` are only suitable for small sizes do to their performance characteristics, the builder is removed, the default `SetBuilder` being used instead.
* | Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2016-05-171-1/+1
|\ \ | |/ |/| | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20160517 Conflicts: build.sbt test/files/run/repl-javap-app.check test/files/run/repl-javap-app.scala
| * SI-9740 Repl import fix -Yrepl-class-basedSom Snytt2016-05-021-1/+1
| | | | | | | | | | | | | | Under `-Yrepl-class-based`, templating must follow the same scoping as under traditional object-based. The new test shows a typical case where two values of the same simple name must be imported in different scopes.
| * SI-9488 - adds the same default toString format to Scala Futures as 2.12.xViktor Klang2016-03-221-2/+18
| | | | | | | | Includes tests to verify the toString representations.
* | Remove references to trait impl classes, mostly in doc commentsLukas Rytz2016-04-072-1/+24
| |
* | Remove manual mixins in JFunctionN.v2.12.0-M3-dc9effeJason Zaugg2016-03-182-23/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These manual mixins were forwarding to the impl classes have just been removed. We can now rely on default methods instead. Update Tests: - Fix test/files/pos/t1237.scala, we can't have an outer field in an interface, always use the outer method. - Don't crash on meaningless trait early init fields test/files/neg/t2796.scala - Remove impl class relate parts of inner class test - Remove impl class relate parts of elidable test - Remove impl class related reflection test. - Remove test solely about trait impl classes renaming - Update check file with additional stub symbol error - Disable unstable parts of serialization test. - TODO explain, and reset the expectation
* | New trait encoding: use default methods, jettison impl classesJason Zaugg2016-03-182-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, concrete methods in traits were encoded with "trait implementation classes". - Such a trait would compile to two class files - the trait interface, a Java interface, and - the implementation class, containing "trait implementation methods" - trait implementation methods are static methods has an explicit self parameter. - some methods don't require addition of an interface method, such as private methods. Calls to these directly call the implementation method - classes that mixin a trait install "trait forwarders", which implement the abstract method in the interface by forwarding to the trait implementation method. The new encoding: - no longer emits trait implementation classes or trait implementation methods. - instead, concrete methods are simply retained in the interface, as JVM 8 default interface methods (the JVM spec changes in [JSR-335](http://download.oracle.com/otndocs/jcp/lambda-0_9_3-fr-eval-spec/index.html) pave the way) - use `invokespecial` to call private or particular super implementations of a method (rather `invokestatic`) - in cases when we `invokespecial` to a method in an indirect ancestor, we add that ancestor redundantly as a direct parent. We are investigating alternatives approaches here. - we still emit trait fowrarders, although we are [investigating](https://github.com/scala/scala-dev/issues/98) ways to only do this when the JVM would be unable to resolve the correct method using its rules for default method resolution. Here's an example: ``` trait T { println("T") def m1 = m2 private def m2 = "m2" } trait U extends T { println("T") override def m1 = super[T].m1 } class C extends U { println("C") def test = m1 } ``` The old and new encodings are displayed and diffed here: https://gist.github.com/retronym/f174d23f859f0e053580 Some notes in the implementation: - No need to filter members from class decls at all in AddInterfaces (although we do have to trigger side effecting info transformers) - We can now emit an EnclosingMethod attribute for classes nested in private trait methods - Created a factory method for an AST shape that is used in a number of places to symbolically bind to a particular super method without needed to specify the qualifier of the `Super` tree (which is too limiting, as it only allows you to refer to direct parents.) - I also found a similar tree shape created in Delambdafy, that is better expressed with an existing tree creation factory method, mkSuperInit.
* | Rewrite a few more tests to the new optimizerLukas Rytz2016-02-152-1/+1
| |
* | Merge remote-tracking branch 'origin/2.12.x' into ↵Jason Zaugg2016-02-045-29/+0
|\ \ | | | | | | | | | merge/2.11.x-to-2.12.x-20160203
| * | Re-write and Re-enable optimizer testsLukas Rytz2016-02-035-29/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite tests for new optimizer - SI-6941 - SI-2171 - t3430 - t3252 - t4840 - t2171 - t3430 - t3252 - t6157 - t6547 - t8062 - t8306 - t8359 - t9123 - trait-force-info - private-inline test cases for bugs fixed in the new optimizer - SI-9160, the unnecessary boxing mentioned in the ticket is optimzied since push-pop elimination (#4858). - SI-8796 - SI-8524 - SI-7807 fix flags file for t3420 remove an empty flags file remove unnecessary partest filters explicit inliner warnings in test t7582 Restore the lisp test. Removing the flags file - our build runs with the (new) optimizer enabled anyway. The test spent the past few years as an optimizer test in pos/ see https://issues.scala-lang.org/browse/SI-4512. The attempt may fail, but why not give it a try. $ git lg -S"lisp" ... | * | | | f785785 - SI-4579 Yoke the power of lisp.scala as a stress for the optimizer. (3 years, 8 months ago) <Jason Zaugg> ... * | | | | | | 622cc99 - Revert the lisp test. (3 years, 10 months ago) <Paul Phillips> ... * | | | | | | 97f0324 - Revived the lisp test. (3 years, 10 months ago) <Paul Phillips> ... * | 1e0f7dc - Imprison the lisp test, no review. (4 years, 4 months ago) <Paul Phillips> ... * | 6b09630 - "Freed the lisp test." Tweaked partest defaults... (4 years, 6 months ago) <Paul Phillips> ... * | fec42c1 - Lisp test wins again, no review. (4 years, 8 months ago) <Paul Phillips> ... * | 1c2d44d - Restored the lisp.scala test. (4 years, 8 months ago) <Paul Phillips> ... * | 15ed892 - Temporarily sending lisp.scala to be interprete... (4 years, 8 months ago) <Paul Phillips> ...
* | | Merge commit 'cc6fea6' into merge/2.11.x-to-2.12.x-20160203Jason Zaugg2016-02-041-1/+1
|\ \ \ | | |/ | |/| | | | | | | | | | Conflicts: build.sbt scripts/jobs/integrate/bootstrap
* | | Merge commit 'bf599bc' into merge/2.11.x-to-2.12.x-20160203Jason Zaugg2016-02-031-4/+5
|\| | | |/ |/| | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala src/compiler/scala/tools/nsc/transform/Constructors.scala src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala src/scaladoc/scala/tools/nsc/doc/html/resource/lib/jquery.layout.js
| * Make all of partest work in the sbt buildStefan Zeiger2015-12-041-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | - Fix the scoping of files/lib/*.jar. These files were not on the classpath when running partest from sbt. - Pass the same standard Java options to partest as from the command line. This requires new versions of scala-partest and scala-partest-interface. - Fix the classpath scanning in jvm/innerClassEnclMethodJavaReflection. It only worked for JARs and relative directories but not for absolute directory paths (which are produced by sbt).
* | Merge remote-tracking branch 'upstream/2.12.x' into opt/elimBoxesLukas Rytz2016-01-2423-249/+0
|\ \
| * | Remove GenASM, merge remaining common code snippetsSimon Ochsenreither2015-10-2723-249/+0
| | | | | | | | | | | | | | | | | | | | | | | | With GenBCode being the default and only supported backend for Java 8, we can get rid of GenASM. This commit also fixes/migrates/moves to pending/deletes tests which depended on GenASM before.
* | | SI-8601 Don't treat newarray as dead codeLukas Rytz2016-01-241-0/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise we lose the side effect of a `NegativeArraySizeException`. A test for this case already exists (run/t8601b.scala), but it currently enforces `-optimize -Ybackend:GenASM`, so it didn't trigger on the new backend. However, PR #4814 was merged into 2.12.x and moved that test over to the new backend and optimizer. After merging the 2.12.x into the current optimizer branch (push-pop elimination), the test started failing. Also disable the optimizer for `jvm/bytecode-test-example`: it counts the number of null checks in a method, the optimizer (rightly) eliminates one of the two.
* | Simplify and correctify calculation of the InnerClass attributeLukas Rytz2015-10-202-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The InnerClass attribute needs to contain an entry for every nested class that is defined or referenced in a class. Details are in a doc comment in BTypes.scala. Instead of collecting ClassBTypes of nested classes into a hash map during code generation, traverse the class before writing it out to disk. The previous approach was incorrect as soon as the generated bytecode was modified by the optimzier (DCE, inlining). Fixes https://github.com/scala/scala-dev/issues/21.
* | Merge commit '03aaf05' into merge-2.11-to-2.12-sep-22Lukas Rytz2015-09-221-5/+3
|\|
| * Update power mode bannerSom Snytt2015-09-021-5/+3
| | | | | | | | | | | | | | | | | | | | | | The classic banner is available under -Dscala.repl.power.banner=classic. ``` scala> :power Power mode enabled. :phase is at typer. import scala.tools.nsc._, intp.global._, definitions._ Try :help or completions for vals._ and power._ ```
* | Merge remote-tracking branch 'origin/2.11.x' into 2.12.xSeth Tisue2015-08-201-3/+3
|\| | | | | | | | | | | | | | | | | | | all conflicts were because the changes changed code that doesn't exist anymore in 2.12; they were resolved with `git checkout --ours` c201eac changed bincompat-forward.whitelist.conf but I dropped the change in this merge because it refers to AbstractPromise which no longer exists in 2.12
| * Merge pull request #4554 from som-snytt/issue/1931Seth Tisue2015-08-061-3/+3
| |\ | | | | | | SI-1931 Hide Predef.any2stringadd in REPL