summaryrefslogtreecommitdiff
path: root/test/files/run
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2930 from retronym/topic/patmat-inference-prepJason Zaugg2013-09-115-21/+0
|\ | | | | Topic/patmat inference prep
| * Removing orphan check/flag files.Paul Phillips2013-08-295-21/+0
| |
* | Merge pull request #2904 from som-snytt/issue/reflect-priv-ctorJason Zaugg2013-09-102-0/+23
|\ \ | | | | | | SI-7810 Reflect private constructor
| * | SI-7810 Reflect private constructorSom Snytt2013-09-032-0/+23
| | | | | | | | | | | | | | | `JavaMirror.constructorToJava` uses `getDeclaredConstructor` now instead of `getConstructor`.
* | | Merge pull request #2915 from retronym/ticket/7817Jason Zaugg2013-09-104-0/+201
|\ \ \ | | | | | | | | SI-7817 Fix regression in structural types
| * | | SI-7817 Fix regression in structural typesJason Zaugg2013-09-092-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calls to structural types are converted to reflective calls in the `cleanup` phase, which, along with `mixin`, does its work after `flatten`. `Symbol#owner` behaves in a phase dependent manner; after flatten the owner of lifted class is given as the enclosing package. Except when they're not. `ModuleSymbol`s representing an object nested inside a class are viewed dually as modules *and* methods (see the comments on `isModuleNotMethod` for some background). When it comes time to flatten, we're presented with a quandary: the method must clearly stay owned by the enclosing class, but surely the lifted module should be owned by the enclosing package, to have the same owner as its associated module class. The `method` nature of this symbol seems to win: override def owner = { if (Statistics.hotEnabled) Statistics.incCounter(ownerCount) if (!isMethod && needsFlatClasses) rawowner.owner else rawowner This wrinkle leads to a wrong turn in `TreeGen#mkAttributedRef`, which incorrectly rewrites `REF(O)` to `p1.`package`.O`. It seems this problem has gone unnoticed because the tree emitted referred to a static symbol (the reflection cache for structural types), and the backend simply elided the qualifier `p1.package`. A recent change to the backend makes it more conservative about dropping qualifiers on the floor, and it started emitting a reference to a package object that doesn't exist. This commit despairingly checks `isDefinedInPackage` of both the module *and* the module class. The test cases from the previous commit illustrated the status quo, and this commit updates the joint compilation test with the bug fix. A new test is to show that the symptom (structural type crash) is now fixed.
| * | | SI-7817 Tests to show the foibles of mkAttributedRefJason Zaugg2013-09-093-0/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To `package`, or not `package`, that is the question. This lines marked with !!! get this wrong, and be remedied by the next commit. This problem is culpable for the crash in the enclosed `pending` test.
* | | | Merge pull request #2907 from paulp/pr/typetree-original-rangeposJason Zaugg2013-09-092-0/+26
|\ \ \ \ | | | | | | | | | | Eliminate TypeTrees with null original.
| * | | | Eliminate TypeTrees with null original.Paul Phillips2013-09-042-0/+26
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a retry of #2801 after figuring out the range position error. Should there be anyone out there who compiles with -Xdev, know that this commit eliminates the 1406 errors one presently incurs compiling src/library. A val declared in source code receives only one tree from the parser, but two are needed - one for the field and one for the getter. I discovered long ago that if the val had an existential type, this was creating issues with incompatible existentials between the field and the getter. However the remedy for that did not take into account the whole of the wide range of super subtle issues which accompany tree duplication. In particular, the duplicated tree must be given not only a fresh TypeTree(), but that TypeTree cannot share the same original without running afoul of range position invariants. That's because typedTypeTree resurrects the original tree with whatever position it has - so the "original" needs to be a duplicate of the original with a focused position. Should the call to TypeTree.duplicate also duplicate the original? I think so, but I bequeath this question to others. This commit also eliminated some duplicate error messages, because duplicate suppression depends on the errors having the same position. See c478eb770d, 7a6fa80937 for previous related work.
* | | | Merge pull request #2885 from som-snytt/issue/7791-script-linenumsJason Zaugg2013-09-083-0/+25
|\ \ \ \ | | | | | | | | | | SI-7791 Line number table reflects underlying file
| * | | | SI-7791 Line number table reflects underlying fileSom Snytt2013-09-053-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since positions ultimately know their ultimate positions in their ultimate source, use that line number, ultimately, when emitting line number table entries. It is possible, but possibly not useful, to emit both the actual (ultimate) line number and the nominal one. The `int`-valued line number of the `StackTraceElement` is "derived" from the attribute. In global, wrapping a `BatchSourceFile` as a `ScriptSource` happens in `compileSources` to facilitate testing. A `ScriptTest` facility is provided to facilitate testing the script facility. It is rather facile.
* | | | | Merge pull request #2865 from folone/trampolinesGrzegorz Kossakowski2013-09-071-0/+13
|\ \ \ \ \ | | | | | | | | | | | | Alter TailRec to have map and flatMap
| * | | | | Alter TailRec to have map and flatMapGeorge Leontiev2013-08-241-0/+13
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As described in the "Stackless Scala with Free Monads" paper scala> import scala.util.control.TailCalls._ import scala.util.control.TailCalls._ scala> :paste // Entering paste mode (ctrl-D to finish) def isEven(xs: List[Int]): TailRec[Boolean] = if (xs.isEmpty) done(true) else tailcall(isOdd(xs.tail)) def isOdd(xs: List[Int]): TailRec[Boolean] = if (xs.isEmpty) done(false) else tailcall(isEven(xs.tail)) // Exiting paste mode, now interpreting. isEven: (xs: List[Int])util.control.TailCalls.TailRec[Boolean] isOdd: (xs: List[Int])util.control.TailCalls.TailRec[Boolean] scala> isEven((1 to 100000).toList).result res0: Boolean = true scala> def fib(n: Int): TailRec[Int] = | if (n < 2) done(n) else for { | x <- tailcall(fib(n - 1)) | y <- tailcall(fib(n - 2)) | } yield (x + y) fib: (n: Int)util.control.TailCalls.TailRec[Int] scala> fib(40).result res1: Int = 102334155
* | | | | Merge pull request #2917 from som-snytt/issue/7805-repl-iGrzegorz Kossakowski2013-09-074-5/+60
|\ \ \ \ \ | | | | | | | | | | | | SI-7805 REPL -i startup
| * | | | | SI-7805 REPL -i startupSom Snytt2013-09-064-5/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tested with a ReplTest that loads an include script. ReplTests can choose to be `Welcoming` and keep a normalized welcome message in their check transcript. One recent SessionTest is updated to use the normalizing API.
* | | | | | Merge pull request #2855 from adriaanm/modularize-xml-parsersv2.11.0-M5Grzegorz Kossakowski2013-09-0674-1535/+0
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Modularize: xml & parser-combinators
| * | | | | Prepare removal of scala-xml, scala-parser-combinatorsAdriaan Moors2013-08-2774-1535/+0
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Every test deleted here has found its way to the respective repositories of scala-xml and scala-parser-combinators, where they will continue to be tested with partest. The modified tests became independent of these modules, as they should've been from the start.
* | | | | Merge remote-tracking branch 'scala/2.10.x' into merge-2.10.xGrzegorz Kossakowski2013-09-056-0/+279
|\ \ \ \ \ | |_|_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf src/reflect/scala/reflect/internal/SymbolTable.scala src/reflect/scala/reflect/internal/util/WeakHashSet.scala src/reflect/scala/reflect/runtime/JavaMirrors.scala
| * | | | Merge pull request #2888 from xeno-by/topic/typed-annotatedJason Zaugg2013-09-043-0/+21
| |\ \ \ \ | | | | | | | | | | | | typedAnnotated no longer emits nulls
| | * | | | typedAnnotated no longer emits nullsEugene Burmako2013-08-293-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a null-check in original synthesis for the result of typedAnnotated. Previously it was possible for the aforementioned result to look like TypeTree(<tpe>) setOriginal Annotated(..., null). Not anymore.
| * | | | | SI-7150 Replace scala.reflect.internal.WeakHashSetGrzegorz Kossakowski2013-09-031-0/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaces scala.reflect.internal.WeakHashSet with a version that * extends the mutable.Set trait * doesn't leak WeakReferences * is unit tested
| * | | | | Merge pull request #2868 from retronym/ticket/7775Jason Zaugg2013-08-291-0/+17
| |\ \ \ \ \ | | | | | | | | | | | | | | SI-7775 Harden against the shifting sands of System.getProperties
| | * | | | | SI-7775 Harden against the shifting sands of System.getPropertiesJason Zaugg2013-08-261-0/+17
| | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If another thread writes a new system property (which can happen in pretty innocuous code such as `new Date`!), the compiler startup could fail with a `ConcurrentModificationException` as it iterated all bindings in the properties map in search of a boot classpath property for esoteric JVMs. This commit uses `Properties#getStringProperties` to get a snapshot of the keys that isn't backed by the live map, and iterates these instead. That method will also limit us to bindings with String values, which is all that we expect.
| * / / / / SI-7779 Account for class name compactification in reflectionJason Zaugg2013-08-231-0/+67
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have to assume that the classes we are reflecting on were compiled with the default value for -Xmax-classfile-name (255). With this assumption, we can apply the same name compactification as done in the regular compiler. The REPL is particularly prone to generating long class names with the '$iw' prefixes, so this is an important fix for runtime reflection. Also adds support for getting the runtime class of `O.type` if `O` is a module.
* | | | | SI-7781 Improve test and add commentSom Snytt2013-09-021-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test should normalize the elided message, not strip it. (Thanks qerub; I was frustrated with kitteh's turnaround that night, hence unwilling to improve once it passed.)
* | | | | SI-7781 REPL stack trunc shows causeSom Snytt2013-09-021-0/+8
| |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The handy stack trace truncation in REPL doesn't show cause like a regular trace. This commit fixes that and also adds the usual indicator for truncation, viz, "... 33 more". The example from the ticket produces: ``` scala> rewrapperer java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: Point of failure at .rewrapper(<console>:9) at .rewrapperer(<console>:10) ... 32 elided Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Point of failure at .wrapper(<console>:8) ... 34 more Caused by: java.lang.RuntimeException: Point of failure at .sample(<console>:7) ... 35 more ``` Suppressed exceptions on Java 7 are handled reflectively. ``` java.lang.RuntimeException: My problem at scala.tools.nsc.util.StackTraceTest.repressed(StackTraceTest.scala:56) ... 27 elided Suppressed: java.lang.RuntimeException: Point of failure at scala.tools.nsc.util.StackTraceTest.sample(StackTraceTest.scala:29) at scala.tools.nsc.util.StackTraceTest.repressed(StackTraceTest.scala:54) ... 27 more ```
* | | | 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.