summaryrefslogtreecommitdiff
path: root/test/junit
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #5102 from milessabin/2.12.xJason Zaugg2016-05-271-3/+3
|\ | | | | SI-2712 Add support for partial unification of type constructors
| * -Xexperimental mode now only includes -Ypartial-unificationMiles Sabin2016-05-241-3/+3
| |
* | Merge pull request #5186 from lrytz/inlinerM5Jason Zaugg2016-05-271-5/+5
|\ \ | | | | | | Debug flag to print a summary of the inliner's work
| * | Debug flag to print a summary of the inliner's workLukas Rytz2016-05-241-5/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example output below. Note that inlining List.map fails because the trait forwarder uses `INVOKESPECIAL` for now, will change with pr 5177. $ cat Test.scala class C { def foo = Map(1 -> 'a', 2 -> 'b') def bar(l: List[Int]) = l.map(_ + 1) } $ qsc -Yopt-log-inline _ -Yopt:l:classpath Test.scala Inlining into C.foo (initially 36 instructions, ultimately 72): - Inlined scala/Predef$ArrowAssoc$.$minus$greater$extension (8 instructions) 2 times: the callee is annotated `@inline` Inlining into C.bar (initially 12 instructions, ultimately 12): - Failed to inline scala/collection/immutable/List.map (the callee is a higher-order method, the argument for parameter (bf: Function1) is a function literal): The callee scala/collection/immutable/List::map(Lscala/Function1;Lscala/collection/generic/CanBuildFrom;)Ljava/lang/Object; contains the instruction INVOKESPECIAL scala/collection/TraversableLike.map (Lscala/Function1;Lscala/collection/generic/CanBuildFrom;)Ljava/lang/Object; that would cause an IllegalAccessError when inlined into class C.
* | Merge pull request #5192 from dwijnand/wip/scala-repl-no-importsJason Zaugg2016-05-271-0/+19
|\ \ | | | | | | Fully qualify types in REPL generated code
| * | Fully qualify types in REPL generated codeDale Wijnand2016-05-261-0/+19
| | |
* | | Rename -Yopt to -opt, -Yopt-warnings to -opt-warningsLukas Rytz2016-05-2521-33/+33
|/ / | | | | | | Keep -Yopt-inline-heuristics and -Yopt-trace unchanged
* / SI-9522 release key reference when deleting from OpenHashMapPerformant Data LLC2016-05-241-1/+57
|/ | | | | | | | | This sets the key field in the hash table entry to its default value when an entry is deleted, so as not to unexpectedly retain an object reference, leading to a memory leak. Also includes incidental changes to the slot location algorithm that reduce the number of deleted entries.
* SI-9121 test case (fixed in new optimizer), SI-9179 test caseLukas Rytz2016-05-232-0/+54
| | | | | Also adds a mising phase travel in the backend. A comment already points out why it's necessary, but it was actually forgotten.
* Merge pull request #5180 from lrytz/junit-passJason Zaugg2016-05-2346-2036/+2051
|\ | | | | Clean up JUnit tests, make sure they pass without bootstrap [ci: last-only]
| * Adapt naming convention for collection.convert null safety testLukas Rytz2016-05-203-279/+286
| | | | | | | | | | | | | | Test classes not ending in "Test" are not executed in sbt. IntelliJ runs them. After this patch: 803 tests executed both in sbt and junit.
| * All JUnit tests pass without bootstrap (when run in intellij, sbt)Lukas Rytz2016-05-203-92/+123
| |
| * Split RunTest and BytecodeTest into parts, put in matching packages.Lukas Rytz2016-05-2013-610/+660
| |
| * Cleanup in BytecodeTestLukas Rytz2016-05-201-28/+20
| |
| * Small cleanup in JUnit testLukas Rytz2016-05-201-5/+1
| |
| * Clean up bytecode testing methods.Lukas Rytz2016-05-2022-462/+496
| |
| * Better abstraction for JUnit run testsLukas Rytz2016-05-202-11/+22
| |
| * Better abstraction for bytecode tests. Also organize some imports.Lukas Rytz2016-05-2030-555/+453
| |
| * Rename nsc.backend.jvm.CodeGenTools to testing.BytecodeTestingLukas Rytz2016-05-2030-39/+35
| |
* | SI-7916: ScriptEngine supportSom Snytt2016-05-191-0/+83
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the ScriptEngine support to an adaptor atop the IMain API. Allow references to resolve to context attributes. (The attributes must be defined at compilation time, though they may resolve to updated values at evaluation time.) This means that attributes are not bound statically in REPL history. In particular, we forgo the trick of binding attributes named "name: Type" as typed values. Instead, an `x` bound in dynamic context is injected into the script as a dynamic selection `$ctx.x` where `ctx` performs the look-up in the script context. When a compiled script is re-evaluated, a new instance of the script class is created and defined symbols are rebound. The context stdout writer is handled with `Console.withOut`, with bytes decoded using the default charset. Compilation errors are thrown as ScriptException with the first reported error. This commit doesn't attempt dynamic selection from objects in context. Currently, script must cast.
* SI-9066 fix null.asInstanceOf[Unit]Lukas Rytz2016-05-182-23/+23
|
* SI-9671, SI-7397 fix null.asInstanceOf[Int] when pt erases to ObjectLukas Rytz2016-05-183-10/+116
| | | | | | | | | | | | | | Erasure first replaces null.asInstanceOf[Int] by unbox(null). If the expected type erases to object, erasure then introduces a box operation, yielding box(unbox(null)). Note that this value is a box of zero, not null. Erasure has an optimization to replace box(unbox(x)) in case x is of primitive type. 60f1b4b extended this to the case when x is null, which is incorrect in general. The reason was to prevent creating a primitive box to be stored in the unused generic field when creating an instance of a specialized class. A special case ensures that this optimization is still performed.
* Merge pull request #5103 from ruippeixotog/improve-list-map-set-perfLukas Rytz2016-05-172-0/+101
|\ | | | | Improve performance and behavior of ListMap and ListSet
| * Improve performance and behavior of ListMap and ListSetRui Gonçalves2016-05-172-0/+101
| | | | | | | | | | | | | | | | 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.
* | Reduce boilerplate in compiler JUnit tests (#5158)Jason Zaugg2016-05-1625-258/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many JUnit tests share a compiler instance between all test cases in a class to reduce overhead. This commit refactors the mechanism to reduce the boilerplate. In the new scheme: - Using the `@ClassRule` hook in JUnit, we create a per-class map for each test class. - Per-class values are registered from the test class itself by calling `cached("someKey", () => mkExpensiveThing)` - At the end of the test, the entries in this map are `close()`-ed (if they implement `Closable`), and are released for garbage collection.)
* | SI-9666: Use inline group names in Regex (#4990)som-snytt2016-05-111-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Delegate `Match group name` to the underlying `matcher`. If that fails, try explicit group names as a fall back. No attempt is made to correlate inline and explicit names. In the following case, either name is accepted: ``` new Regex("a(?<Bar>b*)c", "Bee") ``` But if names are reversed, the error is undetected: ``` new Regex("a(?<Bee>b*)(?<Bar>c)", "Bar", "Bee") ``` Throw IllegalArg on bad group name to be consistent with Java.
* | Merge pull request #5112 from lrytz/dropRecursiveClasspathJason Zaugg2016-05-054-232/+24
|\ \ | | | | | | Remove legacy recursive classpath implementation
| * | Remove abstraction layer in classpath implementationLukas Rytz2016-05-023-29/+24
| | |
| * | remove recursive classpath implementationLukas Rytz2016-04-233-206/+3
| | |
* | | Merge pull request #5132 from acdenhartog/patch-1Jason Zaugg2016-05-051-0/+7
|\ \ \ | | | | | | | | Avoid function chaining with reverse method
| * | | test PriorityQueue.reverseArno den Hartog2016-05-021-0/+7
| | | |
* | | | Merge pull request #5140 from lrytz/inlineDefaultMethodsJason Zaugg2016-05-053-12/+39
|\ \ \ \ | |_|_|/ |/| | | SD-140 inline the correct default method
| * | | SD-140 inline the correct default methodLukas Rytz2016-04-283-12/+39
| |/ / | | | | | | | | | | | | When inheriting multiple default methods, select the correct one to inline. Implements method resolution according to the JVM spec.
* | | Merge pull request #5094 from lrytz/classOfUnitAdriaan Moors2016-04-271-0/+12
|\ \ \ | |/ / |/| | Fix erasure for classOf[Unit], don't erase to classOf[BoxedUnit]
| * | Fix erasure for classOf[Unit], don't erase to classOf[BoxedUnit]Lukas Rytz2016-04-201-0/+12
| |/
* / SI-9684 Deprecate JavaConversionsSom Snytt2016-04-2213-13/+13
|/ | | | | | | | | Implicit conversions are now in package convert as ImplicitConversions, ImplicitConversionsToScala and ImplicitConversionsToJava. Deprecated WrapAsJava, WrapAsScala and the values in package object. Improve documentation.
* Merge pull request #5096 from lrytz/traitParentsLukas Rytz2016-04-207-56/+313
|\ | | | | Ensure ClassBTypes constructed from symbol and classfile are identical
| * Ensure that lzycompute methods are entered into the scopeLukas Rytz2016-04-201-2/+14
| | | | | | | | | | For some reason this was not the case, leading to spurious inliner warnings (no inline info found for method O$lzycompute).
| * Ensure ClassBTypes constructed from symbol and classfile are identicalLukas Rytz2016-04-201-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A super call (invokespecial) to a default method T.m is only allowed if the interface T is a direct parent of the class. Super calls are introduced for example in Mixin when generating forwarder methods: trait T { override def clone(): Object = "hi" } trait U extends T class C extends U The class C gets a forwarder that invokes T.clone(). During code generation the interface T is added as direct parent to class C. Note that T is not a (direct) parent in the frontend type of class C. This commit stores interfaces that are added to a class during code generation in the InlineInfo classfile attribute. This allows filtering the interface list when constructing a ClassBType from a classfile.
| * Clean up code gen for method invocationsLukas Rytz2016-04-203-6/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code was patched many times in the history and became a bit scattered. When emitting a virtual call, the receiver in the bytecode cannot just be the method's owner (the class in which it is declared), because that class may not be accessible at the callsite. Instead we use the type of the receiver. This was basically done to fix - aladdin bug 455 (9954eaf) - SI-1430 (0bea2ab) - basically the same bug, slightly different - SI-4283 (8707c9e) - the same for field reads In this patch we extend the fix to field writes, and clean up the code. This patch basically reverts 6eb55d4b, the fix for SI-4560, which was rather a workaround than a fix. The underlying problem was that in some cases, in a method invocation `foo.bar()`, the method `bar` was not actually a member of `foo.tpe`, causing a NoSuchMethodErrors. The issue was related to trait implementation classes. The idea of the fix was to check, at code-gen time, `foo.tpe.member("bar")`, and if that returns `NoSymbol`, use `barSym.owner`. With the new trait encoding the underlying problem seems to be fixed - all tests still pass (run/t4560.scala and run/t4560b.scala).
| * SD-98 don't emit unnecessary mixin forwardersLukas Rytz2016-04-123-21/+139
| | | | | | | | | | | | | | | | In most cases when a class inherits a concrete method from a trait we don't need to generate a forwarder to the default method in the class. t5148 is moved to pos as it compiles without error now. the error message ("missing or invalid dependency") is still tested by t6440b.
| * Rewrite JUnit tests to avoid `@Test` methods in traitsLukas Rytz2016-04-121-14/+12
| | | | | | | | | | | | | | | | | | JUnit 4 does not support running `@Test` methods defined as default methods in parent interfaces. JUnit 5 will, but is not yet available. Currently scalac emits a forwarder to every trait method inherited by a class, so tests are correctly executed. The fix for SD-98 will change this.
* | Merge pull request #5100 from lrytz/unitBoxLukas Rytz2016-04-201-0/+119
|\ \ | | | | | | SI-6710 / PR 5072 follow-up: fix Unit.box / Unit.unbox
| * | SI-6710 / PR 5072 follow-up: fix Unit.box / Unit.unboxLukas Rytz2016-04-201-0/+119
| |/ | | | | | | | | | | | | The backend replaces .box / .unbox methods by corresponding invocations to BoxesRunTime, but not for Unit. This commit restores the body of `Unit.box` and `Unit.unbox`.
* / Hide ScalaRunTime.isTuple inside stringOf.Sébastien Doeraene2016-04-131-61/+4
|/ | | | Because it is otherwise unused.
* Fix InlineInfo attribute for nested module accessorsLukas Rytz2016-04-071-29/+67
|
* Remove unused optimizer warnings related to trait impl classesLukas Rytz2016-04-041-24/+0
|
* Remove dead code in the optimizer related to trait impl classesLukas Rytz2016-04-041-21/+20
|
* Merge pull request #5071 from janekdb/topic/2.12.x-scaladoc-ExceptionsLukas Rytz2016-04-011-0/+42
|\ | | | | Add initial unit test for Catch and augment documentation
| * Add initial unit test for Catch and augment documentationJanek Bogucki2016-03-311-0/+42
| | | | | | | | | | | | - Add unit test for andFinally - Reduce code duplication in andFinally - Extend documentation