summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* macro impls can now return subtypes of c.TreeEugene Burmako2013-07-106-0/+51
| | | | | | | | 10229316db allowed macro impls to take and return values of type c.Tree in addition to the usual c.Expr. However it didn't take into account that it is often useful to return subtypes of trees (e.g. with quasiquotes that expand into expressions typed as precisely as possible). This patch fixes that oversight.
* tests for quasiquotesDen Shabalin2013-07-0811-0/+1280
| | | | | | Introduces an extensive ScalaCheck-based test suite for recently implemented quasiquotes. Provides tools for syntactic tree comparison and verifying compilation error messages.
* Merge pull request #2688 from yllan/SI-7614Grzegorz Kossakowski2013-07-061-0/+70
|\ | | | | SI-7614 Minimize the times of evaluation f in TraversableOnce.maxBy/minBy
| * SI-7614 Minimize the times of evaluation f in TraversableOnce.maxBy/minBy.yllan2013-07-061-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | In the previous implementation, maxBy/minBy will evaluate most of its elements with f twice to get the ordering. That results (2n - 2) evaluations of f. I save both the element and result of evaluation to a tuple so that it doesn't need to re-evaluate f on next comparison. Thus only n evaluations of f, that is the optimal. Note that the original implementation always returns the first matched if more than one element evaluated to same largest/smallest value of f. I document this behavior explicitly in this commit as well.
* | Merge pull request #2660 from retronym/ticket/7582Adriaan Moors2013-07-0311-0/+92
|\ \ | | | | | | SI-7582 Only inline accessible calls to package-private Java code
| * | SI-7582 Only inline accessible calls to package-private Java codeJason Zaugg2013-06-198-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two problems here. The inliner was using `isPrivate` / `isProtected` to determine access. The fallthrough considered things to be (bytecode) public. This is okay in practice for Scala code, which never emits package private code. Secondly, we must check accessibility of the called symbol *and* its owner. This case is tested in `run/t7582b`. This commit tightens the check for Java defined symbols: a) check the owner, and b) don't assume that `! isPrivate` is accessible.
| * | SI-7582 ClassfileParser: populate privateWithin of Java module classJason Zaugg2013-06-163-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | The `privateWithin` attribute of Java companion module classes was correctly set under joint compilation (ie, when using JavaParser), but not under separate compilation. This commit remedies this. The test covers variety of Java symbols.
* | | Merge pull request #2699 from adriaanm/fix-2637-windowsJason Zaugg2013-07-021-1/+2
|\ \ \ | | | | | | | | Use forward slash in #2637's test on windows
| * | | Use forward slash in #2637's test on windowsAdriaan Moors2013-07-011-1/+2
| | | | | | | | | | | | | | | | | | | | Don't use toString to output file names in tests, its output is platform dependent -- use `testIdent` instead.
* | | | Merge pull request #2693 from lexspoon/semmle-lintAdriaan Moors2013-07-013-0/+10
|\ \ \ \ | | | | | | | | | | Lint-like fixes found by Semmle
| * | | | Updates .gitignore files.Lex Spoon2013-06-263-0/+10
| | | | |
* | | | | Merge pull request #2694 from adriaanm/masterGrzegorz Kossakowski2013-07-018-420/+229
|\ \ \ \ \ | | | | | | | | | | | | Merge 2.10.x into master
| * \ \ \ \ Merge 2.10.x into masterAdriaan Moors2013-06-288-420/+229
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Duplicators.scala src/library/scala/concurrent/Future.scala test/files/jvm/scala-concurrent-tck.scala
| | * \ \ \ \ Merge pull request #2648 from retronym/ticket/7571Grzegorz Kossakowski2013-06-253-7/+17
| | |\ \ \ \ \ | | | | | | | | | | | | | | | | SI-7571 Allow nesting of anonymous classes in value classes
| | | * | | | | SI-7571 Allow nesting of anonymous classes in value classesJason Zaugg2013-06-193-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5d9cde105e added deep prohibition of nested classes within a value class. This has the undesirable side effect of prohibiting partial functions literals in method bodies of a value class. The intention of that prohibition was to avoid problems in code using Type Tests, such as: class C(val inner: A) extends AnyVal { class D } def foo(a: Any, other: C) = a match { case _ : other.D } Here, the pattern usually checks that `a.$outer == other`. But that is incongruent with the way that `other` is erased to `A`. However, not all nested classes could lead us into this trap. This commit slightly relaxes the restriction to allow anonymous classes, which can't appear in a type test. The test shows that the translation generates working code.
| | * | | | | | Merge pull request #2511 from ↵Adriaan Moors2013-06-241-409/+153
| | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | viktorklang/wip-cleaner-Future-method-implementations-2.10-√ General SIP-14 Future method implementation cleanup
| | | * | | | | | Refactoring to the scala-concurrent-tck.scalaViktor Klang2013-06-191-409/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - there were numerous logical issues with the former implementation - failed assertions may not fail the build - there was a lot of ceremony and noise
| | * | | | | | | Merge pull request #2651 from VladUreche/issue/7343-2Adriaan Moors2013-06-183-1/+59
| | |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-7343 Fixed phase ordering in specialization
| | | * | | | | | | SI-7343 Fixed phase ordering in specializationVlad Ureche2013-06-123-1/+59
| | | | |/ / / / / | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specialization rewires class parents during info transformation, and the new info then guides the tree changes. But if a symbol is created during duplication, which runs after specialization, its info is not visited and thus the corresponding tree is not specialized. One manifestation is the following: ``` object Test { class Parent[@specialized(Int) T] def spec_method[@specialized(Int) T](t: T, expectedXSuper: String) = { class X extends Parent[T]() // even in the specialized variant, the local X class // doesn't extend Parent$mcI$sp, since its symbol has // been created after specialization and was not seen // by specialzation's info transformer. ... } } ``` We can fix this by forcing duplication to take place before specialization. Review by @dragos, @paulp or @axel22.
| | * | | | | | | Merge pull request #2646 from retronym/topic/duration-relax-2.10.xGrzegorz Kossakowski2013-06-181-2/+3
| | |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | [backport] relax time constraint in duration-tck.scala (for Windows VMs)
| | | * | | | | | | [backport] relax time constraint in duration-tck.scala (for Windows VMs)Roland2013-06-101-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry picked from commit 3e0fbc0193f0b6f58dc16dae3824677e9902dc7b)
* | | | | | | | | | Merge pull request #2692 from soc/SI-7591Adriaan Moors2013-07-014-15/+85
|\ \ \ \ \ \ \ \ \ \ | |_|_|_|_|_|_|/ / / |/| | | | | | | | | SI-7591 Migrate command-line parsing to s.t.cmd
| * | | | | | | | | SI-7591 Minor cleanupsSimon Ochsenreither2013-07-013-15/+2
| | | | | | | | | |
| * | | | | | | | | SI-7591 Move command-line spec usage demo to testsSimon Ochsenreither2013-07-011-0/+83
| | | | | | | | | |
* | | | | | | | | | Merge pull request #2620 from magarciaEPFL/backendish33Adriaan Moors2013-07-017-2/+29
|\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / |/| | | | | | | | | new bytecode emitter, GenBCode (11th attempt)
| * | | | | | | | | more informative name for backend-selection via command-lineMiguel Garcia2013-06-275-5/+5
| | | | | | | | | |
| * | | | | | | | | SI-5031 fixed in GenBCodeMiguel Garcia2013-06-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GenASM-based fix for SI-5031 is 0527b2549bcada2fda2201daa630369b377d0877
| * | | | | | | | | two bytecode tests atune with bytecode by GenASMMiguel Garcia2013-06-022-1/+2
| | | | | | | | | |
| * | | | | | | | | new bytecode emitter, GenBCode, for now under a flagMiguel Garcia2013-06-016-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GenBCode is a drop-in replacement for GenASM with several advantages: - faster: ICode isn't necessary anymore. Instead, the ASTs delivered by CleanUp (an expression language) are translated directly into a stack-language (ASM Tree nodes) - future-proofing for Java 8 (MethodHandles, invokedynamic). - documentation included, shared mutable state kept to a minimum, all contributing to making GenBCode more maintainable than its counterpart (its counterpart being GenICode + GenASM). A few tests are modified in this commit, for reasons given below. (1) files/neg/case-collision Just like GenASM, GenBCode also detects output classfiles differing only in case. However the error message differs from that of GenASM (collisions may be show in different order). Thus the original test now has a flags file containing -neo:GenASM and a new test (files/neg/case-collision2) has been added for GenBCode. The .check files in each case show expected output. (2) files/pos/t5031_3 Currently the test above doesn't work with GenBCode (try with -neo:GenBCode in the flags file) The root cause lies in the fix to https://issues.scala-lang.org/browse/SI-5031 which weakened an assertion in GenASM (GenBCode keeps the original assertion). Actually that ticket mentions the fix is a "workaround" (3) files/run/t7008-scala-defined This test also passes only under GenASM and not GenBCode, thus the flags file. GenASM turns a bling eye to: An AbstractTypeSymbol (SI-7122) has reached the bytecode emitter, for which no JVM-level internal name can be found: ScalaClassWithCheckedExceptions_1.E1 The error message above (shown by GenBCode) highlights there's no ScalaClassWithCheckedExceptions_1.E1 class, thus shouldn't show up in the emitted bytecode (GenASM emits bytecode that mentions the inexistent class).
* | | | | | | | | | Merge pull request #2681 from soc/SI-7590Adriaan Moors2013-06-282-1/+7
|\ \ \ \ \ \ \ \ \ \ | |_|/ / / / / / / / |/| | | | | | | | | SI-7590 TreeSet should fail fast if Ordering is null
| * | | | | | | | | SI-7590 TreeSet should fail fast if Ordering is nullSimon Ochsenreither2013-06-252-1/+7
| | |_|_|_|_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While migrating scala.tools.nsc.util.TreeSet to scala.collection.mutable.TreeSet, I messed up initialization order and realized that TreeSet accepts null as an Ordering and only fails much later. This change makes mutable.TreeSet and immutable.TreeSet fail immediately.
* | | | | | | | | SI-7344 Specialize methods in private scopesVlad Ureche2013-06-281-0/+53
| |_|_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This performs method specialization inside a scope other than a {class, trait, object}: could be another method or a value. This specialization is much simpler, since there is no need to record the new members in the class signature, their signatures are only visible locally. It works according to the usual logic: - we use normalizeMember to create the specialized symbols - we leave DefDef stubs in the tree that are later filled in by tree duplication and adaptation The solution is limited by SI-7579: since the duplicator loses the sym annotations when duplicating, this expansion and rewiring can only take place in code that has not been subject to duplication. You can see the test case for an example. Review by @dragos, @paulp or @axel22.
* | | | | | | | Merge pull request #2678 from soc/SI-7600Adriaan Moors2013-06-273-2/+16
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-7600 [Avian] Skip tests r/stream_length and r/t4294
| * | | | | | | | SI-7600 [Avian] Skip tests r/stream_length and r/t4294Simon Ochsenreither2013-06-233-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The issue is that Avian's GC is currently not precise enough to determine the exact lifetime of each local/stack reference, and therefore considers the this reference to be reachable in situations where it could have been collected. This can cause issues (as seen in run/stream_length and run/t4294: `java.lang.OutOfMemoryError`) if code relies on the garbage collection of these values to keep memory consumption constant. This commit simply skips these two tests on Avian until the GC implementation is fixed.
* | | | | | | | | Merge pull request #2677 from jannic/SI-3936Adriaan Moors2013-06-273-0/+9
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-3936 - add test case to show that SI-3936 is already fixed
| * | | | | | | | | SI-3936 - add test case to show that SI-3936 is already fixedJan Niehusmann2013-06-233-0/+9
| |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are exactly the examples given by Lukas Rytz in SI-3936. They fail with 2.10.1 and compile with 2.10.2 as well as current master.
* | | | | | | | | Merge pull request #2669 from adriaanm/modularize-parsingAdriaan Moors2013-06-276-6/+6
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Modularize parsing
| * | | | | | | | | Remove dependency on combinators from CommandLinerParser.Adriaan Moors2013-06-256-6/+6
| | |/ / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tools.cmd.CommandLineParser uses a small hand-rolled parser TODO: replace partest's usage of scala.tools.nsc.util.CommandLine by scala.tools.cmd.CommandLine
* | | | | | | | | Merge pull request #2675 from soc/SI-7599Adriaan Moors2013-06-261-8/+12
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-7599 Modify methods to be non-tail-callable ...
| * | | | | | | | | SI-7599 [Avian] Prevent TCO in test to inspect stackSimon Ochsenreither2013-06-261-8/+12
| | |/ / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit modifies methods in the test to be non-tail-callable to prevent Avian from eliding the stack frames we want to inspect.
* | | | | | | | | Merge pull request #2659 from retronym/ticket/7584Adriaan Moors2013-06-254-0/+32
|\ \ \ \ \ \ \ \ \ | |_|/ / / / / / / |/| | | | | | | | SI-7584 Fix typer regression with by-name parameter types
| * | | | | | | | SI-7584 Test and spurious warning fix for by-name closuresJason Zaugg2013-06-163-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The enclosed test case exercises by-name closures, which were the subject of the previous commit. In the process, a spurious warning was eliminated.
| * | | | | | | | SI-7584 Fix typer regression with by-name parameter typesJason Zaugg2013-06-161-0/+11
| | |_|_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It regressed in fada1ef6b#L4L614. Partially reverting just this change restores the correct behaviour: ``` - if (sym.isStable && pre.isStable && !isByNameParamType(tree.tpe) && + if (treeInfo.admitsTypeSelection(tree) && ``` This patch embeds the check for by-name parameter types into `TreeInfo.isStableIdentifier`. That code already checks for `Symbol#isStable`, which exludes direct references to by-name parameters. But the additional check is required to deal with by-name parameters in function types, e.g `(=> Int) => Any`. Open question: should we go further and embed this check in `isStable`? Currently: final def isStable = isTerm && !isMutable && !(hasFlag(BYNAMEPARAM)) && (!isMethod || hasStableFlag) Such function types are an underspecified corner of the language, albeit one that is pretty useful writing, for example, in the signature of a lazy foldRight that can operate over infinite structures: def foldRight[A, B](fa: F[A], z: => B)(f: (A, => B) => B): B The next commit subjects them to a little testing.
* | | | | | | | SI-7569 Fix end position in PostfixSelect treeFrançois Garillot2013-06-242-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduced in 5b54681: the end position of Postfix operators should take the operator length into account. review by @som-snytt
* | | | | | | | Merge pull request #2653 from retronym/ticket/7433Grzegorz Kossakowski2013-06-232-0/+11
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-7433 Fix spurious warning about catching control throwable
| * | | | | | | | SI-7433 Fix spurious warning about catching control throwableJason Zaugg2013-06-232-0/+11
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the same vein as SI-6994, we have to be careful not to warn about synthetic code. In that case, the spurious warnings came because we warned in the typechecker, which was also called in erasure. In this case, we are issuing the warning in Uncurry, so we must be mindful of the pattern matchers translations of non-trivial catch patterns, which look like: case (ex8 @ _) => { <synthetic> val x5: Throwable = ex8; case11(){ if ({ case14(){ if (x5.$isInstanceOf[NullPointerException]()) matchEnd13(true) else case15() }; case15(){ if (x5.$isInstanceOf[RuntimeException]()) matchEnd13(true) else case16() }; case16(){ matchEnd13(false) }; matchEnd13(x: Boolean){ x } }) This commit detects that `ex8` is synthetic and disables the warning.
* | | | | | | | Merge pull request #2637 from retronym/ticket/7439Paul Phillips2013-06-234-0/+40
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | | SI-7439 Avoid NPE in `isMonomorphicType` with stub symbols. …
| * | | | | | | SI-7439 Avoid NPE in `isMonomorphicType` with stub symbols.Jason Zaugg2013-06-134-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `originalInfo` can return null for stub symbols; deal with that as we used to before a regression in 016bc3db. After this change, we can once again delete A_1.class and still compile code instantiating B_1. (A_1 is only referred to in a method signature of B_1 which is not called from our code.) scala> new B_1 warning: Class A_1 not found - continuing with a stub. res0: B_1 = B_1@5284b8f9 In practice, this situation arises when someone uses a third party class that was compiled against other libraries not avaialable on the current compilation classpath.
* | | | | | | | SI-7292 Fixes test failures by updating *.check filesSimon Ochsenreither2013-06-214-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Looks like partest's confusion about / vs. \ was fixed between the original Jenkins run of the fix for SI-7292 and its merge.
* | | | | | | | Merge pull request #2342 from soc/SI-7292Adriaan Moors2013-06-206-0/+34
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-7292 Deprecate octal escape literals