summaryrefslogtreecommitdiff
path: root/test/files
Commit message (Collapse)AuthorAgeFilesLines
* SI-7006 Fix the unreachable testJames Iry2013-03-081-3/+3
| | | | | The unreachable test was missing the cases when Random.nextInt returned a negative number. This commit fixes that.
* Merge pull request #2216 from JamesIry/master_7231James Iry2013-03-082-0/+13
|\ | | | | SI-7231 Fix assertion when adapting Null type to Array type
| * SI-7231 Fix assertion when adapting Null type to Array typeJames Iry2013-03-082-0/+13
| | | | | | | | | | | | | | | | | | GenICode was doing a sanity check when adapting an expression of type Null to something else. It was just doing the wrong one. Instead of checking whether the result expression type was a reference type it was checking to see if it was an class reference type. This commit fixes that and adds a test to make sure both forms of adaptation work as expected.
* | Merge pull request #2185 from JamesIry/master_unreachableGrzegorz Kossakowski2013-03-086-76/+337
|\ \ | |/ |/| SI-7006 Prevent unreachable blocks in GenICode
| * SI-7006 Prevent unreachable blocks in GenICodeJames Iry2013-03-066-76/+337
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes GenICode prevent the generation of most unreachable blocks. The new unreachable block prevention code can be disabled with a compiler flag. Because full unreachable analysis is no longer necessary for normal code it makes the unreachable block analysis run only under -optimise. A test is included to make sure unreachable code doesn't cause issues in code gen. A concrete example will help. def foo(): X = { try return something() catch { case e: Throwable => println(e) throw e } unreachableCode() ] Here unreachableCode() is unreachable but GenICode would create ICode for it and then ASM would turn it into a pile of NOPS. A previous commit added a reachability analysis step to eliminate that unreachable code but that added a bit of time to the compilation process even when optimization was turned off. This commit avoids generating most unreachable ICode in the first place so that full reachability analysis is only needed after doing other optimization work. The new code works by extending a mechanism that was already in place. When GenICode encountered a THROW or RETURN it would put the current block into "ignore" mode so that no further instructions would be written into the block. However, that ignore mode flag was itself ignored when it came to figuring out if follow on blocks should be written. So this commit goes through places like try/catch and if/else and uses the ignore mode of the current block to decide whether to create follow on blocks, or if it already has, to kill by putting them into ignore mode and closing them where they'll be removed from the method's list of active blocks. It's not quite as good as full reachability analysis. In particular because a label def can be emitted before anything that jumps to it, this simple logic is forced to leave label defs alone and that means some of them may be unreachable without being removed. However, in practice it gets close the the benefit of reachability analysis at very nearly no cost.
* | Merge pull request #2204 from adriaanm/merge-2.10.xPaul Phillips2013-03-0616-84/+276
|\ \ | |/ |/| Merge 2.10.x into master
| * Merge 2.10.x into master.Adriaan Moors2013-03-058-84/+120
| |\ | | | | | | | | | | | | | | | | | | | | | Resurrect some undead code from 373ded2ad3 (tuple2Pickler). Conflicts: src/compiler/scala/tools/nsc/interactive/CompilerControl.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala
| | * Merge pull request #2199 from retronym/ticket/7214Adriaan Moors2013-03-051-0/+57
| | |\ | | | | | | | | SI-7214 outer check based on dealiased pattern type.
| | * \ Merge pull request #2156 from vigdorchik/hierarchyAdriaan Moors2013-03-056-84/+106
| | |\ \ | | | | | | | | | | SI-7109 SI-7153 Generalize the API to get docComments: allow to force do...
| | | * | SI-7109 SI-7153 Generalize the API to get docComments: allow to force docTreesEugene Vigdorchik2013-02-246-84/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for given fragments. Don't type-check when forcing doc comments, but rather do it directly. Test the new functionality as well as better tests for the old one.
| | * | | Merge pull request #2193 from adriaanm/patmat-refactorAdriaan Moors2013-03-056-63/+25
| | |\ \ \ | | | | | | | | | | | | merge 2.10.1 into 2.10.x
| | | * \ \ Merge 2.10.1 into 2.10.xAdriaan Moors2013-03-034-63/+11
| | | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix for SI-7183 in 440bf0a8c2 was forward ported in f73d50f46c. Conflicts: src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
| | | | * | | [nomaster] SI-7195 minor version mustn't introduce warningsAdriaan Moors2013-03-013-63/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want 2.10.1 to be a drop-in replacement for 2.10.0, so we can't start warning where we weren't warning in 2.10.0. See SI-5954 (#1882, #2079) for when it was an implementation restriction, which was then weakened to a warning. It's now hidden behind -Ydebug.
| | | | * | | Merge pull request #2168 from retronym/ticket/7183Adriaan Moors2013-03-012-0/+14
| | | | |\ \ \ | | | | | | | | | | | | | | | | SI-7183 Disable unreachability for withFilter matches.
| | | | | * | | SI-7183 Disable unreachability for withFilter matches.Jason Zaugg2013-02-252-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids spurious unreachable warnings on code that the user didn't write. The parser desugars for-comprehensions such as: for (A(a) <- List(new A)) yield a To: List(new A()).withFilter(((check$ifrefutable$2) => check$ifrefutable$2: @scala.unhecked match { case A((a @ _)) => true case _ => false }) ) But, if `A.unapply` returns `Some[_]`, the last case is dead code. (Matching against a regular case class *would* fall through in the caes of a null scrutinee.) In SI-6902, we enabled unreachability warnings, even if the scrutinee was annotated as @unchecked. That was consistent with the 2.9.2 behaviour, it was only disabled temporarily (actually, accidentally) in 2.10.0. But, the old pattern matcher didn't warn about this code. This commit makes the pattern matcher recognise the special scrutinee based on its name and disables both exhaustivity *and* unreachability analysis. To do so, the we generalize the boolean flag `unchecked` to the class `Suppression`.
| | | * | | | | [port] SI-7183 Disable unreachability for withFilter matches.Adriaan Moors2013-03-032-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a forward port of #2168 (originally for 2.10.1, but the pattern matcher has since been refactored in 2.10.x.)
| * | | | | | | Merge 2.10.x into master.Adriaan Moors2013-03-051-0/+6
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/library/scala/collection/mutable/ArrayOps.scala
| | * | | | | | Merge pull request #2198 from retronym/ticket/7215Paul Phillips2013-03-051-0/+6
| | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-7215 Fix transpose of an empty Array[Array[T]].
| | | * | | | | | SI-7215 Fix transpose of an empty Array[Array[T]].Jason Zaugg2013-03-051-0/+6
| | | | | | | | |
| | * | | | | | | Merge pull request #2175 from retronym/ticket/7185Paul Phillips2013-03-054-0/+56
| | |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-7185 Avoid NPE in TreeInfo.isExprSafeToInline
| * | | | | | | | | Merge 2.10.x into master.Adriaan Moors2013-03-051-0/+26
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/transform/Erasure.scala
| | * | | | | | | | Merge pull request #2178 from scalamacros/ticket/7190Paul Phillips2013-03-051-0/+26
| | |\ \ \ \ \ \ \ \ | | | |_|_|/ / / / / | | |/| | | | | | | SI-7190 macros no longer give rise to bridges
| | | * | | | | | | SI-7190 macros no longer give rise to bridgesEugene Burmako2013-02-271-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amazingly enough, this got through all the testing we performed. But now erasure knows that it shouldn't generate bridges for macro methods.
| | | | | | | | | |
| | \ \ \ \ \ \ \ \
| | \ \ \ \ \ \ \ \
| | \ \ \ \ \ \ \ \
| | \ \ \ \ \ \ \ \
| | \ \ \ \ \ \ \ \
| *-----. \ \ \ \ \ \ \ \ Merge 2.10.x into master.Adriaan Moors2013-03-056-0/+124
| |\ \ \ \ \ \ \ \ \ \ \ \ | | | |_|_|/ / / / / / / / | | |/| | | | / / / / / / | | | | |_|_|/ / / / / / | | | |/| | | | / / / / | | | | | |_|_|/ / / / | | | | |/| | | | | / | | | | | | |_|_|_|/ | | | | | |/| | | | Fix check file for run/t7185.
| | | | | * | | | | SI-7214 outer check based on dealiased pattern type.Jason Zaugg2013-03-051-0/+57
| | | | | | |/ / / | | | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A Typed Pattern (_: T) is more than `.isInstanceOf`: if `T` is a path dependent type, the scrutinee's $outer reference is also compared against the prefix of `T`. The code that synthesises this is split into two places. `needsOuterCheck` determines whether to add this check, based on the type `T`, and the type of the scrutinee. If it gives the go-ahead, `treeCondStrategy.outerCheck` synthesizes the check. The new test case demonstrates the problems caused by the failure to dealias in `needsOuterCheck`: it could either wrongly lead to synthesis of an outer test (which would crash), or wrongly omit the outer test (meaning overly liberal matching.) A simple `dealias` remedies this. `dealiasWiden` is *not* appropriate here; we need to keep hold of singleton types. I'll also note that there is already a little slack between these methods, as commented: > ExplicitOuter replaces `Select(q, outerSym) OBJ_EQ expectedPrefix` > by `Select(q, > outerAccessor(outerSym.owner)) OBJ_EQ expectedPrefix` > if there's an outer accessor, otherwise the condition becomes `true` > TODO: can we improve needsOuterTest so there's always an outerAccessor? So this is probably a fragile area that warrants a careful review with a view to design improvements.
| | | | * | | | | Merge pull request #2167 from retronym/ticket/7126Adriaan Moors2013-03-011-0/+11
| | | | |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-7126 Account for the alias types that don't dealias.
| | | | | * | | | | SI-7126 Account for the alias types that don't dealias.Jason Zaugg2013-02-251-0/+11
| | | | | | |_|/ / | | | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After this change: qbin/scalac -Ydebug test/files/pos/t7126.scala 2>&1 | grep warning warning: dropExistential did not progress dealiasing Test.this.T[Test.this.T], see SI-7126 one warning found T[T]? Really? The true bug lies somewhere else; the comments of the ticket illuminate the general areas of concern.
| | | * | | | | | SI-7185 Avoid NPE in TreeInfo.isExprSafeToInlineJason Zaugg2013-03-024-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We got there typechecking code with a redundant layer of Block. We can't express that in source code, so we test this with manual tree construction and with XML literals, which as reported produce such trees.
| | * | | | | | | Merge pull request #2184 from adriaanm/revert-pr-2083Adriaan Moors2013-03-018-2071/+0
| | |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Revert SI-6240 synchronization for runtime reflection
| | | * | | | | | | Revert SI-6240 synchronization for runtime reflectionAdriaan Moors2013-03-018-2071/+0
| | | | |_|_|/ / / | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit reverts #2083: - 387b2590db runtime reflection: death from thousand threads - 73d079fb38 removes the assertion in missingHook - f4dd56ca5d synchronizes names - dd148de5a8 synchronizes pendingVolatiles - 4cbb9357c5 synchronizes toolboxes - 07bcb6176a SI-7045 reflection now auto-initializes selfType - bebd62d566 optimizes Scala reflection GIL - 735634f1d6 initializes lazy vals and inner objects in advance - 5b37cfb19a introduces GIL to Scala reflection - 981da8edfc cleans up initialization of runtime reflection - b2c2493b22 reflection no longer uses atPhase and friends - a9dca512d8 synchronizes symbols - 0262941b3c removes the crazy extraneous log - 21d5d3820b moves Symbol#SymbolKind to Symbols
| | * | | | | | | Merge pull request #2179 from adriaanm/merge-2.10.1Adriaan Moors2013-03-019-55/+119
| | |\ \ \ \ \ \ \ | | | |/ / / / / / | | |/| | | | | | Merge 2.10.1 into 2.10.x
| | * | | | | | | Merge pull request #2083 from scalamacros/ticket/6240Adriaan Moors2013-02-278-0/+2071
| | |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-6240 synchronization for runtime reflection
| | | * | | | | | | runtime reflection: death from thousand threadsEugene Burmako2013-02-114-0/+2051
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | not anymore
| | | * | | | | | | SI-7045 reflection now auto-initializes selfTypeEugene Burmako2013-02-112-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | selfType joins the happy family of flags, annotations and privateWithin, which automatically trigger initialization, when used within runtime reflection.
| | | * | | | | | | removes the crazy extraneous logEugene Burmako2013-02-112-0/+6
| | | | | | | | | |
* | | | | | | | | | Add option to disable optimizationJames Iry2013-03-054-1/+33
|/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default we run par test under -optimise. But occasionally we need to test optimizations in isolation. This commit adds a Ynooptimise flag that turns the optimize flags off back off after they've been turned on. A test is included to ensure that -Ynooptimise turns off optimizations and an existing test is modified to show that optimizations coming after -Ynooptimise in command line are enabled.
* | | | | | | | | Check named-args-for-clarity incur no extra bytecodeJason Zaugg2013-03-053-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When named arguments correspond the the parameter declaration order, the compiler should not lift out assignments before the method call, as it would have to do for out-of-order arguments. Confirm this with a bytecode comparison test.
* | | | | | | | | Merge pull request #2197 from paulp/pr/integrate-range-positionsJames Iry2013-03-051-1/+2
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Integrate range positions.
| * | | | | | | | | Disentangled RangePositions from interactive.Paul Phillips2013-03-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a stepping stone to having range positions all the time, as well as to modularizing the presentation compiler. It does not enable range positions by default, only places them smoewhere where they can be.
* | | | | | | | | | Merge pull request #2195 from vigdorchik/lint_libraryPaul Phillips2013-03-051-3/+3
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Changes around lint
| * | | | | | | | | | Since the problem in SI-6758 is fixed, it's ok to move checking for unused ↵Eugene Vigdorchik2013-03-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | imports to Analyzer. This allows the check to be used in the IDE.
* | | | | | | | | | | Merge pull request #2191 from mergeconflict/SI-7132Paul Phillips2013-03-052-10/+15
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | SI-7132 - don't discard Unit type in interpreter
| * | | | | | | | | | | SI-7132 - don't discard Unit type in interpreterDan Rosen2013-03-022-10/+15
| | |/ / / / / / / / / | |/| | | | | | | | |
* / | | | | | | | | | SI-6816 Deprecate -Yeta-expand-keeps-starJames Iry2013-03-013-0/+13
|/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit deprecates the -Yeta-expand-keeps-star flag. It was created in 2.10 to help in the transition from 2.9 but by the time 2.11 comes out it should no longer be necessary.
* | | | | | | | | | Merge pull request #2180 from adriaanm/merge-2.10.1-masterAdriaan Moors2013-03-018-0/+80
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Merge 2.10.1 into master
| * \ \ \ \ \ \ \ \ \ Merge branch 2.10.1 into masterAdriaan Moors2013-02-278-0/+80
| |\ \ \ \ \ \ \ \ \ \ | | | |_|_|/ / / / / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/ast/Trees.scala src/library/scala/concurrent/impl/ExecutionContextImpl.scala
| | * | | | | | | | | Merge 2.10.1 into 2.10.x.Adriaan Moors2013-02-279-55/+119
| | |\ \ \ \ \ \ \ \ \ | | | |_|/ / / / / / / | | |/| | | | / / / / | | | | |_|_|/ / / / | | | |/| | | | | |
| | | * | | | | | | Merge pull request #2160 from scalamacros/topic/7112-followup-2101v2.10.1-RC2Adriaan Moors2013-02-251-1/+1
| | | |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | fixes the test for SI-7112
| | | | * | | | | | | fixes the test for SI-7112Eugene Burmako2013-02-231-1/+1
| | | | | |_|_|/ / / | | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Freshly released Java 1.6.0_41 for OSX fails with "IllegalAccessError: tried to access class JavaSimpleEnumeration_1 from class sun.proxy.$Proxy6", and rightfully so, because that class isn't public. I think I will avoid the usual "how could this even work before" in this commit message.
| | | * / | | | | | SI-7180 Fix regression in implicit scope of HK type alias.Jason Zaugg2013-02-251-0/+13
| | | |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We actually need to call normalize here, otherwise we don't progress through #1 below. [infer implicit] scala.this.Predef.implicitly[Higher[Foo.Bar]] with pt=Higher[Foo.Bar] in object Foo 1. tp=Foo.Bar tp.normalize=[A <: <?>]Foo.Bar[A] tp.dealias=Foo.Bar 2. tp=Foo.Bar[A] tp.normalize=Box[A] tp.dealias=Box[A]