summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* SI-5639 Fix spurious discarding of implicit importJason Zaugg2014-11-099-15/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Scala fa0cdc7b (just before 2.9.0), a regression in implicit search, SI-2866, was discovered by Lift and fixed. The nature of the regression was that an in-scope, non-implicit symbol failed to shadow an eponymous implicit import. The fix for this introduced `isQualifyingImplicit` which discards in-scope implicits when the current `Context`'s scope contains a name-clashing entry. Incidentally, this proved to be a shallow solution, and we later improved shadowing detection in SI-4270 / 9129cfe9. That picked up cases where a locally defined symbol in an intervening scope shadowed an implicit. This commit includes the test case from the comments of SI-2866. Part of it is tested as a neg test (to test reporting of ambiguities), and the rest is tested in a run test (to test which implicits are picked.) However, in the test case of SI-5639, we see that the scope lookup performend by `isQualifyingImplicit` is fooled by a "ghost" module symbol. The apparition I'm referring to is entered when `initializeFromClassPath` / `enterClassAndModule` encounters a class file named 'Baz.class', and speculatively enters _both_ a class and module symbol. AFAIK, this is done to defer parsing the class file to determine what inside. If it happens to be a Java compiled class, the module symbol is needed to house the static members. This commit adds a condition that `Symbol#exists` which shines a torch (forces the info) in the direction of the ghost module symbol. In our test, this causes it to vanish, as we only need a class symbol for the Scala defined `class Baz`. The existing `pos` test for this actually did not exercise the bug, separate compilation is required. It was originally checked in to `pending` with this error, and then later moved to `pos` when someone noticed it was not failing.
* Merge pull request #4105 from gourlaysama/wip/t5730-scaladoc-sealed-ctorVlad Ureche2014-11-073-2/+41
|\ | | | | SI-5730 hide constructors of sealed abstract classes in scaladoc
| * SI-5730 hide constructors of sealed abstract classes in scaladocAntoine Gourlay2014-11-073-2/+41
|/ | | | | | | | | | | | | | Sealed abstract classes (like `List`) have a primary constructor, public by default. It can never be called by external code but it shows up in the scaladoc as a nice `new List()` construtor... If a class is only abstract, the constructor is still useful because people can subclass and call it. If it is only sealed (i.e. effectively final), then it is the normal constructor of a final class. But sealed *and* abstract makes documenting the constructor useless. This should remove the misleading constructors of `List`, `Double`, `Option` and others from the scaladoc.
* Merge pull request #4058 from som-snytt/issue/verbose-loadLukas Rytz2014-11-074-35/+67
|\ | | | | SI-8922 REPL load -v
| * SI-8922 REPL load -vSom Snytt2014-11-044-35/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | Verbose mode causes the familiar prompt and line echo so you can see what you just loaded. The quit message is pushed up a level in the process loop. This has the huge payoff that if you start the repl and immediately hit ctl-D, you don't have to wait for the compiler to init (yawn) before you get a shell prompt back.
* | Merge pull request #4047 from lrytz/delambda-method-testsLukas Rytz2014-11-079-9/+25
|\ \ | | | | | | Fix tests under -Ydelambdafy:method
| * | Fix lambda names under delambdafy:method in innerClassAttribute testLukas Rytz2014-10-101-3/+3
| | | | | | | | | | | | This should have been done in 63207e1
| * | Ensure delambafy:inline for anonymous function class javap testLukas Rytz2014-10-102-1/+5
| | | | | | | | | | | | https://issues.scala-lang.org/browse/SI-8898
| * | Ensure closure elimination test runs under -Ydelambdafy:inlineLukas Rytz2014-10-101-1/+1
| | |
| * | Fix t8549 under -Ydelambdafy:methodLukas Rytz2014-10-103-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the structure of Option.class generated by delambdafy:method is slightly different. For example, lambdas declared within Option are not emitted as nested classes, so under delambdafy:method there's no inner class entry for anonfun classes. The test failed because serializing a ClassTag involves serializing an Option. Option did not have a `@SerialVersionUID`, and the classfile generated by delambdafy:method has a different value. The annotation is required on the parent class (Option) as well as the subclasses (Some / None). De-serializing a Some will fail if Option has a different SerialVersionUID. Relates to SI-8576. We should probably have more SVUID annotations in the library.
| * | Update check files for -Ydelambdafy:methodLukas Rytz2014-10-102-2/+6
| | | | | | | | | | | | Should have been done in 63207e1.
* | | Merge pull request #4080 from gourlaysama/wip/t8931-redundant-interfaces-2Jason Zaugg2014-11-075-48/+54
|\ \ \ | | | | | | | | SI-8931 make generic signature consistent with interface list in classfiles
| * | | SI-8931 make generic signature consistent with interface list in classfilesAntoine Gourlay2014-11-055-48/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An optimization was introduced in 7a99c03 (SI-5278) to remove redundant interfaces from the list of implemented interfaces in the bytecode. However the same change was not propagated to the generic signature of a class, which also contains a list of direct parent classes and interfaces. The JVM does not check the well-formedness of signatures at class loading or linking (see §4.3.4 of jdk7 jvms), but other tools might assume the number of implemented interfaces is the same whether one asked for generic or erased interfaces. It doesn't break reflection so nobody complained, but it does show: scala> val c = classOf[Tuple1[String]] c: Class[(String,)] = class scala.Tuple1 scala> c.getInterfaces // Product is gone res0: Array[Class[_]] = Array(interface scala.Product1, interface scala.Serializable) scala> c.getGenericInterfaces // Product is back! res1: Array[java.lang.reflect.Type] = Array(scala.Product1<T1>, interface scala.Product, interface scala.Serializable) This moves the optimization to erasure, for use in emitting the generic signature, and the backend calls into it later for the list of interfaces.
* | | | Merge pull request #4097 from retronym/ticket/7602Jason Zaugg2014-11-073-1/+34
|\ \ \ \ | | | | | | | | | | SI-7602 Avoid crash in LUBs with erroneous code
| * | | | SI-7602 Avoid crash in LUBs with erroneous codeJason Zaugg2014-11-073-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a class contains a double defintion of a method that overrides an interface method, LUBs could run into a spot where filtering overloaded alternatives to those that match the interface method fails to resolve to a single overload, which crashes the compiler. This commit uses `filter` rather than `suchThat` to avoid the crash.
* | | | | Merge pull request #4096 from retronym/ticket/7019Jason Zaugg2014-11-072-1/+11
|\ \ \ \ \ | | | | | | | | | | | | SI-7019 Fix crasher with private[this] extension methods
| * | | | | SI-7019 Fix crasher with private[this] extension methodsJason Zaugg2014-11-062-1/+11
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we move the body of value class methods to the corresponding extension method, we typecheck a forward method that remains in the class. In order to allow access, this commit weakens the access of `private[local]` extension methods to `private`.
* | | | | Merge pull request #4083 from retronym/ticket/8947Jason Zaugg2014-11-076-3/+64
|\ \ \ \ \ | | | | | | | | | | | | SI-8947 Avoid cross talk between tag materializers and reify
| * | | | | SI-8947 Additional layers of defence against EmptyTree mutationJason Zaugg2014-11-063-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As suggested in review: - Use `abort` rather than `{error; EmptyTree} when we hit an error in reification or tag materialization. - Explicitly avoid adding the `MacroExpansionAttachment` to the macro expansion if it an `EmptyTree` - Emit a `-Xdev` warning if any other code paths find a way to mutate attachments in places they shouldn't.
| * | | | | SI-8947 Avoid cross talk between tag materializers and reifyJason Zaugg2014-10-304-0/+61
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After a macro has been expanded, the expandee are expansion are bidirectionally linked with tree attachments. Reify uses the back reference to replace the expansion with the expandee in the reified tree. It also has some special cases to replace calls to macros defined in scala-compiler.jar with `Predef.implicitly[XxxTag[T]]`. This logic lives in `Reshape`. However, the expansion of a macro may be `EmptyTree`. This is the case when a tag materializer macro fails. User defined macros could do the also expand to `EmptyTree`. In the enclosed test case, the error message that the tag materializer issued ("cannot materialize class tag for unsplicable type") is not displayed as the typechecker finds another means of making the surrounding expression typecheck. However, the macro engine attaches a backreference to the materializer macro on `EmpytyTree`! Later, when `reify` reshapes a tree, every occurance of `EmptyTree` will be replaced by a call to `implicitly`. This commit expands the domain of `CannotHaveAttrs`, which is mixed in to `EmptyTree`. It silently ignores all attempts to mutate attachments. Unlike similar code that discards mutations of its type and position, I have refrained from issuing a developer warning in this case, as to silence this I would need to go and add a special case at any places adding attachments.
* | | | | Merge pull request #4094 from retronym/ticket/8962Jason Zaugg2014-11-062-1/+34
|\ \ \ \ \ | | | | | | | | | | | | SI-8962 Fix regression with skolems in pattern translation
| * | | | | SI-8962 Fix regression with skolems in pattern translationJason Zaugg2014-11-062-1/+34
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the refactoring of error reporting in 258d95c7b15, the result of `Context#reportError` was changed once we had switched to using a `ThrowingReporter`, which is still the case in post typer phase typechecking This was enough to provoke a type error in the enclosed test. Here's a diff of the typer log: % scalac-hash 258d95~1 -Ytyper-debug sandbox/test.scala 2>&1 | tee sandbox/good.log % scalac-hash 258d95 -Ytyper-debug sandbox/test.scala 2>&1 | tee sandbox/bad.log % diff -U100 sandbox/{good,bad}.log | gist --filename=SI-8962-typer-log.diff https://gist.github.com/retronym/3ccbe7e0791447d272a6 The test `Context#reportError` happens to be used when deciding whether the type checker should be lenient when it hits a type error. In lenient mode (see `adaptMismatchedSkolems`), it `adapt` retries with after slackening the expected type by replacing GADT and existential skolems with wildcard types. This is to accomodate known type-incorrect trees generated by the pattern matcher. This commit restores the old semantics of `reportError`, which means it is `false` when a `ThrowingReporter` is being used. For those still reading, here's some more details. The trees of the `run2` example from the enclosed test. Notice that after typechecking, `expr` has a type containing GADT skolems. The pattern matcher assumes that calling the case field accessor `expr` on the temporary val `x2 : Let[A with A]` containing the scrutinee will result in a compatible expression, however this it does not. Perhaps the pattern matcher should generate casts, rather than relying on the typer to turn a blind eye. ``` [[syntax trees at end of typer]] // t8962b.scala ... def run2[A](nc: Outer2[A,A]): Outer2[Inner2[A],A] = nc match { case (expr: Outer2[Inner2[?A2 with ?A1],?A2 with ?A1])Let2[A with A]((expr @ _{Outer2[Inner2[?A2 with ?A1],?A2 with ?A1]}){Outer2[Inner2[?A2 with ?A1],?A2 with ?A1]}){Let2[A with A]} => (expr{Outer2[Inner2[?A2 with ?A1],?A2 with ?A1]}: Outer2[Inner2[A],A]){Outer2[Inner2[A],A]} }{Outer2[Inner2[A],A]} [[syntax trees at end of patmat]] // t8962b.scala def run2[A](nc: Outer2[A,A]): Outer2[Inner2[A],A] = { case <synthetic> val x1: Outer2[A,A] = nc{Outer2[A,A]}; case5(){ if (x1.isInstanceOf[Let2[A with A]]) { <synthetic> val x2: Let2[A with A] = (x1.asInstanceOf[Let2[A with A]]: Let2[A with A]){Let2[A with A]}; { val expr: Outer2[Inner2[?A2 with ?A1],?A2 with ?A1] = x2.expr{<null>}; matchEnd4{<null>}((expr{Outer2[Inner2[?A2 with ?A1],?A2 with ?A1]}: Outer2[Inner2[A],A]){Outer2[Inner2[A],A]}){<null>} ... ```
* | | | | 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