summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | | | SI-7683 Enable -Ystop-before:typerSom Snytt2014-12-015-3/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows a plugin to run before typer without incurring typechecking. The test is that a plugin doesn't run when stopping after parser, and that the truncated compilation run also succeeds, since updating check files for the output of -Xshow-phases is tedious.
* | | | | | | | | Merge pull request #4185 from som-snytt/issue/9027Grzegorz Kossakowski2014-12-043-4/+37
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-9027 Parser no longer consumes space after multi XML elements
| * | | | | | | | | SI-9027 Parser eagerly consumes space on multi XML elementsSom Snytt2014-12-033-4/+37
| |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Once the parser starts looking for more <elements>, it should still lookahead speculatively, leaving any remaining whitespace, including newlines, after the last element.
* | | | | | | | | Merge pull request #4061 from maxcom/SI-8924-list-iterator-oomJason Zaugg2014-12-042-4/+59
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-8924 don't hold reference to list in iterator
| * | | | | | | | | SI-8924 don't hold reference to list in iteratorMaxim Valyanskiy2014-11-272-4/+59
| | |_|/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current implementation of LinearSeqLike.iterator holds reference to complete sequence. This prevent garbage collecting of List elements while we keep reference to iterator somewhere. This commit removes reference from Iterator implementation. This allow garbage collection of List while we iterating over its elements (when there is no other references to List in our program).
* | | | | | | | | Merge pull request #4164 from retronym/ticket/9003Adriaan Moors2014-12-034-1/+81
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-9003 Eagerly capture more potentially mutable binders
| * | | | | | | | | SI-9003 Eagerly capture more potentially mutable bindersJason Zaugg2014-11-264-1/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a re-run of SI-5158 in two different contexts. As reported, the result of `unapply[Seq]` under name based pattern matching might not guarantee stability of results of calls to `_1`, `apply(i)`, etc, so we call these eagerly, and call them once only. I also found a case in regular pattern matching that we hadn't accounted for: extracting elements of sequences (either from a case class or from an `unapplySeq`) may also be unstable. This commit changes `ExtractorTreeMaker` to force storage of such binders, even under `-optimize`. This parallels the change to `ProductExtractorTreeMaker` in 8ebe8e3e8. I have added a special case for traditional `unapply` methods returning `Option`. This avoids a change for: ``` % cat test/files/run/t9003b.scala object Single { def unapply(a: Any) = Some("") } object Test { def main(args: Array[String]): Unit = { "" match { case Single(x) => (x, x) } } } % qscalac -optimize -Xprint:patmat test/files/run/t9003b.scala 2>&1 | grep --context=5 get case <synthetic> val x1: Any = ""; case5(){ <synthetic> val o7: Some[String] = Single.unapply(x1); if (o7.isEmpty.unary_!) matchEnd4({ scala.Tuple2.apply[String, String](o7.get, o7.get); () }) else case6() }; % scalac-hash v2.11.4 -optimize -Xprint:patmat test/files/run/t9003b.scala 2>&1 | grep --context=5 get case <synthetic> val x1: Any = ""; case5(){ <synthetic> val o7: Some[String] = Single.unapply(x1); if (o7.isEmpty.unary_!) matchEnd4({ scala.Tuple2.apply[String, String](o7.get, o7.get); () }) else case6() }; ```
* | | | | | | | | | Merge pull request #4178 from retronym/ticket/9018Jason Zaugg2014-12-032-2/+30
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | SI-9018 Fix regression: cycle in LUBs
| * | | | | | | | | | SI-9018 Fix regression: cycle in LUBsJason Zaugg2014-12-032-2/+30
| | |_|_|_|_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Regressed in 4412a92d, which admirably sought to impose some structure on the domain of depths, but failed to preserve an imporatnt part of said structure. When calculating LUBs and GLBs, the recursion depth is limited by propagating a decreasing depth parameter. Its initial value is the recursion limit, and is calcluated from the maximum depth of the types fed into the calculation. Here are a few examples that give a flavour of this calculation: ``` scala> class M[A] defined class M scala> class N extends M[M[M[M[A]]]] <console>:34: error: not found: type A class N extends M[M[M[M[A]]]] ^ scala> class N extends M[M[M[M[Int]]]] defined class N scala> lubDepth(typeOf[N] :: Nil) res5: scala.reflect.internal.Depth = Depth(4) scala> type T = M[Int] with M[M[Int]] defined type alias T scala> lubDepth(typeOf[T] :: Nil) res7: scala.reflect.internal.Depth = Depth(3) ``` One parts of the LUB calculation, `lub0`, truncates the lub to `Any` when the depth dives below zero. Before 4412a92d: ------------------ value decr incr ------------------ -3 -3 -2 (= AnyDepth) -2 -3 -1 -1 -2 0 0 -1 1 1 0 2 ... After 4412a92d: ----------------------- value decr incr ----------------------- -MaxInt -MaxInt -MaxInt (= AnyDepth) 0 -MaxInt 1 1 0 2 ... The crucial difference that triggered the regression is that decrementing a depth of zero now goes to the sentinel value, `AnyDepth`, rather than to `-1`. This commit modifies `Depth` to allow it to represent any negative depth. It also switches the sentinel value for `AnyDepth`. Even though I don't believe it is needed, I have also allowed for `Depth.Zero.decr.decr.decr == Depth.AnyVal`, which was historically the case in 2.10.4. To better understand what was happening, I added tracing to the calculation and diffed the before and after: https://gist.github.com/retronym/ec59608eecc52bb497fa Notice that when `elimSub(ts, depth = 0)` recursively calls `lub`, it does so with the variant that caluculates the allowable depth from the shape of the given types. We can then infinitely recurse. Before 4412a92d: ``` |-- elimSub(depth = 0, ts = List(Comparable[_ >: TestObject.E.Value with String <: Comparable[_ >: TestObject.E.Valu | |-- lub(depth = -1, ts = List(TestObject.E.Value with String, TestObject.C)) | | |-- lub0(depth = -1, ts0 = List(TestObject.E.Value with String, TestObject.C)) | | | |-- elimSub(depth = -1, ts = List(TestObject.E.Value with String, TestObject.C)) | | | |== List(TestObject.E.Value with String, TestObject.C) | | | |-- Truncating LUB to | | | |== Any | | |== Any | |== Any |== List(Comparable[_ >: TestObject.E.Value with String <: Comparable[_ >: TestObject.E.Value with String <: java.io |-- lub(depth = 0, ts = List(java.lang.type, java.lang.type)) | |-- lub0(depth = 0, ts0 = List(java.lang.type, java.lang.type)) | | |-- elimSub(depth = 0, ts = List(java.lang.type, java.lang.type)) | | |== List(java.lang.type) | |== java.lang.type |== java.lang.type |-- elimSub(depth = 0, ts = List(Object, Object)) |== List(Object) |-- elimSub(depth = 0, ts = List(Any, Any)) |== List(Any) ``` After 4412a92d: ``` |-- elimSub(depth = 0, ts = List(Comparable[_ >: TestObject.E.Value with String <: Comparable[_ >: TestObject.E.Valu | |-- lub(depth = _, ts = List(TestObject.E.Value with String, TestObject.C)) | | |-- lub(depth = 3, ts = List(TestObject.E.Value with String, TestObject.C)) | | | |-- lub0(depth = 3, ts0 = List(TestObject.E.Value with String, TestObject.C)) | | | | |-- elimSub(depth = 3, ts = List(TestObject.E.Value with String, TestObject.C)) | | | | |== List(TestObject.E.Value with String, TestObject.C) | | | | |-- lub1(depth = 3, ts = List(TestObject.E.Value with String, TestObject.C)) | | | | | |-- elimSub(depth = 3, ts = List(scala.math.Ordered[TestObject.E.Value], scala.math.Orde | | | | | |== List(scala.math.Ordered[TestObject.E.Value], scala.math.Ordered[TestObject.C]) ```
* | | | | | | | | | Merge pull request #4174 from kanielc/SI-8995Adriaan Moors2014-12-011-1/+1
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | SI-8995: Fix broken link in error message
| * | | | | | | | | | SI-8995: Fix broken link in error messageDenton Cockburn2014-11-301-1/+1
| |/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change broken link to scala-xml documentation by pointing instead to scala-xml project.
* | | | | | | | | | Merge pull request #4166 from lpiepiora/update-scaladoc-examplesAdriaan Moors2014-12-0110-35/+35
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Update ScalaDoc code examples not to use deprecated constructs
| * | | | | | | | | | Update ScalaDoc code examples not to use deprecated constructsLukasz Piepiora2014-11-2610-35/+35
| | |/ / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Replace newTermName in favour of TermName - Replace newTypeName in favour of TypeName
* | | | | | | | | | Merge pull request #4179 from gdickinson/remove_commented_priorityqueue_codeAdriaan Moors2014-12-012-380/+0
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Remove commented priorityqueue code
| * | | | | | | | | | Remove completely commented-out test/run fileGuy Dickinson2014-12-011-373/+0
| | | | | | | | | | |
| * | | | | | | | | | Remove commented-out debugging code in PriorityQueueGuy Dickinson2014-12-011-7/+0
| | |/ / / / / / / / | |/| | | | | | | |
* | | | | | | | | | Merge pull request #4173 from kanielc/SI-7988Adriaan Moors2014-12-011-2/+2
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | SI-7988 - scala.collection.JavaConverters spelling mistake
| * | | | | | | | | | SI:7988 - scala.collection.JavaConverters spelling mistakeDenton Cockburn2014-11-301-2/+2
| |/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed typo and cleaned up the grammar in the paragraph
* | | | | | | | | | Merge pull request #4143 from Ichoran/issue/8695Adriaan Moors2014-12-011-1/+9
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | SI-8695 SeqLike has unintuitive implementation of combinations
| * | | | | | | | | | SI-8695 SeqLike has unintuitive implementation of combinationsRex Kerr2014-11-231-1/+9
| | |_|_|_|/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | Clarified what `combinations` means in the docs.
* | | | | | | | | | Merge pull request #4172 from advancedxy/spec-fixAdriaan Moors2014-12-012-2/+2
|\ \ \ \ \ \ \ \ \ \ | |_|/ / / / / / / / |/| | | | | | | | | add 0X... for hex number literal
| * | | | | | | | | add 0X...hex number literal in syntax summaryYe Xianjin2014-11-301-1/+1
| | | | | | | | | |
| * | | | | | | | | add 0X... for hex number literalYe Xianjin2014-11-291-1/+1
| | |_|_|_|_|/ / / | |/| | | | | | |
* | | | | | | | | Merge pull request #4149 from Ichoran/issue/8754Grzegorz Kossakowski2014-11-283-17/+26
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-8754 linear seqs aren't
| * | | | | | | | | SI-8754 linear seqs aren'tRex Kerr2014-11-263-17/+26
| | |/ / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | LinearSeqLike still isn't exactly linear (LinearSeqOptimized is), but at least the docs now give reasonably correct information about what is actually going on.
* | | | | | | | | Merge pull request #4112 from retronym/ticket/8502Grzegorz Kossakowski2014-11-286-13/+74
|\ \ \ \ \ \ \ \ \ | |_|_|_|_|_|_|/ / |/| | | | | | | | SI-8502 Improve resiliance to absent packages
| * | | | | | | | SI-8502 Improve resiliance to absent packagesJason Zaugg2014-11-286-13/+74
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When unpickling a class, we create stub symbols for references to classes absent from the current classpath. If these references only appear in method signatures that aren't called, we can proceed with compilation. This is in line with javac. We're getting better at this, but there are still some gaps. This bug is about the behaviour when a package is completely missing, rather than just a single class within that package. To make this work we have to add two special cases to the unpickler: - When unpickling a `ThisType`, convert a `StubTermSymbol` into a `StubTypeSymbol`. We hit this when unpickling `ThisType(missingPackage)`. - When unpickling a reference to `<owner>.name` where `<owner>` is a stub symbol, don't call info on that owner, but rather allow the enclosing code in `readSymbol` fall through to create a stub for the member. The test case was distilled from an a problem that a Spray user encountered when Akka was missing from the classpath. Two existing test cases have progressed, and the checkfiles are accordingly updated.
* | | | | | | | Merge pull request #4170 from retronym/ticket/disable-8946Jason Zaugg2014-11-281-0/+0
|\ \ \ \ \ \ \ \ | |_|_|_|/ / / / |/| | | | | | | SI-8946 Disable flaky test for reflection memory leak
| * | | | | | | SI-8946 Disable flaky test for reflection memory leakJason Zaugg2014-11-281-0/+0
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It passed in PR validation but failed in a later run. There are some clever ideas bouncing around to make it stable, but in the meantime I'll shunt it into disabled.
* | | | | | | Merge pull request #3934 from teemulehtinen/fsc-port-argGrzegorz Kossakowski2014-11-265-27/+54
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | FSC server port selected by argument
| * | | | | | | Add option -port to fscTeemu Lehtinen2014-10-135-27/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Option "port" limits compile server lookup and start to given port. Normally fsc will start a compile server in a random port if no server is yet running. This can be problematic with firewalls and/or remote compile servers. Option "port" should not be confused with option "server" which looks for a compile server in given host and port and fails if such server is not found. Automatic tests for command line user interface do not exist at all. Thus, adding a test for one new option would require designing a whole new testing method.
* | | | | | | | Merge pull request #4130 from mpociecha/let-specify-build-repos-homeGrzegorz Kossakowski2014-11-262-2/+5
|\ \ \ \ \ \ \ \ | |_|_|/ / / / / |/| | | | | | | Let users specify a different location for build repos than user home
| * | | | | | | Let users specify a different location for build repos than user homempociecha2014-11-122-2/+5
| | |_|_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change is helpful e.g. when setting up CI for Scala and it's important which directories are used by a build. By default it uses .m2, .pax and .sbt/cache from user home (in general $HOME). Sometimes it's not possible to use this location and also changing a value of $HOME is not an option. The required location should be specified both for ant's build.xml and used scripts. In the first case specifying -Duser.home is all, what we need. But we can't just set _JAVA_OPTIONS as then partest tests fail due to the unexpected output (an additional 'Picked up java options (...)' messages). We can set ANT_OPTS instead of this. The only problem was that OSGi JUnit tests (only they) were using $HOME anyway. I forced them to use -Duser.home by propagating this option in build.xml. binary-repo-lib.sh is changed to use a special env variable or $HOME, when this variable is not set. Then we can do: export SCALA_BUILD_REPOS_HOME=<some_dir> export ANT_OPTS="$ANT_OPTS -Duser.home=$SCALA_BUILD_REPOS_HOME" ant dist and it will create all directories .m2, .pax and .sbt/cache in a specified $SCALA_BUILD_REPOS_HOME directory. Note: maven's settings.xml should be located in this used $SCALA_BUILD_REPOS_HOME/.m2 and point to the repository like <some_dir>/.m2/repository
* | | | | | | Merge pull request #4148 from SpinGo/issue/SI-8946Jason Zaugg2014-11-263-2/+40
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | | | SI-8946: Fixes memory leak when using reflection
| * | | | | | Fixes memory leak when using reflectionTim Harper2014-11-223-2/+40
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | References to Threads would be retained long after their termination if reflection is used in them. This led to a steady, long memory leak in applications using reflection in thread pools.
* | | | | | Merge pull request #4151 from som-snytt/issue/5205Adriaan Moors2014-11-241-3/+1
|\ \ \ \ \ \ | |/ / / / / |/| | | | | SI-5205 Finish applying octal deletion
| * | | | | SI-5205 Finish applying octal deletionSom Snytt2014-11-231-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original PR was partially applied to markdown. https://github.com/scala/scala-dist/pull/103
* | | | | | Merge pull request #4084 from vigdorchik/usecase_sigsGrzegorz Kossakowski2014-11-2117-12/+33
|\ \ \ \ \ \ | | | | | | | | | | | | | | Correct collections variable definitions to avoid many scaladoc warnings.
| * | | | | | Correct collections variable definitions to avoid many scaladoc warnings.Eugene Vigdorchik2014-11-0617-12/+33
| | |_|_|_|/ | |/| | | |
* | | | | | Merge pull request #4121 from retronym/ticket/5938Grzegorz Kossakowski2014-11-211-0/+35
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-5938 Test for a FSC bug with mixin, duplicate static forwarders
| * | | | | | SI-5938 Test for a FSC bug with mixin, duplicate static forwardersJason Zaugg2014-11-091-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under resident compilation, we were getting multiple copies of static forwarders created for mixed in methods. It seems like the bug was fixed as a by-product of #4040. This commit adds a test to show this. I've confirmed that the test fails appropriately with 2.11.4. For future reference, before I figured out how to write the test for this one (test/resident doesn't seem to let you run the code after compiling it), I was using bash to test as follows: (export V=2.11.x; (scalac-hash $V sandbox/t5938_1.scala; (for i in 1 2; do echo sandbox/t5938.scala; done; printf '\n') | scalac-hash $V -Xresident); stty echo; scala-hash $V X ; echo ':javap -public X' | scala-hash $V);
* | | | | | | Merge pull request #4099 from retronym/ticket/7596Grzegorz Kossakowski2014-11-217-1/+66
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-7596 Curtail overloaded symbols during unpickling
| * | | | | | | SI-7596 Curtail overloaded symbols during unpicklingJason Zaugg2014-11-067-1/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In code like: object O { val x = A; def x(a: Any) = ... } object P extends O.x.A The unpickler was using an overloaded symbol for `x` in the parent type of `P`. This led to compilation failures under separate compilation. The code that leads to this is in `Unpicklers`: def fromName(name: Name) = name.toTermName match { case nme.ROOT => loadingMirror.RootClass case nme.ROOTPKG => loadingMirror.RootPackage case _ => adjust(owner.info.decl(name)) } This commit filters the overloaded symbol based its stability unpickling a singleton type. That seemed a slightly safer place than in `fromName`.
* | | | | | | | Merge pull request #4138 from stevegury/patch-1Grzegorz Kossakowski2014-11-211-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix one typo in the scaladoc of Inliners
| * | | | | | | | Fix one typo in the scaladoc of InlinersSteve Gury2014-11-201-1/+1
| | |_|_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | The Scaladoc of `Inliners` contained one tiny typo for the word "accessibility". This PR only fixes this typo.
* | | | | | | | Merge pull request #4115 from retronym/ticket/8597Grzegorz Kossakowski2014-11-219-6/+137
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | SI-8597 Improved pattern unchecked warnings
| * | | | | | | SI-8597 Expand documentation of CheckabilityCheckerJason Zaugg2014-11-181-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cherry picking some of the previous commit message.
| * | | | | | | SI-8597 Improved pattern unchecked warningsJason Zaugg2014-11-099-5/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The spec says that `case _: List[Int]` should be always issue an unchecked warning: > Types which are not of one of the forms described above are > also accepted as type patterns. However, such type patterns > will be translated to their erasure (§3.7). The Scala compiler > will issue an “unchecked” warning for these patterns to flag > the possible loss of type-safety. But the implementation goes a little further to omit warnings based on the static type of the scrutinee. As a trivial example: def foo(s: Seq[Int]) = s match { case _: List[Int] => } need not issue this warning. These discriminating unchecked warnings are domain of `CheckabilityChecker`. Let's deconstruct the reported bug: def nowarn[T] = (null: Any) match { case _: Some[T] => } We used to determine that if the first case matched, the scrutinee type would be `Some[Any]` (`Some` is covariant). If this statically matches `Some[T]` in a pattern context, we don't need to issue an unchecked warning. But, our blanket use of `existentialAbstraction` in `matchesPattern` loosened the pattern type to `Some[Any]`, and the scrutinee type was deemed compatible. I've added a new method, `scrutConformsToPatternType` which replaces pattern type variables by wildcards, but leaves other abstract types intact in the pattern type. We have to use this inside `CheckabilityChecker` only. If we were to make `matchesPattern` stricter in the same way, tests like `pos/t2486.scala` would fail. I have introduced a new symbol test to (try to) identify pattern type variables introduced by `typedBind`. Its not pretty, and it might be cleaner to reserve a new flag for these. I've also included a test variation exercising with nested matches. The pattern type of the inner case can't, syntactically, refer to the pattern type variable of the enclosing case. If it could, we would have to be more selective in our wildcarding in `ptMatchesPatternType` by restricting ourselves to type variables associated with the closest enclosing `CaseDef`. As some further validation of the correctness of this patch, four stray warnings have been teased out of neg/unchecked-abstract.scala I also had to changes `typeArgsInTopLevelType` to extract the type arguments of `Array[T]` if `T` is an abstract type. This avoids the "Checkability checker says 'Uncheckable', but uncheckable type cannot be found" warning and consequent overly lenient analysis. Without this change, the warning was suppressed for: def warnArray[T] = (null: Any) match { case _: Array[T] => }
* | | | | | | | Merge pull request #4123 from retronym/ticket/8253Jason Zaugg2014-11-204-1/+58
|\ \ \ \ \ \ \ \ | |_|_|_|_|_|_|/ |/| | | | | | | SI-8253 Fix incorrect parsing of <elem xmlns={f("a")}/>
| * | | | | | | SI-8253 Fix incorrect parsing of <elem xmlns={f("a")}/>Jason Zaugg2014-11-104-1/+58
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The spliced application was placed in the `attrMap` in `SymbolicXMLBuilder` and later incorrectly matched by a pattern intended only to match: xml.Text(s) That attribute value is generated by parsing: <elem xmlns='a'/> So the net effect was that the two fragments of XML were identical! This commit sharpens up the match to really look for a syntactic `_root_.scala.xml.Text("...")`. The test just prints the parse trees of a variety of cases, as we we should not test the modularized XML library in scala/scala.