summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* SI-7841 Remove commented out AnyRef specialization from Function{0,1}.Jason Zaugg2013-09-154-5/+5
| | | | In a sign of decreased optimism about that facility.
* Merge pull request #2946 from jinfu-leng/ticket/7844Jason Zaugg2013-09-151-1/+1
|\ | | | | SI-7844 Intellij setup.sh is not working for Ubuntu 12.04
| * SI-7844 Intellij setup.sh is not working for Ubuntu 12.04jinfu-leng2013-09-151-1/+1
| | | | | | | | Added "-f" option to the command "rm"
* | Merge pull request #2884 from retronym/ticket/3832Jason Zaugg2013-09-1516-19/+119
|\ \ | | | | | | SI-1909 SI-3832 SI-7007 SI-7223 Improved handling of larval objects
| * | SI-7223 More finesse in setting INCONSTRUCTORJason Zaugg2013-09-123-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's a clunky flag used to determine very early on whether we're in the self-call, super-call or early-init section. In SI-6666 / fd6125428, the check was improved to consider nesting. But, that caused this regression, as Function's haven't been translated to classes yet, so our check for enclosing non-term owners failed wrongly flagged definitins body of a anonymous function as INCONSTRUCTOR. With this patch, we correctly flag: class C extends D { // INCONSTRUCTOR () => { !INCONSTRUCTOR } // INCONSTRUCTOR }
| * | SI-7007 Test case shows we disallow premature `this` accessJason Zaugg2013-09-112-0/+21
| | | | | | | | | | | | | | | | | | | | | Rather than the old behaviour, which compiled successfully but led us into the jaws of a LinkageError. Related to SI-6666.
| * | SI-3832 Don't lift methods in aux constructor trailing stats as STATICJason Zaugg2013-09-116-2/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SI-1909 modified LambdaLift to lift in auxiliary constructors methods as STATIC so they could be called before the self-constructor was called. That allowed for: class Foo (x: Int) { def this() = this( { def bar() = 5 bar }) } However, if the method is in a statement that trails the self constructor call, this is unnecessary and in fact incorrect as it robs the lifted method of `this`. This commit uses the machinery established in SI-6666 to limit the STATIC-ness of lifted methods to those used in arguments for self-constructor calls. This is used exclusively; the `isAuxillaryConstructor` check wasn't the right way to solve this, as was seen by the regression it caused in SI-3832. A new test case shows that we can statically lift methods in super-constructor calls, rather than just self-constructor calls. We also have to avoid statically lifting objects in these positions. For now, I just emit a dev warning that a VerifyError is in your future. With some more thought we could escalate that to a implementation restriction and emit an error.
| * | SI-3832 Extract tracking of under-construction classes to a mixinJason Zaugg2013-09-112-15/+21
| | | | | | | | | | | | In order to reduce the noise in OuterPathTransformer.
| * | SI-1909 Move tests from pos to runJason Zaugg2013-09-113-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | When we're in the neighbourhood of VerifyErrors, it's better to run the code. This change is leading up to a fix for SI-3832, which regressed with fix for SI-1909.
* | | Merge pull request #2931 from paulp/pr/TreeDSLJason Zaugg2013-09-1530-340/+343
|\ \ \ | | | | | | | | Reducing variation of tree creation methods.
| * | | Reducing variation of tree creation methods.Paul Phillips2013-09-1323-317/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TreeDSL has no future - it was always a temporary measure waiting for something like quasiquotes to come along. In this commit I cull as much of it as I can, especially the delicate matter of creating new DefDefs and ValDefs, which I completely turn over to the old style creators. I unified all the symbol-based DefDef and ValDef creators under a single method, since it was yet another place where ctrl-C and ctrl-V were being punched with glee. Was beaten to the punch on adding copyTypeDef to fill out the *Def creators. Eliminated as many redundant positioning calls as I could find. If you are creating a DefTree tree based on a symbol, it will always have an atPos(sym.pos) { ... } wrapped around it. You don't need another one. All of this is motivated by positions work: positions are assigned in so many places and in such an ad hoc fashion that it is impossible to bring consistency to that without first bringing some consistency to tree creation.
| * | | Widen type of outer accessor.Paul Phillips2013-09-132-3/+3
| | | | | | | | | | | | | | | | | | | | This is the key ingredient so TypeTree(sym) can resist widening the type.
| * | | Corrects behavior of finalResultType.Paul Phillips2013-09-1314-23/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation had come to depend on finalResultType accidentally doing things beyond its charter - in particular, widening types. After hunting down and fixing the call sites depending on the bugs, I was able to rewrite the method to do only what it's supposed to do. I threw in a different way of writing it entirely to suggest how some correctness might be obtained in the future. It's a lot harder for a method written like this to break.
* | | | Merge pull request #2945 from som-snytt/test/jsr223-serviceJason Zaugg2013-09-153-2/+13
|\ \ \ \ | | | | | | | | | | SI-7843 Restore JSR 223 service entry
| * | | | SI-7843 Restore JSR 223 service entrySom Snytt2013-09-143-2/+13
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 2.10 fix to remove the ScriptEngine service entry was inadvertently forwarded to 2.11. This commit reverts and adds a test. This situation was entirely foreseen by retronym, proving beyond doubt that he is in fact a time traveler, as hinted by his name. He brings bugs forward into the future and returns into the past with fixes and other alien technology like scalaz.
* | | | Merge pull request #2936 from paulp/pr/one-team-one-positionPaul Phillips2013-09-142-295/+206
|\ \ \ \ | |_|_|/ |/| | | Consolidate Position classes.
| * | | Removed deprecated calls.Paul Phillips2013-09-121-92/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And changed the implementation internal traits to private[util] rather than sealed because that's closer to the point. I would make them "private" except that this incurs "private type escapes scope" errors where private[util] does not. Also improved file organization.
| * | | Consolidate Position classes.Paul Phillips2013-09-122-302/+210
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having now been burned several times thinking I had a chunk of positions under my belt only to find my pants had vanished when I forged ahead, I am carving out some intermediate stages for positions. This one only reshuffles the internals. It consolidates almost all the behavior into one class, leaving little stub subclasses to mimic the classes which came before - since nothing is final or has access anything less than public, there's no way to touch any constructor without breakage, so they all have to stay. I removed redundant/incorrect documentation and rewrote the rest of it, although I don't expect the lifespan of any of it to be enormous. The overall thinking behind the existing design was a bit elusive. Concrete exception-throwing implementations were provided in the base class for every method, with less exceptional overrides defined in selected subclasses. If you're going to define every method in the base class, concretely no less, then there is little advantage and lots of disadvantage to spreading out over a bunch of subclasses. Note that now Position contains no state and has no constructor, characteristics which behoove its possibly distant ambition toward AnyValhood. Though that does ignore the "api" class it inherits which brims with implementation detail, api.Position. It is a burden which will likely prove heavy.
* | | Merge pull request #2943 from som-snytt/issue/7839-phase-ass-chkinitGrzegorz Kossakowski2013-09-131-1/+1
|\ \ \ | |/ / |/| | SI-7839 Final val breaks checkinit build
| * | SI-7839 Final val breaks checkinit buildSom Snytt2013-09-131-1/+1
|/ / | | | | | | | | | | | | | | | | Scalac does not care to initialize the unused field it emits for a `final val`. Users of the accessor method, which supplies the constant definition inline, will find that -Xcheckinit will throw. Therefore, we don't use `final` for the `val phaseName`.
* | Merge pull request #2859 from som-snytt/issue/7622-phaserGrzegorz Kossakowski2013-09-1252-264/+549
|\ \ | | | | | | SI-7622 Clean Up Phase Assembly
| * | Todo promote to partestSom Snytt2013-09-111-0/+1
| | |
| * | SI-7622 Scaladoc and error message polishSom Snytt2013-08-214-3/+12
| | | | | | | | | | | | Restores the verbiage "run right after".
| * | SI-7622 Clean Up Phase AssemblySom Snytt2013-08-2141-55/+277
| | | | | | | | | | | | | | | | | | | | | | | | Let optimiser components and continuations plugin opt-out when required flags are not set. Wasted time on a whitespace error in check file, so let --debug dump the processed check file and its diff.
| * | SI-7622 Plugins can be not enabledSom Snytt2013-08-214-27/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | Plugins can interrogate options and declare themselves not enabled. The plugin itself can return false from its init if the options do not compute. A plugin phase component can declare itself not enabled, same as an internal phase. No one exploits this facility at this commit.
| * | SI-7622 -Xshow-phases can show disabled phasesSom Snytt2013-08-211-36/+38
| | | | | | | | | | | | | | | | | | | | | With -Ydebug, -Xshow-phases will show phases that are skipped or not enabled. The code is slightly refactored, so the flags table will also benefit.
| * | SI-7622 Phases are enabled or notSom Snytt2013-08-219-74/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the calculation of the "phase chain" a bit. In particular, initial and terminal phases are not special except that they must be head and last. When done, filter for enabled phases. At this commit, nobody claims to be disabled. Additional sanity support of phases settings.
| * | SI-7622 -Xgenerate-phase-graph is an info optionSom Snytt2013-08-212-14/+20
| | | | | | | | | | | | | | | | | | | | | | | | -Xgenerate-phase-graph is comparable to -Xshow-phases. The knowledge about what is an info-only option is refactored to Settings, which also knows which group of options comprise the optimiser set.
| * | SI-7622 Phase assembly is testableSom Snytt2013-08-213-59/+37
| | | | | | | | | | | | | | | | | | | | | | | | Fixing hash on nodes makes fault detection deterministic, which aids testing. Error messages are shortened and .dot files are dumped automatically on faults to guard against future flakiness.
* | | Merge pull request #2928 from retronym/merge/2.10.x-to-masterGrzegorz Kossakowski2013-09-1216-178/+302
|\ \ \ | | | | | | | | merge 2.10.x to master
| * \ \ Merge remote-tracking branch 'origin/master' into merge/2.10.x-to-masterJason Zaugg2013-09-1177-757/+1345
| |\ \ \ | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
| * | | | Build partest-extras under `pack.done`Jason Zaugg2013-09-101-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... rather than just in `test.suite.init`. Now: % ant pack.done | egrep -i 'compiling|jar' desired.jars.uptodate: [quick.partest-extras] Compiling 1 file to /Users/jason/code/scala/build/quick/classes/partest-extras [jar] Building jar: /Users/jason/code/scala/build/pack/lib/scala-partest-extras.jar Note: Because of the recent changes to the way that the classpath or partest is build up (it is done via `ant test.suite.init`), partest no longer works with quick/classes, the classpath is always taken as `pack`. So `ant quick.bin && ./test/partest` is insufficient; you need to run `ant pack.done`, or just `ant` if you prefer brevity.
| * | | | Merge remote-tracking branch 'origin/2.10.x' into merge/2.10.x-to-masterJason Zaugg2013-09-1015-169/+286
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
| | * \ \ \ Merge pull request #2916 from retronym/ticket/7818Jason Zaugg2013-09-102-1/+16
| | |\ \ \ \ | | | | | | | | | | | | | | SI-7818 Cast our way out of extended existential angst
| | | * | | | SI-7818 Cast our way out of extended existential angstJason Zaugg2013-09-062-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `substituteSymbols` is not sophisticated enough to operate on `TypeSkolem`-s which are based on one of the "from" symbols. The pertinant usage of `substituteSymbols` for this bug in in `Extender`. Recapping on that transform: // orig class C[T](...) extends AnyVal { def foo[U] = <rhs> } // transform class C[T] extends AnyVal { ... } object C { def foo$extension[T', U'] = <rhs'> } Where `<rhs'>` has been subtituted with, among other things, `[T, U] ~> [T', U']`. In this case our expected type contains a new type parameter (of the extension method), whereas the type of the RHS contains an existential skolem still pinned to the corresponding class type parameter. tree.tpe = Observable1#7037[_$1#12344] <_$1#12344>.info = <: T#7040 pt = Observable1#7037[T#15644] The limitation of substution is lamented in the comments of `adaptMismatchedSkolems`, which faces the harder version of the issue where the skolems are in the expected type. But, we're in the "easy" case with the skolems in the tree's type; we can cast our way out of the problem. See also f335e447 / ed915c54.
| | * | | | | Merge pull request #2922 from huitseeker/issue/7767Jason Zaugg2013-09-103-0/+21
| | |\ \ \ \ \ | | | | | | | | | | | | | | | | SI-7767 avoid rejecting Scaladoc comments in early initializers
| | | * \ \ \ \ Merge pull request #1 from retronym/ticket/7767-testFrançois Garillot2013-09-092-0/+19
| | | |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | Test case for SI-7767
| | | | * | | | | SI-7767 Test case for Scaladoc on early initializersJason Zaugg2013-09-092-0/+21
| | | |/ / / / /
| | | * | | | | SI-7767 avoid rejecting Scaladoc comments in early initializersFrançois Garillot2013-09-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | review by @retronym
| | * | | | | | Merge pull request #2866 from retronym/ticket/7269Jason Zaugg2013-09-093-3/+37
| | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-7269 Rework MapLike#retains to account for desugaring change
| | | * | | | | | SI-7269 Rework MapLike#retains to account for desugaring changeJason Zaugg2013-08-293-3/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `MapLike#retains` contains a for-comprehension that relied on the strict `filter` by its generator. You can't, in general, iterate a mutable map and remove items in the same pass. Here's the history of the desugaring of: def retain[A, B](thiz: mutable.Map[A, B])(p: (A, B) => Boolean): thiz.type = { thiz.foreach { case (k, v) => if (p(k, v)) thiz -= k } Before regression (c82ecabad6~1): thiz.filter(((check$ifrefutable$1) => check$ifrefutable$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => true case _ => false })).withFilter(((x$1) => x$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang })).foreach(((x$2) => x$2: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k) })); After regression (c82ecabad6, which incorrectly assumed in the parser that no filter is required for isInstanceOf[Tuple2]) thiz.withFilter(((x$1) => x$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang })).foreach(((x$2) => x$2: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k) })); After the reversion of c82ecabad6, v2.10.2 This is also after 365bb2b4e, which uses `withFilter` rather than `filter`. thiz.withFilter(((check$q$1) => check$ifrefutable$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => true case _ => false })).withFilter(((x$1) => x$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang })).foreach(((x$2) => x$2: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k) })); This commit does the same as `SetLike#retains`, and converts the map to an immutable list before the rest of the operation.
| | * | | | | | | Merge pull request #2911 from retronym/ticket/7814Jason Zaugg2013-09-097-167/+214
| | |\ \ \ \ \ \ \ | | | |_|/ / / / / | | |/| | | | | | SI-7814 Avoid init cycle between Predef, `package`, ScalaRuntime
| | | * | | | | | SI-7814 Updates the instrumented version of ScalaRuntime.Jason Zaugg2013-09-055-156/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some tests for specialization use a modified version of the standard library that count boxing, array lookups etc. These sources are updated manually with the script: % test/instrumented/mkinstrumented.sh build Looks that that wasn't done for a while, though. This commit brings it up to date, and adjusts a few braces in ScalaRuntime.scala so the patch srt.scala (used by that script) is shorter. We should really avoid checking in the products of that script and run it as part of the build, or, better, use the bytecode instrumentation framework instead of a modified standard library. But I have to leave that for another day.
| | | * | | | | | SI-7814 Avoid init cycle between Predef, `package`, ScalaRuntimeJason Zaugg2013-09-053-11/+144
| | | | |/ / / / | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not every application will force these in a single thread; we have to do our best to avoid cycles between them. The enclosed test was failing every time before the change. This commit breaks the cycle by avoiding computing `tupleNames` in the constructor of `ScalaRuntime`. The new version has the added benefit of including specialized tuple subclasses, which is verified with a unit test for `isTuple`. Are there more of these lurking? It seems likely. I'm more than a little concerned about the way the `ControlThrowable` fires up `scala.SystemProperties` to check whether or not to suppress stack traces; there is already an ugly hack in place: object NoStackTrace { final def noSuppression = _noSuppression // two-stage init to make checkinit happy, // since sys.SystemProperties.noTraceSupression.value // calls back into NoStackTrace.noSuppression final private var _noSuppression = false _noSuppression = sys.SystemProperties.noTraceSupression.value }
| * | | | | | | Merge commit '7fa0e60' into merge/2.10.x-to-masterJason Zaugg2013-09-100-0/+0
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git merge -s ours 7fa0e60
| | * | | | | | Merge pull request #2895 from som-snytt/issue/7652-tools-jar-backportGrzegorz Kossakowski2013-09-082-13/+24
| | |\ \ \ \ \ \ | | | |/ / / / / | | |/| | | | | SI-7652 REPL tools jar backport
| | | * | | | | [nomaster] SI-7652 REPL extended quest for toolsSom Snytt2013-08-291-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Javap tries harder and fails louder when looking for tools.jar This is a backport of the method as it was first coded for partest. If JAVA_HOME is wrong, it will either fail with a message or succeed after rooting about. ``` apm@mara:~/tmp/q$ JAVA_HOME=$JAVA7_HOME JAVACMD='/usr/lib/jvm/java-6-openjdk-amd64/bin/java' /home/apm/projects/snytt/build/pack/bin/scala Welcome to Scala version 2.10.3-20130829-123337-59d6568daa (OpenJDK 64-Bit Server VM, Java 1.6.0_27). Type in expressions to have them evaluated. Type :help for more information. scala> :javap :javap [-lcsvp] [path1 path2 ...] scala> :javap java.lang.Object Failed: Could not load javap tool. Check that JAVA_HOME is correct. apm@mara:~/tmp/q$ JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64/jre JAVACMD='/usr/lib/jvm/java-6-openjdk-amd64/bin/java' /home/apm/projects/snytt/build/pack/bin/scala Welcome to Scala version 2.10.3-20130829-123337-59d6568daa (OpenJDK 64-Bit Server VM, Java 1.6.0_27). Type in expressions to have them evaluated. Type :help for more information. scala> scala> :javap :javap [-lcsvp] [path1 path2 ...] scala> :javap java.lang.Object Compiled from "Object.java" ```
| | | * | | | | [nomaster] SI-7652 Bad tools fails loudlySom Snytt2013-08-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A brief message is all that's required to alleviate the look of consternation on the face of your user.
* | | | | | | | Merge pull request #2905 from retronym/ticket/7801Grzegorz Kossakowski2013-09-123-4/+33
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-7801 Fix a nightmarish bug in Symbols#adaptInfos
| * | | | | | | | SI-7801 Fix a nightmarish bug in Symbols#adaptInfosJason Zaugg2013-09-043-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The compiler-in-residence has always been a sketchy affair; FSC and REPL offers a bounty of bugs that exploit the menagerie of time-travel mechanisms in play for symbols' metadata (type, flags, name and owner.) but are often cleverly masked by optimizations in the compiler based on reference equality. The latest: an innocuous change in Erasure: https://github.com/scala/scala/commit/d8b96bb8#commitcomment-3995163 means that some `ErasureMap`-s over `MethodType`-s are now true identities (as `UnitTpe` is always the same object, whereas `erasedTypeRef(UnitClass)` returns an different `TypeRef` each time.) This, in turn, enables `TypeMap#mapOver` to reuse the existing enclosing type, and so on. On such subtleties hinge further optimizations, such as whether or not a given phase's `InfoTransformer` needs to add an entry in a symbols type history. When the REPL (or FSC / Presentation Compiler) creates a new `Run`, `Symbol#rawInfo` tries to adapt the entries in the type history for the new run. For packages, this was taken to be a no-op; each entry is marked as being valid in the new run and no further action is taken. This logic lurks in `adaptInfos`. But, when the namer enters a new symbol in a package, it *mutates* the Scope of that package classes info `enteringTyper`. So the later entries in the type history *must* be invalidated and recomputed. We have two choices for a fix: 1) modify `Namers#enterInScope` to blow away the subsequent type history for the owning symbol after inserting the new member. Something like `owner.setInfo(owner.info)` would have the desired effect. 2) Change `adaptInfos` to be more conservative when it comes to package classes, and retain only the oldest entry in the type history. This commit goes for option 2.