| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
SI-8954 Make @deprecated{Overriding,Inheritance} aware of @deprecated.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| | |
| | | |
Fix problems in Symbol Literal static caching
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
|\ \ \
| | | |
| | | | |
GenBCode: cleanup optimizations
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
After eliminating unreachable code, there may be unused local varaible
slots. Such gaps increase the method's frame size unnecessarily.
The optimization does not attempt to re-use the same local variable
slot for non-overlapping locals (proper register allocation):
def f(b: Boolean) = if (b) { val x = e; x } else { val y = e; y }
x and y will not use the same slot, even though they could.
This was originally implemented by Miguel in
https://github.com/lrytz/scala/commit/09c40359338f8770e4f99d045999af062112973e
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Add command-line flags `Yopt:...` for simplifying jumps, eliminating
stale line number and label nodes.
`LocalOpt.methodOptimizations` applies all enabled intra-method
optimizations in the right order.
Some cleanups for unreachable code elimination and its tests.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Cleanup optimizations
- remove line number nodes that describe no executable instructions
- squash sequences of label nodes, remove unreferenced labels
Command-line flags that allow enabling these transformations are added
in a later comimt.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This commit implements simplifications to branching instructions, for
example `CondJump l; GOTO l` is replaced by `POP; GOTO l`.
The individual optimizations are explained in doc comments.
A later commit will add compiler flags to allow enabling the new
optimizations.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
|\ \ \ \
| | | | |
| | | | | |
Fix tests under -Ydelambdafy:method
|
| | | | |
| | | | |
| | | | |
| | | | | |
This should have been done in 63207e1
|
| | | | |
| | | | |
| | | | |
| | | | | |
https://issues.scala-lang.org/browse/SI-8898
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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.
|
| | | | |
| | | | |
| | | | |
| | | | | |
Should have been done in 63207e1.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-8931 make generic signature consistent with interface list in classfiles
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
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.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-7602 Avoid crash in LUBs with erroneous code
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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.
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
SI-7019 Fix crasher with private[this] extension methods
|
| |/ / / / / /
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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`.
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
SI-8947 Avoid cross talk between tag materializers and reify
|
| | |/ / / / /
| |/| | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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.
|
|\ \ \ \ \ \ \
| |_|_|_|_|/ /
|/| | | | | | |
SI-8962 Fix regression with skolems in pattern translation
|
| | |/ / / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
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>}
...
```
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
SI-8960 Bring back the SerialVersionUID to anonymous function classes
|
| | |_|/ /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-6626 make @throws tags create links to exceptions
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In scaladoc, this turns exceptions in @throws tags into links
(when it can find the target exception), instead of just showing
the name.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-5217 Companion privates in scope of class parms
|
| | |/ / /
| |/| | |
| | | | |
| | | | | |
Test of the same. It progressed in 2.10.1.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-8898 javap -fun under new style lambdas
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
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.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-5091 Move named-args cycle test from pending to neg
|
| |\ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
SI-6051 Test case, the issue seems to be fixed.
|
| | |/ / / / / |
|
| |/ / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
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`.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-6541 valid wildcard existentials for case-module-unapply
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
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.
|
| | |_|_|_|/
| |/| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
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.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-8927 Update OSGi stuff to get rid of bndlib warning
|
| | |/ / / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
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.
|
|\ \ \ \ \ \
| |_|_|_|/ /
|/| | | | | |
SI-8711 ScalaVersion.unparse doesn't produce valid versions
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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
```
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-8893 Restore linear perf in TailCalls with nested matches
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
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.
|