summaryrefslogtreecommitdiff
path: root/test/junit
Commit message (Collapse)AuthorAgeFilesLines
...
| * GenBCode: Tests for combined method-level optimizationsLukas Rytz2014-11-042-0/+88
| |
| * GenBCode: Command-line flags for enabling cleanup optimizationsLukas Rytz2014-11-046-85/+81
| | | | | | | | | | | | | | | | | | | | Add command-line flags `Yopt:...` for simplifying jumps, eliminating stale line number and label nodes. `LocalOpt.methodOptimizations` applies all enabled intra-method optimizations in the right order. Some cleanups for unreachable code elimination and its tests.
| * GenBCode: Eliminate redundant labels and line number nodesLukas Rytz2014-11-041-0/+101
| | | | | | | | | | | | | | | | | | Cleanup optimizations - remove line number nodes that describe no executable instructions - squash sequences of label nodes, remove unreferenced labels Command-line flags that allow enabling these transformations are added in a later comimt.
| * GenBCode: Simplify branching instructionsLukas Rytz2014-11-041-0/+221
| | | | | | | | | | | | | | | | | | | | This commit implements simplifications to branching instructions, for example `CondJump l; GOTO l` is replaced by `POP; GOTO l`. The individual optimizations are explained in doc comments. A later commit will add compiler flags to allow enabling the new optimizations.
* | Merge pull request #4083 from retronym/ticket/8947Jason Zaugg2014-11-071-0/+12
|\ \ | | | | | | SI-8947 Avoid cross talk between tag materializers and reify
| * | SI-8947 Avoid cross talk between tag materializers and reifyJason Zaugg2014-10-301-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After a macro has been expanded, the expandee are expansion are bidirectionally linked with tree attachments. Reify uses the back reference to replace the expansion with the expandee in the reified tree. It also has some special cases to replace calls to macros defined in scala-compiler.jar with `Predef.implicitly[XxxTag[T]]`. This logic lives in `Reshape`. However, the expansion of a macro may be `EmptyTree`. This is the case when a tag materializer macro fails. User defined macros could do the also expand to `EmptyTree`. In the enclosed test case, the error message that the tag materializer issued ("cannot materialize class tag for unsplicable type") is not displayed as the typechecker finds another means of making the surrounding expression typecheck. However, the macro engine attaches a backreference to the materializer macro on `EmpytyTree`! Later, when `reify` reshapes a tree, every occurance of `EmptyTree` will be replaced by a call to `implicitly`. This commit expands the domain of `CannotHaveAttrs`, which is mixed in to `EmptyTree`. It silently ignores all attempts to mutate attachments. Unlike similar code that discards mutations of its type and position, I have refrained from issuing a developer warning in this case, as to silence this I would need to go and add a special case at any places adding attachments.
* | | Merge pull request #4017 from lrytz/t6541Lukas Rytz2014-11-051-0/+16
|\ \ \ | | | | | | | | SI-6541 valid wildcard existentials for case-module-unapply
| * | | Fix default value for ScalaVersionSettingLukas Rytz2014-11-041-0/+16
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default value was NoScalaVersion before, because tryToSet (where the default was supposed to be set) is not called at all if the option is not specified. The initial value of Xmigration is set to NoScalaVersion (which it was before, the AnyScalaVersion argument was ignored). AnyScalaVersion would be wrong, it would give a warning in `Map(1 -> "eis").values` if the option was not specified. See tests.
* | | Merge pull request #4046 from gourlaysama/wip/t8711-version-unparseLukas Rytz2014-11-041-0/+18
|\ \ \ | |_|/ |/| | SI-8711 ScalaVersion.unparse doesn't produce valid versions
| * | SI-8711 ScalaVersion.unparse doesn't produce valid versionsAntoine Gourlay2014-10-131-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no dot between `major.minor.rev` and `-build` in a scala version, yet that's what unparse returns for ``` // was "2.11.3.-SNAPSHOT" ScalaVersion("2.11.3-SNAPSHOT").unparse ```
* | | Merge pull request #4052 from Lymia/issue/8910Jason Zaugg2014-11-041-0/+22
|\ \ \ | | | | | | | | SI-8910 BitSet sometimes uses exponential memory.
| * | | SI-8910 BitSet sometimes uses exponential memory.Alissa Rao2014-10-151-0/+22
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because of an off-by-one error in scala.collection.mutable.BitSet, where a function (ensureCapacity) is passed a list length instead of an index, when ^=, &=, |=, or &~= are passed BitSets with the same internal capacity as the set the method is being invoked on, the size of the first BitSet is needlessly doubled. This patch simply changes the ensureCapacity calls to pass the last index of the list, instead of the raw length. In addition, add documentation to ensureCapacity to try and stop something similar from happening in the future.
* | | Merge pull request #4045 from gourlaysama/wip/t8875-show-codeJason Zaugg2014-11-041-0/+7
|\ \ \ | |_|/ |/| | SI-8875 showCode should print all class constructor modifiers.
| * | SI-8875 showCode should print all class constructor modifiers.Antoine Gourlay2014-10-241-0/+7
| |/ | | | | | | | | showCode used to print nothing when the only modifier was a change in visibility scope (i.e. no flags but privateWithin is set).
* | Merge pull request #4067 from lrytz/t8926Grzegorz Kossakowski2014-10-201-0/+41
|\ \ | | | | | | SI-8926 default visbility RUNTIME for java annotations
| * | SI-8926 default visbility RUNTIME for java annotationsLukas Rytz2014-10-201-0/+41
| |/ | | | | | | | | | | | | | | | | | | | | When parsed from source, java annotation class symbol are lacking the `@Retention` annotation. In mixed compilation, java annotations are therefore emitted with visibility CLASS. This patch conservatively uses the RUNTIME visibility in case there is no @Retention annotation. The real solution is to fix the Java parser, logged in SI-8928.
* / [nomerge] SI-8899 Revert "SI-8627 make Stream.filterNot non-eager"Lukas Rytz2014-10-121-18/+0
|/ | | | | | | | | This reverts commit 9276a1205f74fdec74206209712831913e93f359. The change is not binary compatible, See discussion on SI-8899. Making filterImpl non-private changes its call-sites (within TraversableLike) from INVOKESTATIC to INVOKEINTERFACE. Subclasses of TraversableLike compiled before this change don't have a mixin for filterImpl.
* Merge pull request #4030 from som-snytt/issue/8843Grzegorz Kossakowski2014-10-072-3/+141
|\ | | | | SI-8843 AbsFileCL acts like a CL
| * SI-8843 AbsFileCL acts like a CLSom Snytt2014-10-062-3/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let the AbstractFileClassLoader override just the usual suspects. Normal delegation behavior should ensue. That's instead of overriding `getResourceAsStream`, which was intended that "The repl classloader now works more like you'd expect a classloader to." (Workaround for "Don't know how to construct an URL for something which exists only in memory.") Also override `findResources` so that `getResources` does the obvious thing, namely, return one iff `getResource` does. The translating class loader for REPL only special-cases `foo.class`: as a fallback, take `foo` as `$line42.$read$something$foo` and try that class file. That's the use case for "works like you'd expect it to." There was a previous fix to ensure `getResource` doesn't take a class name. The convenience behavior, that `classBytes` takes either a class name or a resource path ending in ".class", has been promoted to `ScalaClassLoader`.
* | Merge pull request #4016 from lrytz/t8731Grzegorz Kossakowski2014-10-072-0/+42
|\ \ | |/ |/| SI-8731 warning if @switch is ignored
| * SI-8731 warning if @switch is ignoredLukas Rytz2014-10-062-0/+42
| | | | | | | | | | For matches with two or fewer cases, @switch is ignored. This should not happen silently.
* | Better ant / junit interactionAntoine Gourlay2014-09-2912-6/+3
|/ | | | | | | | | | | | | Currently junit test sources are always rebuilt, that's wasteful. The second dependency on the junit task is there so that the first can be skipped if sources haven't changed. Also normalize package names versus location in the `test/junit` folder: ant isn't very clever when it comes to selectively recompiling tests, so now editing a test will only cause that one to be recompiled (instead of ~13 files every time). This makes TDD with junit even faster.
* Get rid of Platform.doLoad method.Grzegorz Kossakowski2014-09-241-1/+0
| | | | Since .NET backend got removed this method is a no-op.
* Merge pull request #3941 from Ichoran/issue/8815Lukas Rytz2014-09-161-0/+15
|\ | | | | SI-8815 mutable.LongMap makes different choices for splitAt vs etc.
| * SI-8815 mutable.LongMap makes different choices for splitAt vs etc.Rex Kerr2014-09-111-0/+15
| | | | | | | | | | | | | | | | | | | | It turns out that take/drop/splitAt/takeWhile/dropWhile inherit a smattering of foreach vs. iterator-based implementations. These aren't consistent unless they iterate in the same order. This probably reflects an undesirable underlying weakness, but in this particular case it was easy to make LongMap's foreach order agree with iterator. Made traversal order of other foreach-like methods match also. Also fixed a bug where Long.MinValue wasn't iterated. Added unit test for iteration coverage of extreme values.
* | Remove stale local variables and exception handlers after DCELukas Rytz2014-09-105-7/+215
| | | | | | | | | | | | This is required for correctness of the generated bytecode. Exception handlers and local variable descriptors specify code offset ranges. These offsets have to exist, not be eliminated.
* | Clarify why we emit ATHROW after expressions of type NothingLukas Rytz2014-09-102-6/+50
| | | | | | | | Tests for emitting expressions of type Nothing.
* | Tools to run the compiler in JUnit testsLukas Rytz2014-09-102-0/+115
| |
* | JUnit tests for dead code elimination.Lukas Rytz2014-09-104-2/+199
|/ | | | JUnit tests may use tools from partest-extras (ASMConverters)
* Merge pull request #3946 from gourlaysama/wip/t5254Grzegorz Kossakowski2014-09-091-0/+23
|\ | | | | SI-5254 running an empty scala script should succeed
| * SI-5254 running an empty scala script should succeedAntoine Gourlay2014-08-261-0/+23
| | | | | | | | | | | | | | | | | | | | The script runner made the assumption that "compilation succeeded" implies "there is a Main class to run", but this can be wrong if the script is empty (or only contains imports/comments). The ScriptRunner now uses the ClassPath utility to check if there really is a main class. If not, it doesn't try to run it and returns peacefully. This also makes `scala -e ''` succeed.
* | Address PR feedback, fix MultiChoiceSetting.containsLukas Rytz2014-09-081-0/+2
| |
* | Use Enumeration for MultiChoiceSettingSom Snytt2014-09-051-1/+45
| | | | | | | | | | | | | | | | | | | | | | This is pretty easy, since a ValueSet is a BitSet. When the setting is updated, recompute the current set of values, which is cheap and succinct. Checking a flag is also easy and fast. Choices in MultiChoiceSettings may enable other choices.
* | -Ystatistics accepts a list of phases, cleanups in MultiChoiceSettingLukas Rytz2014-09-021-1/+62
| | | | | | | | | | MultiChoiceSetting and Xlint with its deprecated aliases is now a bit simpler, but there's still room for improvement, as noted in comments.
* | Fix assertThrows, and the behaviors that it shadowedLukas Rytz2014-09-024-6/+12
| | | | | | | | | | | | The test in StdNamesTest was introduced in cff8b569, where newTermName would throw on a negative length. In b090f97 this was changed to fix the negative length, but the test was not adapted (as it didn't fail).
* | Merge pull request #3931 from lrytz/opt/tracked-finalLukas Rytz2014-09-011-34/+21
|\ \ | | | | | | GenBCode refactoring (remove Tracked) and fix InnerClass / EnclosingMethod attributes
| * | Remove Tracked, add type information to ClassBTypeLukas Rytz2014-08-191-34/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, a ClassBType was just a name. The `exemplars` map stored a Tracked instance for every ClassBType. Tracked stored type information that is required later in the backend when things may run concurrently. In particular: superclass, interfaces, flags and information for emitting the InnerClass attribute. Now we put all the information stored in Tracked directly in the ClassBType. There is still one hash map: `classBTypeFromInternalNameMap` maps a JVM internal class name (e.g. "scala/Predef$") to the corresponding ClassBType. This map is used during bytecode generation, when the ASM framework computes stack map frames. In order to compute stack map frames, the ASM framework needs to be able to get the LUB of two types. The default implementation uses reflection to get type information, however that doesn't work in our case: the classes we compile are not on the classpath. So instead, the backend overwrites the method `getCommonSuperClass` of the ClassWriter. This method receives two class internal names and computes their LUB. This is done by looking up the ClassBTypes in the `classBTypeFromInternalNameMap` and invoking `jvmWiseLUB`. This commit was reviwed in https://github.com/scala/scala/pull/3855. It consists of all commits labelled [squash-after-review], squashed into one.
* | | Merge pull request #3949 from lrytz/t8627Grzegorz Kossakowski2014-08-271-0/+18
|\ \ \ | |_|/ |/| | SI-8627 make Stream.filterNot non-eager
| * | SI-8627 make Stream.filterNot non-eagerLukas Rytz2014-08-271-0/+18
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The obvious fix, overriding `filterNot` in Stream, is not binary compatible, see https://github.com/scala/scala/pull/3925 Instead, this makes `filterImpl` in TaversableLike private[scala], which allows overriding it in Stream. The corresponding mima-failures can be whitelisted, as the changes are only to private[scala]. In 2.12.x we can remove the override of `filter` in Stream, but in 2.11.x this is not binary compatible. Eventually we'd also like to make filter / filterNot in TraversableLike final, but that's not source compatible, so it cannot be done in 2.12.x.
* | Merge pull request #3923 from som-snytt/issue/8787Grzegorz Kossakowski2014-08-191-0/+17
|\ \ | |/ |/| SI-8787 Regextraction is null-proof
| * SI-8787 If you love nulls, so does RegexSom Snytt2014-08-081-0/+17
| | | | | | | | Regex is robust when unapplying null. A null never matches.
* | SI-8512 Infer Any for the qSom Snytt2014-08-121-0/+23
| | | | | | | | | | | | | | | | | | Avoid the widening bug for q. This resolution also suffers from the inference of Any, which can trigger a warning and an anxiety attack. But that's still better than doing the wrong thing. Right?
* | SI-8512 Infer a type for f"$args"Som Snytt2014-08-121-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | The f-interpolator gets a type param that better be Any to avoid unfortunate widenings. Hey, it worked! Unfortunately, when `Any` is inferred, `-Xlint:infer-any` takes notice. This is probably a greater problem for the f-interpolator than for quasiquotes, which are a more specialized tool.
* | SI-6476 DocumentationSom Snytt2014-07-181-0/+14
|/ | | | And adjust the test.
* SI-8525 Clarify usage of -Xlint:_,flagSom Snytt2014-07-161-15/+9
| | | | | | | | | | | | | | | | | | | | | Also clarify usage of -Xlint flag. Align more with javac -Xlint:all,-flag,flag where once a flag is explicitly enabled it cannot be disabled, but where the wildcard is a backstop only. (There is no all option yet here.) -Xlint and -Xlint:_ just set a flag which is consulted by any unset lint warning. Xlint warnings consult the state of Xlint when they are unset. Individual -Ywarn-ings do not. Other warnings are explicitly set to false. They can only be enabled programmatically. Some tests are corrected. Also, option order is no longer significant, see the unit test.
* SI-8525 No anonymous lintSom Snytt2014-07-101-3/+3
| | | | | | | | | Turn anonymous references to `settings.lint` into named settings. After that, trust to Adriaan to make them filterable. There are a few remaining top-level -Y lint warnings that are deprecated.
* SI-8525 Add -Xlint:-warn-missing-interpolatorSom Snytt2014-07-081-2/+16
| | | | | | | | | | Turn off lint warnings with negating prefix, and add a lint-only warning for the infamously nagging "Did you forget the interpolator?" That message is made more dignified. Without `-Xlint:false`, there is no mechanism to turn off anonymous linters once `-Xlint` is selected.
* Remove deprecationWarning, currentReporting from ReportingAdriaan Moors2014-07-041-0/+7
| | | | | | | | This moves us a bit closer to the goal of having a single entry point to reporting. Must modularize Reporting a bit so it can be used in Variances (need a reference to `currentRun` in `reflect.internal.Reporting`).
* Uniformly route reporting through reporter.Adriaan Moors2014-07-041-0/+5
| | | | | | | | | | | | Sharpen interfaces, reduce footprint of Reporting trait. Ideally, all reporting should indirect through reporter, and the `Reporting` trait itself should be restricted to a single method that retrieves the current `reporter`. Pull up some more reporting to reflect.internal. Would like to do more, but need to move partest to the reflect.internal interface first. (Its `errorCount` relies on `ERROR.count` in `tools.nsc.Reporter`.)
* Merge pull request #3736 from VladimirNik/print-types-issue-2.11.xAdriaan Moors2014-07-031-26/+51
|\ | | | | SI-8447 fix TypeTree printing (2.11.x)