summaryrefslogtreecommitdiff
path: root/test/files/run
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2861 from densh/topic/deprecate-early-type-defsGrzegorz Kossakowski2013-08-304-2/+9
|\ | | | | Deprecate early type defs
| * deprecate early type defsDen Shabalin2013-08-284-2/+9
| | | | | | | | | | | | This feature is neither properly supported by Scala compiler nor a part of the language spec and therefore should be removed. Due to source compatiblity with 2.10 we need to deprecate it first.
* | Merge pull request #2886 from gkossakowski/merge-2.10.xJason Zaugg2013-08-3012-3/+91
|\ \ | | | | | | Merge 2.10.x into master
| * \ Merge remote-tracking branch 'scala/2.10.x'Grzegorz Kossakowski2013-08-2912-3/+91
| |\ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the merge, the test/run/t7733 started to fail on Jenkins. I tried to reproduce it locally but I couldn't so I think it's system dependent failure. Per @retronym's suggestion I moved it to pending to not block the whole merge. Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala src/compiler/scala/tools/nsc/typechecker/Macros.scala src/compiler/scala/tools/nsc/typechecker/Namers.scala src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/compiler/scala/tools/nsc/util/MsilClassPath.scala src/compiler/scala/tools/reflect/ToolBoxFactory.scala src/reflect/scala/reflect/internal/ClassfileConstants.scala src/reflect/scala/reflect/internal/Importers.scala src/reflect/scala/reflect/internal/Trees.scala src/reflect/scala/reflect/runtime/JavaMirrors.scala test/files/run/macro-duplicate/Impls_Macros_1.scala test/files/run/t6392b.check test/files/run/t7331c.check
| | * Merge pull request #2814 from xeno-by/topic/auto-duplicate-expansionsJames Iry2013-08-167-0/+57
| | |\ | | | | | | | | [nomaster] macro expansions are now auto-duplicated
| | | * [nomaster] macro expansions are now auto-duplicatedEugene Burmako2013-08-147-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix still requires macro developers to be careful about sharing trees by references, because attributed DefTrees will still bring trouble. However this is an improvement, because it doesn't make matters worse and automatically fixes situations similar to one in the test. A much more thorough discussion with a number of open questions left: http://groups.google.com/group/scala-internals/browse_thread/thread/492560d941b315cc Was fixed ages ago in master in one of the paradise backports. Never got to 2.10.x, but it's very useful, so I'm backporting it now.
| | * | Merge pull request #2809 from xeno-by/ticket/7733James Iry2013-08-133-0/+15
| | |\ \ | | | | | | | | | | SI-7733 reflective packages now more consistent with scalac
| | | * | [nomaster] SI-7733 reflective packages now more consistent with scalacEugene Burmako2013-08-133-0/+15
| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously PackageScopes from scala.reflect ignored all classes that had $'s in non-rightmost positions in their names. Unfortunately this behaviour is inconsistent with how scalac does things, and I reconciled this as usual, by pulling corresponding logic into scala-reflect.jar and sharing it between runtime reflection and compiler. This change has seprate pull requests for 2.10.x and 2.11.0. The latter deprecates `scala.tools.nsc.util.ClassPath.isTraitImplementation` whereas the former (which you're looking at right now) does not, because we can't deprecated members in minor releases.
| | * | Merge pull request #2813 from xeno-by/topic/showrawGrzegorz Kossakowski2013-08-121-1/+1
| | |\ \ | | | | | | | | | | showRaw now prints symbols of def trees
| | | * | showRaw now prints symbols of def treesEugene Burmako2013-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | A very useful addition that came in handy when hacking macro annotations
| | * | | currentRun.compiles now correctly works in toolboxesEugene Burmako2013-08-102-0/+30
| | | |/ | | |/| | | | | | | | | Another random bug uncovered and extinguished when hacking macro annots.
| | * | SI-7331 tb.parse returns unpositioned treesDen Shabalin2013-08-086-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit gets rid off code wrapping that was previously used by toolbox to get into correct parsing mode. Instead combination of templateStats/accept(EOF) is used. This is the same solution as the one used in repl and built-in scriptRunner This pull request doesn't attempt to generalize this approach in any way and re-use it all over the place due to the caution of possible accidental compatibility breakage. I plan to do it separately against master. Additionally there are a few more changes that make importers be aware of positions and a test for that (via @jedesah).
| | * | Merge pull request #2761 from scalamacros/ticket/7510Jason Zaugg2013-08-015-1/+38
| | |\ \ | | | | | | | | | | Assorted toolbox fixes
| | | * | brings JavaMirrors up to speed with ClassfileParserEugene Burmako2013-07-235-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently there are still discrepancies between how the vanilla compiler turns class files into symbols and how the reflective compiler does it. Working on bringing these guys in sync, one bug at a time.
* | | | | Merge pull request #2849 from retronym/ticket/7763Jason Zaugg2013-08-291-0/+20
|\ \ \ \ \ | | | | | | | | | | | | SI-7763 Avoid dropping casts in erasure
| * | | | | SI-7763 Don't eliminate CHECK_CAST in dead code elimination.Jason Zaugg2013-08-291-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even if the result isn't used, the potential ClassCastException is observable, so we must retain them.
| * | | | | SI-7763 Avoid dropping casts in erasureJason Zaugg2013-08-292-0/+21
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 466b7d29f avoided quadratic complexity in Erasure's treatment of chained `asInstanceOf` calls. It did so by using the typechecked qualifier, rather than discarding it. However, that also dropped the cast altogether! In many cases this was masked by later inclusion of a cast to the expected type by `adaptToType`: at scala.tools.nsc.transform.Erasure$Eraser.cast(Erasure.scala:636) at scala.tools.nsc.transform.Erasure$Eraser.scala$tools$nsc$transform$Erasure$Eraser$$adaptToType(Erasure.scala:665) at scala.tools.nsc.transform.Erasure$Eraser.adapt(Erasure.scala:766) at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5352) This commit re-wraps the typechecked `qual` in its original `<qual>.asInstanceOf[T]` to preserve semantics while avoiding the big-O blowup. The test includes the compiler option `-Ynooptimize` because dead code elimination *also* thinks that this cast is superfluous. I'll follow up on that problem seprately.
* | | | | Merge pull request #2863 from magarciaEPFL/backendish40Grzegorz Kossakowski2013-08-286-0/+36
|\ \ \ \ \ | |/ / / / |/| | | | (1 of 2) of the rest of the new bytecode emitter + feedback
| * | | | SI-7407 fixed in GenBCode but beware, it remains a bug in GenASMMiguel Garcia2013-08-216-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GenBCode runs only under a flag, and moreover only if -optimise is not present (see ScalaSettings for details). Therefore during a nightly, when tests are run under -optimise, we need -Ynooptimise to deactivate the optimizer. With that, GenBCode can run and tackle the test case successfuly.
* | | | | Move partest to https://github.com/scala/scala-partestAdriaan Moors2013-08-201-1/+1
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As partest is now resolved from maven, `test/partest` uses `ant test.suite.init` to determine the classpath (serialized to build/pack/partest.properties) that's necessary to run `scala.tools.partest.nest.ConsoleRunner`. Thus, partest gets exactly the same classpath, whether run from the command line through `test/partest` or via `ant test`. The version of partest we're using is specified by properties defined in versions.properties (formerly `starr.number`). Currently, we're using: ``` scala.binary.version=2.11.0-M4 partest.version.number=1.0-RC3 ``` NOTES: - The version of Scala being tested must be backwards binary compatible with the version of Scala that was used to compile partest. - Once 2.11 goes final, `scala.binary.version=2.11`, and `starr.version=2.11.0`. - Need scalacheck on classpath for test/partest scalacheck tests. - Removed atrophied ant tests (haven't been run/changed for at least two years I checked 81d659141a as a "random" sample). - Removed scalacheck. It's resolved as a partest dependency. - For now, use a locally built scalap - Kept the trace macro in the main repo (partest-extras) - New targets for faster pr validation: test-core-opt, test-stab-opt - Reused partest eclipse/intellij project to partest-extras (note: the partest dependency is hard-coded)
* | | | Merge pull request #2824 from qerub/ticket/7740Adriaan Moors2013-08-201-0/+33
|\ \ \ \ | | | | | | | | | | SI-7740 Trim stack trace before printing in REPL
| * | | | SI-7740 Trim stack trace before printing in REPLChristoffer Sawicki2013-08-191-0/+33
| | | | |
* | | | | Refinement of name-based unapplySeq.Paul Phillips2013-08-182-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | Can't finnesse the drop method. Call it blindly for now, even though in the long run you won't have to write drop.
* | | | | An unapplySeq-via-String test.Paul Phillips2013-08-182-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a lot of details yet to be ironed out when it comes to sequences, but at least here's a little evidence that the basic mechanisms work.
* | | | | SI-5903 extractor macrosEugene Burmako2013-08-1816-0/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Establishes a pattern that can be used to implement extractor macros that give the programmer control over signatures of unapplications at compile-time. === The pattern === In a nutshell, given an unapply method (for simplicity, in this example the scrutinee is of a concrete type, but it's also possible to have the extractor be polymorphic, as demonstrated in the tests): ``` def unapply(x: SomeType) = ??? ``` One can write a macro that generates extraction signatures for unapply on per-call basis, using the target of the calls (c.prefix) and the type of the scrutinee (that comes with x), and then communicate these signatures to the typechecker. For example, here's how one can define a macro that simply passes the scrutinee back to the pattern match (for information on how to express signatures that involve multiple extractees, visit https://github.com/scala/scala/pull/2848). ``` def unapply(x: SomeType) = macro impl def impl(c: Context)(x: c.Tree) = { q""" new { class Match(x: SomeType) { def isEmpty = false def get = x } def unapply(x: SomeType) = new Match(x) }.unapply($x) """ } ``` In addition to the matcher, which implements domain-specific matching logic, there's quite a bit of boilerplate here, but every part of it looks necessary to arrange a non-frustrating dialogue with the typer. Maybe something better can be done in this department, but I can't see how, without introducing modifications to the typechecker. Even though the pattern uses structural types, somehow no reflective calls are being generated (as verified by -Xlog-reflective-calls and then by manual examination of the produced code). That's a mystery to me, but that's also good news, since that means that extractor macros aren't going to induce performance penalties. Almost. Unfortunately, I couldn't turn matchers into value classes because one can't declare value classes local. Nevertheless, I'm leaving a canary in place (neg/t5903e) that will let us know once this restriction is lifted. === Use cases === In particular, the pattern can be used to implement shapeshifting pattern matchers for string interpolators without resorting to dirty tricks. For example, quasiquote unapplications can be unhardcoded now: ``` def doTypedApply(tree: Tree, fun0: Tree, args: List[Tree], ...) = { ... fun.tpe match { case ExtractorType(unapply) if mode.inPatternMode => // this hardcode in Typers.scala is no longer necessary if (unapply == QuasiquoteClass_api_unapply) macroExpandUnapply(...) else doTypedUnapply(tree, fun0, fun, args, mode, pt) } } ``` Rough implementation strategy here would involve writing an extractor macro that destructures c.prefix, analyzes parts of StringContext and then generates an appropriate matcher as outlined above. === Implementation details === No modifications to core logic of typer or patmat are necessary, as we're just piggybacking on https://github.com/scala/scala/pull/2848. The only minor change I introduced is a guard against misbehaving extractor macros that don't conform to the pattern (e.g. expand into blocks or whatever else). Without the guard we'd crash with an NPE, with the guard we get a sane compilation error.
* | | | | New tests for name-based pattern matcher.Paul Phillips2013-08-1712-0/+622
| | | | |
* | | | | Pattern matcher: extractors become name-based.Paul Phillips2013-08-172-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An extractor is no longer required to return Option[T], and can instead return anything which directly contains methods with these signatures: def isEmpty: Boolean def get: T If the type of get contains methods with the names of product selectors (_1, _2, etc.) then the type and arity of the extraction is inferred from the type of get. If it does not contain _1, then it is a single value extractor analogous like Option[T]. This has significant benefits and opens new territory: - an AnyVal based Option-like class can be used which leverages null as None, and no allocations are necessary - for primitive types the benefit is squared (see below) - the performance difference between case classes and extractors should now be largely eliminated - this in turn allows us to recapture great swaths of memory which are currently squandered (e.g. every TypeRef has fields for pre and args, even though these are more than half the time NoPrefix and Nil) Here is a primitive example: final class OptInt(val x: Int) extends AnyVal { def get: Int = x def isEmpty = x == Int.MinValue // or whatever is appropriate } // This boxes TWICE: Int => Integer => Some(Integer) def unapply(x: Int): Option[Int] // This boxes NONCE def unapply(x: Int): OptInt As a multi-value example, after I contribute some methods to TypeRef: def isEmpty = false def get = this def _1 = pre def _2 = sym def _3 = args Then it's extractor becomes def unapply(x: TypeRef) = x Which, it need hardly be said, involves no allocations.
* | | | | Simplified the MaybeBoundTyped extractor a bit.Paul Phillips2013-08-172-0/+9
|/ / / /
* | | | Merge pull request #2843 from xeno-by/topic/kill-introduce-top-levelAdriaan Moors2013-08-1618-180/+0
|\ \ \ \ | | | | | | | | | | kills introduceTopLevel
| * | | | kills introduceTopLevelEugene Burmako2013-08-1618-180/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As we've figured out from the practice, introduceTopLevel is seductively useful but unfortunately not robust, potentially bringing compilation order problems. Therefore, as discussed, I'm removing it from the public macro API. Alternatives are either: 1) delving into internals, or 2) using macro paradise and experimenting with macro annotations: http://docs.scala-lang.org/overviews/macros/annotations.html.
* | | | | Merge pull request #2841 from gourlaysama/wip/t6507Adriaan Moors2013-08-162-0/+40
|\ \ \ \ \ | | | | | | | | | | | | SI-6507 do not call .toString on REPL results when :silent is on.
| * | | | | SI-6507 do not call .toString on REPL results when :silent is on.Antoine Gourlay2013-08-162-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Member handlers used to always call .toString on REPL results, even when :silent was on, which could force evaluation or cause unwanted side effects. This forwards the current value of `printResults` to the member handlers (through Request) for them to decide what to do when the results must not be printed. 2 handlers now do not return any extraction code when silent: - ValHandler, so that it doesn't call toString on the val - Assign, so that it doesn't call toString on the right-hand side of the assignement.
* | | | | | Merge pull request #2837 from soc/SI-7630Adriaan Moors2013-08-161-4/+9
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7630 [Avian] Skip test run/repl-javap-outdir-funs on Avian
| * | | | | | SI-7630 [Avian] Skip test run/repl-javap-outdir-funs on AvianSimon Ochsenreither2013-08-161-4/+9
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test fails, because the REPL command reports that no anonfuns were found. I have spent a considerable amount of time to figure out what's the issue here with no success. Skip it for now, so that we don't lose sight of the big picture.
* | | | | | Merge pull request #2836 from soc/SI-7564-reduxAdriaan Moors2013-08-161-18/+18
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7564 [Avian] Whitespace fixes to run/tailcalls.check
| * | | | | | SI-7564 [Avian] Whitespace fixes to run/tailcalls.checkSimon Ochsenreither2013-08-161-18/+18
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | Looks like the differences in the whitespace caused the test to fail on Avian.
* | | | | | Merge pull request #2830 from densh/topic/stats-parsing-2Adriaan Moors2013-08-166-0/+40
|\ \ \ \ \ \ | | | | | | | | | | | | | | updated SI-7331, SI-6843, SI-7731, parser entry point refactoring, assertThrows utility function
| * | | | | | SI-7331 remove all the wrapping code from toolboxDen Shabalin2013-08-146-0/+40
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change toolbox parsing to use `parseStats` parser entry point instead of current code-wrappign technique that makes positions much less useful to end users. There is also no need to create a compiler `Run` for parsing.
* | | | | | Merge pull request #2823 from som-snytt/issue/7715Adriaan Moors2013-08-162-0/+27
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7715 String inpatternation s"$_" for s"${_}"
| * | | | | | SI-7715 String inpatternation s"$_" for s"${_}"Som Snytt2013-08-122-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a pattern, ``` scala> implicit class RX(val sc: StringContext) { | def rx = sc.parts.mkString("(.+)").r } defined class RX scala> "2 by 4" match { case rx"$a by $_" => a } res0: String = 2 scala> val rx"$_ by $b" = "2 by 4" b: String = 4 ```
* | | | | | | Merge pull request #2821 from xeno-by/topic/fundep-materializationAdriaan Moors2013-08-167-2/+108
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-7470 implements fundep materialization
| * | | | | | | SI-7470 implements fundep materializationEugene Burmako2013-08-137-2/+108
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fix provides implicit macros with an ability to affect type inference in a more or less sane manner. That's crucial for materialization of multi-parametric type class instances (e.g. Iso's from shapeless). Details of the technique can be found in comments.
* | | | | | | Merge pull request #2798 from som-snytt/issue/7544-errmsgAdriaan Moors2013-08-165-6/+2
|\ \ \ \ \ \ \ | |_|_|/ / / / |/| | | | | | SI-7544 Interpolation message for %% literal
| * | | | | | StringContext#checkLengths reports bad args countSom Snytt2013-08-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since interpolator args are of type Any, it's easy to write s(args) instead of s(args: _*). I wonder if Xlint would have warned me about that.
| * | | | | | In tests, interpolation is no longer -Xperimental.Som Snytt2013-08-064-4/+0
| |/ / / / /
* | | | | | Merge pull request #2791 from som-snytt/issue/7265-2.11Adriaan Moors2013-08-141-27/+0
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | SI-7265 javaSpecVersion, adjust isJava... tests for 2.11
| * | | | | SI-7265 javaSpecVersion, adjust isJava... testsSom Snytt2013-08-011-27/+0
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make this and related properties public, because they are useful. This change ought to have been committed at 2.11 and then backported with restrictions, rather than vice-versa. Note that they are defined in the order, version, vendor and name, which is the order from the underlying javadoc. It would be a neat feature of the PR validator, as previously imagined, to run a "pending" test and then, on success and merge, to move it automatically to the canonical suite.
* / / / / Par-Test split checks work againSom Snytt2013-08-083-8/+5
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check files split into conditional blocks with partest flags have been broken since the new diff regime. For some reason, no one noticed. The clever scheme to "filter the diff" instead of just filtering the check file is abandoned as futile and unnecessary. Fix java6 checkfile for ifdiff fix.
* | | | Merge remote-tracking branch 'scala/master' into merge-2.10.xGrzegorz Kossakowski2013-07-298-18/+20
|\ \ \ \
| * \ \ \ Merge pull request #2746 from soc/topic/paulp-typer-debug-outputAdriaan Moors2013-07-298-18/+20
| |\ \ \ \ | | | | | | | | | | | | Improve type printing (toString/debugging)