summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #4093 from lrytz/t8960Lukas Rytz2014-11-066-6/+72
|\ | | | | SI-8960 Bring back the SerialVersionUID to anonymous function classes
| * SI-8960 Bring back the SerialVersionUID to anonymous function classesLukas Rytz2014-11-056-6/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In PR #1673 / 4267444, the annotation `SerialVersionId` was changed from a `StaticAnnotation` to `ClassFileAnnotation` in order to enforce annotation arguments to be constants. That was 2.11.0. The ID value in the AnnotationInfo moved from `args` to `assocs`, but the backend was not adjusted. This was fixed in PR #3711 / ecbc9d0 for 2.11.1. Unfortunately, the synthetic AnnotationInfo that is added to anonymous function classes still used the old constructor (`args` instead of `assocs`), so extracting the value failed, and no field was added to the classfile.
* | Merge pull request #4089 from gourlaysama/wip/t6626-scaladoc-throws-linksVlad Ureche2014-11-0534-74/+143
|\ \ | | | | | | SI-6626 make @throws tags create links to exceptions
| * | cleanup @throws tags in library and reflectAntoine Gourlay2014-11-0529-69/+71
| | | | | | | | | | | | | | | - there is no need for explicit links with [[ and ]] - there is no need for explicit backquoting
| * | SI-6626 make @throws tags create links to exceptionsAntoine Gourlay2014-11-055-5/+72
| |/ | | | | | | | | | | In scaladoc, this turns exceptions in @throws tags into links (when it can find the target exception), instead of just showing the name.
* | Merge pull request #4092 from som-snytt/issue/5217Lukas Rytz2014-11-051-0/+17
|\ \ | | | | | | SI-5217 Companion privates in scope of class parms
| * | SI-5217 Companion privates in scope of class parmsSom Snytt2014-11-041-0/+17
| | | | | | | | | | | | Test of the same. It progressed in 2.10.1.
* | | Merge pull request #4069 from som-snytt/issue/8898Lukas Rytz2014-11-056-175/+279
|\ \ \ | | | | | | | | SI-8898 javap -fun under new style lambdas
| * | | SI-8898 javap -fun under new style lambdasSom Snytt2014-11-046-175/+279
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support both -Ydelambdafy strategies, look for both inline (anonfun) and method (lambda) closure classes. For method (lambda) style, use the anonfun method that is invoked by the accessor. Also, the output of javap must be captured eagerly for filtering for the current target method. If the user asks for a module, e.g., `Foo$`, don't yield results for companion class, but for `Foo`, do yield companion module results. Just because.
* | | | Merge pull request #4044 from retronym/ticket/5091Lukas Rytz2014-11-053-0/+28
|\ \ \ \ | | | | | | | | | | SI-5091 Move named-args cycle test from pending to neg
| * \ \ \ Merge pull request #7 from lrytz/t6051Jason Zaugg2014-11-041-0/+19
| |\ \ \ \ | | | | | | | | | | | | SI-6051 Test case, the issue seems to be fixed.
| | * | | | SI-6051 Test case, the issue seems to be fixed.Lukas Rytz2014-11-041-0/+19
| | | | | |
| * | | | | SI-5091 Move named-args cycle test from pending to negJason Zaugg2014-10-102-0/+9
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a typechecking cycle, and since 4669ac180e5 we now report this in a clearer manner. Once we change the language to unconditionally interpret an assignent in argument position as a named argument would be the only way to get this over to `pos`.
* | | | | Merge pull request #4017 from lrytz/t6541Lukas Rytz2014-11-0510-18/+170
|\ \ \ \ \ | | | | | | | | | | | | SI-6541 valid wildcard existentials for case-module-unapply
| * | | | | SI-6541 valid wildcard existentials for case-module-unapplyLukas Rytz2014-11-055-6/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of letting the compiler infer the return type of case module unapply methods, provide them explicitly. This is enabled only under -Xsource:2.12, because the change is not source compatible.
| * | | | | Fix default value for ScalaVersionSettingLukas Rytz2014-11-045-12/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default value was NoScalaVersion before, because tryToSet (where the default was supposed to be set) is not called at all if the option is not specified. The initial value of Xmigration is set to NoScalaVersion (which it was before, the AnyScalaVersion argument was ignored). AnyScalaVersion would be wrong, it would give a warning in `Map(1 -> "eis").values` if the option was not specified. See tests.
* | | | | | Merge pull request #4066 from soc/SI-8927Lukas Rytz2014-11-046-51/+69
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8927 Update OSGi stuff to get rid of bndlib warning
| * | | | | | SI-8927 Update OSGi stuff to get rid of bndlib warningRafaƂ Krzewski2014-10-236-51/+69
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way the desired OSGi frameworks are chosen has changed between Pax Exam versions: On earlier versions, specifying it in code was fine, but PAX Exam 4.x runs the tests on the first OSGi framework it finds on classpath. An exclusion for the transitive dependency org.osgi.core was added, because it seems that artifact has broken dependecies (which would have brought us back to square one). Good thing is that it isn't needed here, because the OSGi framework JARs contain all necessary classes.
* | | | | | Merge pull request #4054 from soc/SI-8916Lukas Rytz2014-11-0437-62/+17
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8916 Clean up unused imports, values and variables
| * | | | | | SI-8916 Revert addition of -Ywarn-unused[-import]Simon Ochsenreither2014-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -Ywarn-unused-import: creates a bogues warning, see SI-7750 -Ywarn-unused: creates a lot of noise & has bugs, see SI-7707, SI-7712
| * | | | | | SI-8916 Further fixes with -Ywarn-unused includedSimon Ochsenreither2014-10-2411-18/+10
| | | | | | |
| * | | | | | SI-8916 Fix -Ywarn-unused-import warningsSimon Ochsenreither2014-10-2431-46/+9
| | | | | | |
* | | | | | | Merge pull request #4046 from gourlaysama/wip/t8711-version-unparseLukas Rytz2014-11-042-1/+19
|\ \ \ \ \ \ \ | |_|_|_|_|_|/ |/| | | | | | SI-8711 ScalaVersion.unparse doesn't produce valid versions
| * | | | | | SI-8711 ScalaVersion.unparse doesn't produce valid versionsAntoine Gourlay2014-10-132-1/+19
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no dot between `major.minor.rev` and `-build` in a scala version, yet that's what unparse returns for ``` // was "2.11.3.-SNAPSHOT" ScalaVersion("2.11.3-SNAPSHOT").unparse ```
* | | | | | Merge pull request #4036 from retronym/topic/opt-tail-callsJason Zaugg2014-11-046-20/+227
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8893 Restore linear perf in TailCalls with nested matches
| * | | | | | SI-8893 Test tailcall transform for mix of tail/non-tail recursionJason Zaugg2014-11-031-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Another excellent test suggestion by Dear Reviewer. After tail calls, the transform results in: ``` def tick(i: Int): Unit = { <synthetic> val _$this: Test.type = Test.this; _tick(_$this: Test.type, i: Int){ if (i.==(0)) () else if (i.==(42)) { Test.this.tick(0); _tick(Test.this, i.-(1).asInstanceOf[Int]()) } else _tick(Test.this, i.-(1).asInstanceOf[Int]()).asInstanceOf[Unit]() } }; ``` We test this by mostly exercising the tail-recursive code path with a level of recursion that would overflow the stack if we weren't using jumps.
| * | | | | | SI-8893 Test case to show that tailrec continues to workJason Zaugg2014-11-021-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As suggested during code review, this test checks that the tailcalls phase recurses appropriately below a method that doesn and does not itself tail call. The test case is based on the pattern of code that to trigger super-linear performance in this transform.
| * | | | | | Avoid wasteful array creation in backendJason Zaugg2014-10-101-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The iteration is only needed to side effect on `instructionList` and `code.touched`. This commit uses an iterator and `foreach`, rather than creating throwaway Arrays. % time (for f in {1..200}; do echo test/files/pos/t8893.scala; done | qscalac -Xresident) Before: 30s After : 21s
| * | | | | | SI-8893 Restore linear perf in TailCalls with nested matchesJason Zaugg2014-10-102-3/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compilation perfomance of the enclosed test regressed when the new pattern matcher was introduced, specifically when the tail call elimination phase was made aware of its tree shapes in cd3d34203. The code added in that commit detects an application to a tail label in order to treat recursive calls in the argument as in tail position. If the transform of that argument makes no change, it falls back to `rewriteApply`, which transforms the argument again (although this time on a non-tail-position context.) This commit avoids the second transform by introducing a flag to `rewriteApply` to mark the arguments are pre-transformed. I don't yet see how that fixes the exponential performance, as on the surface it seems like a constant factor improvement. But the numbers don't lie, and we can now compile the test case in seconds, rather than before when it was running for > 10 minutes. This test case was based on a code pattern generated by the Avro serializer macro in: https://github.com/paytronix/utils-open/tree/release/2014/ernststavrosgrouper The exponential performance in that context is visualed here: https://twitter.com/dridus/status/519544110173007872 Thanks for @rmacleod2 for minimizing the problem.
| * | | | | | Wider use of mapConserve and the like in TailCallsJason Zaugg2014-10-101-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Save the Trees! When a subtransform is an identity, we must strive to return the identical tree to enable the lazy part of LazyTreeCopier. If we get this wrong in a leaf, all parents are wastefully copied.
| * | | | | | Avoid needlessly deep chains of ClonedTailContextJason Zaugg2014-10-101-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I believe ClonedTailContext was added to avoid the need to mutate the Boolean `ctx.tailPos`. All other calls are forwarded to a delegate context. This commit tries to find a delegate context with the right value of `tailPos` to reuse that, rather than creating a wrapper each time we need to flip that bit.
| * | | | | | Optimize tail calls to avoid findMember callsJason Zaugg2014-10-102-0/+12
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cache the member symbols for `Boolean.{||, &&}` per-run, rather than look them up repeatedly. Based on profiling the tail calls phase in the program below, which was distilled by @rmacleod2 from the code generated by macros in https://github.com/paytronix/utils-open/tree/release/2014/ernststavrosgrouper Wall clock time went from 12s to 6.5s. ```scala object Test { def a(): Option[String] = Some("a") def main(args: Array[String]) { a() match { case Some(b1) => a() match { case Some(b2) => a() match { case Some(b3) => a() match { case Some(b4) => a() match { case Some(b5) => a() match { case Some(b6) => a() match { case Some(b7) => a() match { case Some(b8) => a() match { case Some(b9) => a() match { case Some(b10) => a() match { case Some(b11) => a() match { case Some(b12) => a() match { case Some(b13) => a() match { case Some(b14) => a() match { case Some(b15) => a() match { case Some(b16) => a() match { case Some(b17) => a() match { case Some(b18) => a() match { case Some(b19) => a() match { case Some(b20) => println("yay") case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } case None => None } } } ```
* | | | | | Merge pull request #4052 from Lymia/issue/8910Jason Zaugg2014-11-042-4/+26
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8910 BitSet sometimes uses exponential memory.
| * | | | | | SI-8910 BitSet sometimes uses exponential memory.Alissa Rao2014-10-152-4/+26
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because of an off-by-one error in scala.collection.mutable.BitSet, where a function (ensureCapacity) is passed a list length instead of an index, when ^=, &=, |=, or &~= are passed BitSets with the same internal capacity as the set the method is being invoked on, the size of the first BitSet is needlessly doubled. This patch simply changes the ensureCapacity calls to pass the last index of the list, instead of the raw length. In addition, add documentation to ensureCapacity to try and stop something similar from happening in the future.
* | | | | | Merge pull request #4087 from lrytz/intellijJason Zaugg2014-11-0422-3/+564
|\ \ \ \ \ \ | | | | | | | | | | | | | | IntelliJ IDEA files for version 14
| * | | | | | IntelliJ IDEA files for version 14Lukas Rytz2014-11-0322-3/+564
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The latest version of the Scala plugin for IntelliJ IDEA introduces a new project structure http://blog.jetbrains.com/scala/2014/10/30/scala-plugin-update-for-intellij-idea-14-rc-is-out/ Due to a bug (https://youtrack.jetbrains.com/issue/SCL-7753), you currently need to install the latest nightly build from here: http://confluence.jetbrains.com/display/SCA/Scala+Plugin+Nightly+Builds+for+Cassiopeia The new format doesn't allow scala compiler options per-module, so the `-sourcepath src/libarary` is used for all modules.
* | | | | | Merge pull request #4045 from gourlaysama/wip/t8875-show-codeJason Zaugg2014-11-042-1/+8
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8875 showCode should print all class constructor modifiers.
| * | | | | | SI-8875 showCode should print all class constructor modifiers.Antoine Gourlay2014-10-242-1/+8
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | showCode used to print nothing when the only modifier was a change in visibility scope (i.e. no flags but privateWithin is set).
* | | | | | Merge pull request #4063 from som-snytt/issue/direct-showdef-testJason Zaugg2014-11-042-36/+24
|\ \ \ \ \ \ | | | | | | | | | | | | | | Make global-showdef a DirectTest
| * | | | | | Reduce compiles for global-showdef testSom Snytt2014-10-282-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | You can only show one class or object at a time, but we can show one of each to reduce the compilations for this test. It seems the original issue happened because the test started to create class files after SI-8217. So, also stop compile after typer, because why stress the kitteh.
| * | | | | | Make global-showdef a DirectTestSom Snytt2014-10-281-32/+18
| | |_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test test/files/run/global-showdef.scala was outputting to the cwd instead of the test output dir. Good behavior is now inherited from DirectTest. Test frameworks, of any ilk or capability, rock.
* | | | | | Merge pull request #4064 from xuwei-k/typo-representationJason Zaugg2014-11-041-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | fix typo. s/represenation/representation
| * | | | | | fix typo. s/represenation/representationxuwei-k2014-10-201-1/+1
| | |/ / / / | |/| | | |
* | | | | | Merge pull request #4072 from soc/SI-4950Jason Zaugg2014-11-042-0/+21
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | SI-4950 Add tests, looks like it has been fixed earlier
| * | | | | SI-4950 Add tests, looks like it has been fixed earlierSimon Ochsenreither2014-10-232-0/+21
| | | | | |
* | | | | | Merge pull request #4081 from retronym/ticket/8943Jason Zaugg2014-11-025-0/+44
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8943 Handle non-public case fields in pres. compiler
| * | | | | | SI-8943 Handle non-public case fields in pres. compilerJason Zaugg2014-10-295-0/+44
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a case class is type checked, synthetic methods are added, such as the `hashCode`/`equals`, implementations of the `Product` interface. At the same time, a case accessor method is added for each non-public constructor parameter. This the accessor for a parameter named `x` is named `x$n`, where `n` is a fresh suffix. This is all done to retain universal pattern-matchability of case classes, irrespective of access. What is the point of allowing non-public parameters if pattern matching can subvert access? I believe it is to enables private setters: ``` case class C(private var x: String) scala> val x = new C("") x: C = C() scala> val c = new C("") c: C = C() scala> val C(x) = c x: String = "" scala> c.x <console>:11: error: variable x in class C cannot be accessed in C c.x ^ scala> c.x = "" <console>:13: error: variable x in class C cannot be accessed in C val $ires2 = c.x ^ <console>:10: error: variable x in class C cannot be accessed in C c.x = "" ^ ``` Perhaps I'm missing additional motivations. If you think scheme sounds like a binary compatiblity nightmare, you're right: https://issues.scala-lang.org/browse/SI-8944 `caseFieldAccessors` uses the naming convention to find the right accessor; this in turn is used in pattern match translation. The accessors are also needed in the synthetic `unapply` method in the companion object. Here, we must tread lightly to avoid triggering a typechecking cycles before; the synthesis of that method is not allowed to force the info of the case class. Instead, it uses a back channel, `renamedCaseAccessors` to see which parameters have corresonding accessors. This is pretty flaky: if the companion object is typechecked before the case class, it uses the private param accessor directly, which it happends to have access to, and which duly gets an expanded name to allow JVM level access. If the companion appears afterwards, it uses the case accessor method. In the presentation compiler, it is possible to typecheck a source file more than once, in which case we can redefine a case class. This uses the same `Symbol` with a new type completer. Synthetics must be re-added to its type. The reported bug occurs when, during the second typecheck, an entry in `renamedCaseAccessors` directs the unapply method to use `x$1` before it has been added to the type of the case class symbol. This commit clears corresponding entries from that map when we detect that we are redefining a class symbol. Case accessors are in need of a larger scale refactoring. But I'm leaving that for SI-8944.
* | | | | | Merge pull request #4079 from retronym/ticket/8941Jason Zaugg2014-11-028-9/+173
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8941 Idempotent presentation compilation of implicit classes
| * | | | | | SI-8941 Deterministic tests for pres. compiler idempotencyJason Zaugg2014-10-283-2/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A retrospective test case which covers typechecking idempotency which was introduced in 0b78a0196 / 148736c3df. It also tests the implicit class handling, which was fixed in the previous commit. It is difficult to test this using existing presentation compiler testing infrastructure, as one can't control at which point during the first typechecking the subesquent work item will be noticed. Instead, I've created a test with a custom subclass of `interactive.Global` that allows precise, deterministic control of when this happens. It overrides `signalDone`, which is called after each tree is typechecked, and watches for a defintion with a well known name. At that point, it triggers a targetted typecheck of the tree marked with a special comment. It is likely that this approach can be generalized to a reusable base class down the track. In particular, I expect that some of the nasty interactive ScalaDoc bugs could use this single-threaded approach to testing the presentation compiler.
| * | | | | | SI-8941 Idempotent presentation compilation of implicit classesJason Zaugg2014-10-286-7/+43
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we name an implicit class, `enterImplicitWrapper` is called, which enters the symbol for the factory method into the owning scope. The tree defining this factory method is stowed into `unit.synthetics`, from whence it will be retrieved and incorporated into the enclosing tree during typechecking (`addDerivedTrees`). The entry in `unit.synthetics` is removed at that point. However, in the presentation compiler, we can typecheck a unit more than once in a single run. For example, if, as happens in the enclosed test, a call to ask for a type at a given position interrupts type checking of the entire unit, we can get into a situation whereby the first type checking invocation has consumed the entry from `unit.synthetics`, and the second will crash when it can't find an entry. Similar problems have been solved in the past in `enterExistingSym` in the presentation compiler. This method is called when the namer encounters a tree that already has a symbol attached. See 0b78a0196 / 148736c3df. This commit takes a two pronged approach. First, `enterExistingSym` is extended to handle implicit classes. Any previous factory method in the owning scope is removed, and `enterImplicitWrapper` is called to place a new tree for the factory into `unit.synthetics` and to enter its symbol into the owning scope. Second, the assertions that could be tripped in `addDerivedTrees` and in `ImplicitClassWrapper#derivedSym` have been converted to positioned errors. The first change is sufficient to fix this bug, but the second is also enough to make the enclosed test pass, and has been retained as an extra layer of defence.