summaryrefslogtreecommitdiff
path: root/test/files
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #4115 from retronym/ticket/8597Grzegorz Kossakowski2014-11-217-1/+90
|\ | | | | SI-8597 Improved pattern unchecked warnings
| * SI-8597 Improved pattern unchecked warningsJason Zaugg2014-11-097-1/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-202-0/+54
|\ \ | | | | | | SI-8253 Fix incorrect parsing of <elem xmlns={f("a")}/>
| * | SI-8253 Fix incorrect parsing of <elem xmlns={f("a")}/>Jason Zaugg2014-11-102-0/+54
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #4118 from retronym/ticket/5639Jason Zaugg2014-11-1912-14/+184
|\ \ | | | | | | SI-5639 Fix spurious discarding of implicit import
| * | SI-5639 Predicate bug fix on -Xsource:2.12Jason Zaugg2014-11-184-0/+33
| | | | | | | | | | | | | | | | | | To be conservative, I've predicated this fix in `-Xsource:2.12`. This is done in separate commit to show that the previous fix passes the test suite, rather than just tests with `-Xsource:2.12`.
| * | SI-5639 Fix spurious discarding of implicit importJason Zaugg2014-11-098-14/+151
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #4051 from heathermiller/repl-cp-fix2Jason Zaugg2014-11-182-0/+109
|\ \ | | | | | | SI-6502 Reenables loading jars into the running REPL (regression in 2.10)
| * | Adds tests that programatically generate jarsHeather Miller2014-11-052-0/+109
| | |
* | | Merge pull request #4068 from lrytz/t8925Jason Zaugg2014-11-184-1/+35
|\ \ \ | | | | | | | | SI-8925, SI-7407 test cases, fixed in new backend
| * | | SI-8925, SI-7407 test cases, fixed in new backendLukas Rytz2014-11-044-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given that the issues are old (2.10) and we move to the new backend in 2.12, I don't plan to fix them in GenASM. The test case for 7407 existed already, this commit just adds `-Yopt:l:none` to the flags to make no dead code is eliminated.
* | | | Merge pull request #4075 from som-snytt/issue/8835-junitGrzegorz Kossakowski2014-11-177-222/+0
|\ \ \ \ | | | | | | | | | | SI-8835 Iterator tests can be junit
| * | | | SI-8835 Iterator tests can be junitSom Snytt2014-11-117-222/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without loss of generality or convenience, but helps reduce the number of files in test/files and may reduce compile times for test suite. This commit includes the fix from #3963 and an extra test of that fix that ensures the stack doesn't grow on chained drops.
* | | | | Merge pull request #4117 from retronym/ticket/8449Adriaan Moors2014-11-172-0/+13
|\ \ \ \ \ | | | | | | | | | | | | SI-8449 Fix spurious error with Java raw type over a Scala class
| * | | | | SI-8449 Fix spurious error with Java raw type over a Scala classJason Zaugg2014-11-092-0/+13
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the Scala typechecker typechecks signatures in Java sources, it must enable use of a type constructor without applied type arguments (a raw type). However, the check in `adaptType::properTypeRequired` was too restricive: it only allows raw types given a) we are typechecking a Java source file and b) the type constructor itself is Java defined. The second check does not make sense; it is perfectly legal to define a Java raw type for over a Scala defined type constructor. This commit removes it. The bug was noticed in the Scaladoc context, as it explores the signatures of all Java sources so it can document them. But the enclosed test demonstrates the underlying bug under normal compilation.
* | | | | Merge pull request #4114 from retronym/ticket/8534Adriaan Moors2014-11-175-4/+23
|\ \ \ \ \ | |_|/ / / |/| | | | SI-8534 Avoid crash in erroneous SelectFromTypeTree
| * | | | SI-8534 Avoid crash in erroneous SelectFromTypeTreeJason Zaugg2014-11-095-4/+23
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR #2374 changed the behaviour of `typedSingletonTypeTree` in the presence of an error typed reference tree. It incorrectly returns the reference tree in case on an error. However, this is a term tree, which is an inconsistent result with the input type tree. Consequently, a `typedSelectInternal` later fails when using this as the qualifier of a `SelectFromTypeTree`. Both test cases enclosed show this symptom. This commit: - Returns `tree` rather than `refTyped` when `refTyped` is error typed or when it isn't suitable as a stable prefix. - Avoids issuing a cascading "not a stable prefix" error if the `refTyped` is error typed. - Adds an extra layer of defense in `typedSelectFromTypeTree` to bail out quickly if the qualifier is error typed. The last measure is not necessary to fix this bug.
* | | | Merge pull request #3963 from erikerlandson/si-8835-prLukas Rytz2014-11-112-6/+39
|\ \ \ \ | | | | | | | | | | SI-8835 Fix implementation of Iterator drop to remove quadratic behavior
| * | | | SI-8835 Fix implementation of Iterator drop to remove quadratic behaviorErik Erlandson2014-10-212-6/+39
| | | | |
* | | | | Merge pull request #4116 from retronym/ticket/5413-2Lukas Rytz2014-11-101-0/+9
|\ \ \ \ \ | | | | | | | | | | | | SI-5413 Test for fixed owner-corruption bug with names/defaults
| * | | | | SI-5413 Test for fixed owner-corruption bug with names/defaultsJason Zaugg2014-11-091-0/+9
| | |/ / / | |/| | | | | | | | | | | | | Fixed in SI-8111 / 2.10.4.
* | | | | Merge pull request #4120 from retronym/ticket/5665Lukas Rytz2014-11-101-0/+13
|\ \ \ \ \ | | | | | | | | | | | | SI-5665 Test case for fixed private[this], trait crasher
| * | | | | SI-5665 Test case for fixed private[this], trait crasherJason Zaugg2014-11-091-0/+13
| |/ / / / | | | | | | | | | | | | | | | Fixed in SI-5508 / cca4d51db.
* | | | | Merge pull request #4110 from lrytz/t8960-delambdafyJason Zaugg2014-11-101-1/+7
|\ \ \ \ \ | | | | | | | | | | | | Make t8960 pass under delambdafy:method
| * | | | | Make t8960 pass under delambdafy:methodLukas Rytz2014-11-071-1/+7
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using delambdafy:method, anonymous function classes are not currently specialized, as noted here: https://github.com/scala/scala/blob/f08e96571479552b103b15cc2d40ea5454999546/src/compiler/scala/tools/nsc/transform/Delambdafy.scala#L26
* | | | | Merge pull request #4109 from retronym/ticket/1994Lukas Rytz2014-11-101-0/+20
|\ \ \ \ \ | | | | | | | | | | | | SI-1994 Test case for fixed overriding problem
| * | | | | SI-1994 Test case for fixed overriding problemJason Zaugg2014-11-071-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test case passes since Scala 2.9.2. Prior, it failed with: ~/scala/2.9.1/bin/scalac sandbox/t1994.scala sandbox/t1994.scala:9: error: method y overrides nothing override def y = 1 ^ one error found
* | | | | | Merge pull request #4108 from retronym/ticket/7750Lukas Rytz2014-11-102-0/+9
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7750 Test case for fixed spurious existential feature warning
| * | | | | | SI-7750 Test case for fixed spurious existential feature warningJason Zaugg2014-11-072-0/+9
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 2.11.0-M8, the enclosed test issued the following feature warning: sandbox/t7750.scala:7: warning: the existential type LazyCombiner[_$1,_$2,_$3] forSome { type _$1; type _$2; type _$3 <: Growable[_$1] with Sizing }, which cannot be expressed by wildcards, This went way in 2.11.0-RC1 after we turned off the problematic attempt to infer existential bounds based on the bounds of the corresponding type parameters.
* | | | | | Merge pull request #4102 from retronym/ticket/8965Lukas Rytz2014-11-102-0/+8
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8965 Account for corner case in "unrelated types" warning
| * | | | | | SI-8965 Account for corner case in "unrelated types" warningJason Zaugg2014-11-072-0/+8
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | It's okay for the two types to LUB to something above `Object` if they both individially were its supertype.
* | | | | | Merge pull request #4101 from adriaanm/sam-exLukas Rytz2014-11-1015-14/+97
|\ \ \ \ \ \ | | | | | | | | | | | | | | [sammy] eta-expansion, overloading, existentials
| * | | | | | [sammy] support repeated paramsAdriaan Moors2014-11-073-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generate correct trees to refer to repeated params using `gen.paramToArg`. Based on retronym's review feedback.
| * | | | | | [sammy] use correct type for method to overrideAdriaan Moors2014-11-077-24/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't naively derive types for the single method's signature from the provided function's type, as it may be a subtype of the method's MethodType. Instead, once the sam class type is fully defined, determine the sam's info as seen from the class's type, and use those to generate the correct override. ``` scala> Arrays.stream(Array(1, 2, 3)).map(n => 2 * n + 1).average.ifPresent(println) 5.0 scala> IntStream.range(1, 4).forEach(println) 1 2 3 ``` Also, minimal error reporting Can't figure out how to do it properly, but some reporting is better than crashing. Right? Test case that illustrates necessity of the clumsy stop gap `if (block exists (_.isErroneous))` enclosed as `sammy_error_exist_no_crash` added TODO for repeated and by-name params
| * | | | | | [sammy] eta-expansion, overloading (SI-8310)Adriaan Moors2014-11-066-0/+58
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Playing with Java 8 Streams from the repl showed we weren't eta-expanding, nor resolving overloading for SAMs. Also, the way Java uses wildcards to represent use-site variance stresses type inference past its bendiness point (due to excessive existentials). I introduce `wildcardExtrapolation` to simplify the resulting types (without losing precision): `wildcardExtrapolation(tp) =:= tp`. For example, the `MethodType` given by `def bla(x: (_ >: String)): (_ <: Int)` is both a subtype and a supertype of `def bla(x: String): Int`. Translating http://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/ into Scala shows most of this works, though we have some more work to do (see near the end). ``` scala> import java.util.Arrays scala> import java.util.stream.Stream scala> import java.util.stream.IntStream scala> val myList = Arrays.asList("a1", "a2", "b1", "c2", "c1") myList: java.util.List[String] = [a1, a2, b1, c2, c1] scala> myList.stream.filter(_.startsWith("c")).map(_.toUpperCase).sorted.forEach(println) C1 C2 scala> myList.stream.filter(_.startsWith("c")).map(_.toUpperCase).sorted res8: java.util.stream.Stream[?0] = java.util.stream.SortedOps$OfRef@133e7789 scala> Arrays.asList("a1", "a2", "a3").stream.findFirst.ifPresent(println) a1 scala> Stream.of("a1", "a2", "a3").findFirst.ifPresent(println) a1 scala> IntStream.range(1, 4).forEach(println) <console>:37: error: object creation impossible, since method accept in trait IntConsumer of type (x$1: Int)Unit is not defined (Note that Int does not match Any: class Int in package scala is a subclass of class Any in package scala, but method parameter types must match exactly.) IntStream.range(1, 4).forEach(println) ^ scala> IntStream.range(1, 4).forEach(println(_: Int)) // TODO: can we avoid this annotation? 1 2 3 scala> Arrays.stream(Array(1, 2, 3)).map(n => 2 * n + 1).average.ifPresent(println(_: Double)) 5.0 scala> Stream.of("a1", "a2", "a3").map(_.substring(1)).mapToInt(_.parseInt).max.ifPresent(println(_: Int)) // whoops! ReplGlobal.abort: Unknown type: <error>, <error> [class scala.reflect.internal.Types$ErrorType$, class scala.reflect.internal.Types$ErrorType$] TypeRef? false error: Unknown type: <error>, <error> [class scala.reflect.internal.Types$ErrorType$, class scala.reflect.internal.Types$ErrorType$] TypeRef? false scala.reflect.internal.FatalError: Unknown type: <error>, <error> [class scala.reflect.internal.Types$ErrorType$, class scala.reflect.internal.Types$ErrorType$] TypeRef? false at scala.reflect.internal.Reporting$class.abort(Reporting.scala:59) scala> IntStream.range(1, 4).mapToObj(i => "a" + i).forEach(println) a1 a2 a3 ```
* | | | | | Merge pull request #4100 from gourlaysama/wip/lint-buildLukas Rytz2014-11-103-0/+53
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8954 Make @deprecated{Overriding,Inheritance} aware of @deprecated.
| * | | | | | SI-8954 Make @deprecated{Overriding,Inheritance} aware of @deprecated.Antoine Gourlay2014-11-063-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes sure that: - there is no warning for a @deprecated class inheriting a @deprecatedInheritance class - there is no warning for a @deprecated method overriding a @deprecatedOverriding method - there is no "deprecation won't work" warning when overriding a member of a @deprecatedInheritance class with a @deprecated member - the above works even if the classes/methods are indirectly deprecated (i.e. enclosed in something @deprecated) This should remove quite a few useless deprecation warnings from the library.
* | | | | | | Merge pull request #4095 from retronym/ticket/8933Lukas Rytz2014-11-106-0/+44
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | | | Fix problems in Symbol Literal static caching
| * | | | | | SI-7974 Fix over-eager optimization of Symbol literalsJason Zaugg2014-11-071-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A classic mistake of discarding a non-trivial qualifier. We actually should have fixed this before merging #3149, as it was raised in review, but I suppose we got too caught up in the difficulty of resolving the right overload of `Symbol_apply` that we forgot.
| * | | | | | SI-8933 Disable static Symbol literal cache in traitsJason Zaugg2014-11-075-0/+30
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Scala 2.8.2, an optimization was added to create a static cache for Symbol literals (ie, the results of `Symbol.apply("foo"))`. This saves the map lookup on the second pass through code. This actually was broken somewhere during the Scala 2.10 series, after the addition of an overloaded `apply` method to `Symbol`. The cache synthesis code was made aware of the overload and brought back to working condition recently, in #3149. However, this has uncovered a latent bug when the Symbol literals are defined with traits. One of the enclosed tests failed with: jvm > t8933b-run.log java.lang.IllegalAccessError: tried to access field MotherClass.symbol$1 from class MixinWithSymbol$class at MixinWithSymbol$class.symbolFromTrait(A.scala:3) at MotherClass.symbolFromTrait(Test.scala:1) This commit simply disables the optimization if we are in a trait. Alternative fixes might be: a) make the static Symbol cache field public / b) "mixin" the static symbol cache. Neither of these seem worth the effort and risk for an already fairly situational optimization. Here's how the optimization looks in a class: % cat sandbox/test.scala; qscalac sandbox/test.scala && echo ":javap C" | qscala; class C { 'a; 'b } Welcome to Scala version 2.11.5-20141106-145558-aa558dce6d (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_20). Type in expressions to have them evaluated. Type :help for more information. scala> :javap C Size 722 bytes MD5 checksum 6bb00189166917254e8d40499ee7c887 Compiled from "test.scala" public class C { public static {}; descriptor: ()V flags: ACC_PUBLIC, ACC_STATIC Code: stack=2, locals=0, args_size=0 0: getstatic #16 // Field scala/Symbol$.MODULE$:Lscala/Symbol$; 3: ldc #18 // String a 5: invokevirtual #22 // Method scala/Symbol$.apply:(Ljava/lang/String;)Lscala/Symbol; 8: putstatic #26 // Field symbol$1:Lscala/Symbol; 11: getstatic #16 // Field scala/Symbol$.MODULE$:Lscala/Symbol$; 14: ldc #28 // String b 16: invokevirtual #22 // Method scala/Symbol$.apply:(Ljava/lang/String;)Lscala/Symbol; 19: putstatic #31 // Field symbol$2:Lscala/Symbol; 22: return public C(); descriptor: ()V flags: ACC_PUBLIC Code: stack=1, locals=1, args_size=1 0: aload_0 1: invokespecial #34 // Method java/lang/Object."<init>":()V 4: getstatic #26 // Field symbol$1:Lscala/Symbol; 7: pop 8: getstatic #31 // Field symbol$2:Lscala/Symbol; 11: pop 12: return } fixup
* | | | | | Merge pull request #4047 from lrytz/delambda-method-testsLukas Rytz2014-11-077-8/+19
|\ \ \ \ \ \ | | | | | | | | | | | | | | 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-101-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-072-0/+16
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-8931 make generic signature consistent with interface list in classfiles
| * | | | | | | SI-8931 make generic signature consistent with interface list in classfilesAntoine Gourlay2014-11-052-0/+16
| | |_|_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-072-0/+31
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-7602 Avoid crash in LUBs with erroneous code
| * | | | | | | SI-7602 Avoid crash in LUBs with erroneous codeJason Zaugg2014-11-072-0/+31
| | |_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.