| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
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-8947 Avoid cross talk between tag materializers and reify
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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-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
|
| |/ /
| | |
| | |
| | |
| | | |
- there is no need for explicit links with [[ and ]]
- there is no need for explicit backquoting
|
|\ \ \
| | | |
| | | | |
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.
|
|\ \ \ \
| |_|/ /
|/| | | |
SI-8916 Clean up unused imports, values and variables
|
| | |/
| |/| |
|
|\ \ \
| | | |
| | | | |
SI-8893 Restore linear perf in TailCalls with nested matches
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Cache the member symbols for `Boolean.{||, &&}` per-run, rather
than look them up repeatedly.
Based on profiling the tail calls phase in the program below, which
was distilled by @rmacleod2 from the code generated by macros in
https://github.com/paytronix/utils-open/tree/release/2014/ernststavrosgrouper
Wall clock time went from 12s to 6.5s.
```scala
object Test {
def a(): Option[String] = Some("a")
def main(args: Array[String]) {
a() match {
case Some(b1) =>
a() match {
case Some(b2) =>
a() match {
case Some(b3) =>
a() match {
case Some(b4) =>
a() match {
case Some(b5) =>
a() match {
case Some(b6) =>
a() match {
case Some(b7) =>
a() match {
case Some(b8) =>
a() match {
case Some(b9) =>
a() match {
case Some(b10) =>
a() match {
case Some(b11) =>
a() match {
case Some(b12) =>
a() match {
case Some(b13) =>
a() match {
case Some(b14) =>
a() match {
case Some(b15) =>
a() match {
case Some(b16) =>
a() match {
case Some(b17) =>
a() match {
case Some(b18) =>
a() match {
case Some(b19) =>
a() match {
case Some(b20) =>
println("yay")
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
case None => None
}
}
}
```
|
|\ \ \ \
| | | | |
| | | | | |
SI-8875 showCode should print all class constructor modifiers.
|
| |/ / /
| | | |
| | | |
| | | |
| | | | |
showCode used to print nothing when the only modifier was a change in
visibility scope (i.e. no flags but privateWithin is set).
|
|\ \ \ \
| |_|_|/
|/| | | |
fix typo. s/represenation/representation
|
| |/ / |
|
|\ \ \
| | | |
| | | | |
SI-3439 Fix use of implicit constructor params in super call
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When typechecking the primary constructor body, the symbols of
constructor parameters of a class are owned by the class's owner.
This is done make scoping work; you shouldn't be able to refer to
class members in that position.
However, other parts of the compiler weren't so happy about
this arrangement. The enclosed test case shows that our
checks for invalid, top-level implicits was spuriously triggered,
and implicit search itself would fail.
Furthermore, we had to hack `Run#compiles` to special case
top-level early-initialized symbols. See SI-7264 / 86e6e9290.
This commit:
- introduces an intermediate local dummy term symbol which
will act as the owner for constructor parameters and early
initialized members
- adds this to the `Run#symSource` map if it is top level
- simplifies `Run#compiles` accordingly
- tests this all in a top-level class, and one nested in
another class.
|
|\ \ \
| |_|/
|/| | |
FSC / REPL Bug Bonanza
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We needed to hop from the enum's owner to its companion
module in an early phase of the compiler.
The enclosed test used to fail when this lookup returned
NoSymbol on the second run of the resident compiler when
triggered from `MixinTransformer`: the lookup didn't work
after the flatten info transform. This is related to the
fact that module classes are flattened into the enclosing
package, but module accessors remain in the enclosing class.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The transformation of applications to specialized methods
relies on the owner of said method having had the specialization
info transform run which stashes a bunch of related data into
per-run caches such as `SpecializeTypes#{typeEnv}`.
Recently, we found that per-run caches didn't quite live up
to there name, and in fact weren't being cleaned up before
a new run. This was remedied in 00e11ff.
However, no good deed goes unpunished, and this led to a
regression in specialization in the REPL and FSC.
This commit makes two changes:
- change the specialization info tranformer to no longer
directly enter specialized methods into the `info` of whatever
the current phase happens to be. This stops them showing up
`enteringTyper` of the following run.
- change `adaptInfos` to simply discard all but the oldest
entry in the type history when bringing a symbol from one
run into the next. This generalizes the approach taken to
fix SI-7801. The specialization info transformer will now
execute in each run, and repopulate `typeEnv` and friends.
I see that we have a seemingly related bandaid for this sort
of problem since 08505bd4ec. In a followup, I'll try to revert
that.
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Test case by Jason.
RefChecks adds the lateMETHOD flag lazily in its info transformer.
This means that forcing the `sym.info` may change the value of
`sym.isMethod`.
0ccdb151f introduced a check to force the info in isModuleNotMethod,
but it turns out this leads to errors on stub symbols (SI-8907).
The responsibility to force info is transferred to callers, which
is the case for other operations on symbols, too.
|
| |
| |
| |
| |
| |
| |
| | |
Classic bait-and-switch: `isTupleType` dealiases, but `typeArgs` does not.
When deciding with `isTupleType`, process using `tupleComponents`.
Similar for other combos. We should really enforce this using extractors,
and only decouple when performance is actually impacted.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Note that I removed the check to ignore @deprecated:
- @deprecated extends StaticAnnotation, so they aren't
supposed to show up in the RuntimeInvisibleAnnotation
attribute anyway, and the earlier check for "extends
ClassfileAnnotationClass" makes this check superflous
anyway.
- Otherwise, if @deprecated was extending
ClassfileAnnotationClass it would seem inconsistent
that we don't emit @deprecated, but would do so for
@deprecatedOverriding, @deprecatedInheritance, etc.
Anyway, due to ClassfileAnnotation not working in
Scala, and the additional check which only allows
Java-defined annotations, this is pretty pointless
from every perspective.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Let the AbstractFileClassLoader override just the usual suspects.
Normal delegation behavior should ensue.
That's instead of overriding `getResourceAsStream`, which was intended
that "The repl classloader now works more like you'd expect a classloader to."
(Workaround for "Don't know how to construct an URL for something which exists
only in memory.")
Also override `findResources` so that `getResources` does the obvious thing,
namely, return one iff `getResource` does.
The translating class loader for REPL only special-cases `foo.class`: as
a fallback, take `foo` as `$line42.$read$something$foo` and try that class file.
That's the use case for "works like you'd expect it to."
There was a previous fix to ensure `getResource` doesn't take a class name.
The convenience behavior, that `classBytes` takes either a class name or a resource
path ending in ".class", has been promoted to `ScalaClassLoader`.
|
|\
| |
| | |
SI-8087 keep annotations on mixed-in private[this] fields
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Related to SI-2511 / eea7956, which fixed the same issue for non
`private[this]` fields.
If you have
trait T { private[this] val f = 0 }
class C extends T
Mixin geneartes an accessor method `T.f` with owner `T`. When
generating the field in `C`, the Mixin.mixinTraitMembers calls
`fAccessor.accessed`. The implementation of `accessed` does a lookup
for a member named `"f "` (note the space). The bug is that
`private[this]` fields are not renamed to have space
(`LOCAL_SUFFIX_STRING`) in their name, so the accessed was not found,
and no annotations were copied from it.
|
|/
|
|
|
|
|
|
|
|
|
|
| |
These pop up as the owner of symbols in annotation arguments,
such as the ones introduced by the names/defaults desugaring.
The first two test cases here motivate the two patches to Unpicker.
The third requires both fixes, but exploits the problem directly,
without using `@deprecated` and named arguments.
See also 14fa7be / SI-8708 for a recently remedied kindred bug.
|
|\
| |
| | |
SI-8844 Fix regression with existentials + type aliases
|
| |
| |
| |
| |
| |
| | |
Regressed in 2a1b15e / SI-8283. Another specimen of an archetypal
bug: unwanted dealising by using `typeSymbol`, rather than
`typeSymbolDirect`.
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
Ydelambdafy:method lambda classes are not anonymous classes, and not
anonymous function classes either. They are somethig new, so there's
a new predicate isDelambdafyFunction.
They are not anonymous classes (or functions) because anonymous
classes in Java speak are nested. Delambdafy classes are always
top-level, they are just synthetic.
Before this patch, isAnonymous was sometimes accidentailly true: if
the lambda is nested in an anonymous class. Now it's always false.
|
|\
| |
| | |
SI-8803 generate super accessor for super[A], if A is outer superclass
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
class C extends A with T {
class I {
C.super[T]
C.super[A]
}
}
A super call in a nested class of the form super[T] where T is a
parent trait of the outer class doesn't need an accessor: mixin can
directly re-route the call to the correct implementation class - it's
statically known to be T$class.
However, if a nested class accesses super[A] and A is the superclass
of the outer class (not a trait), then we need a super accessor in the
outer class.
We need to add the mixin name to the super accessor name, otherwise
it clashes with non-qualified super accessors.
|
|\ \
| | |
| | | |
fix a few string interpolation typos
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
That nice little `-Dscala.repl.vids` feature regressed in f56f9a3c when
a string.format was replaced by string interpolation.
The ones in scala-reflect were caught by Xlint (who knew building with
Xlint was actually useful...), the other was just luck.
|
|\ \ \
| | | |
| | | | |
SI-8823 Exclude specialized methods from extension method rewrite
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If a value class extends a specialized class, it can sprout
specialized members after the specialization info transformer has run.
However, we only install extension methods for class members we know
about at the extmethods phase.
This commit simply disables rewiring calls to these methods in
erasure to an extention method. This follows the approach taken
from super accessors.
Note: value class type parameters themselves currently are not
allowed to be specialized.
|
|\ \ \
| |/ /
|/| | |
GenBCode refactoring (remove Tracked) and fix InnerClass / EnclosingMethod attributes
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit seems bigger than it is. Most of it is tests, and moving
some code around. The actual changes are small, but a bit subtle.
The InnerClass and EnclosingMethod attributes should now be close to
the JVM spec (which is summarized in BTypes.scala). New tests make
sure that changes to these attributes, and changes to the way Java
reflection sees Scala classfiles, don't go unnoticed.
A new file, BCodeAsmCommon, holds code that's shared between the two
backend (it could hold more, future work).
In general, the difficulty with emitting InnerClass / EnclosingMethod
is that we need to find out source-level properties. We need to make
sure to do enough phase-travelling, and work around destructive
changes to the ownerchain in lambdalift (we use originalOwner a lot).
The change to JavaMirrors is prompted by the change to the
EnclosingMethod attribute, which changes Java reflection's answer to
getEnclosingMethod and getEnclosingConstructor. Classes defined in
field initializers no longer have an enclosing method, just an
enclosing class, which broke an assumption in JavaMirrors.
There's one change in erasure. Before this change, when an object
declaration implements / overrides a method, and a bridge is required,
then the bridge method was actually a ModuleSymbol (it would get the
lateMETHOD flag and be emitted as a method anyway). This is confusing,
when iterating through the members of a class, you can find two
modules with the same name, and one of them doesn't have a module
class. Now, such bridge methods will be MethodSymbols.
Removed Symbol.originalEnclosingMethod, that is a backend thing and
doesn't need to live in the symbol API.
|
|\ \
| | |
| | | |
SI-8793 Fix patmat regression with extractors, existentials
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In the same vein as SI-8128 / 3e9e2c65a, revert to the 2.10.x style
of determining the types of the product elements of an extractor
when using `TupleN`.
I believe we can discard the special casing for Option/Tuple/Seq
altogether with judicious application of `repackExistential` in
`unapplyMethodTypes`. That ought to also fix fix SI-8149. But I'll
target that work at 2.12.x.
|
|\ \ \
| |_|/
|/| | |
part 2 of the big error reporting refactoring
|
| | |
| | |
| | |
| | |
| | |
| | | |
Once a release with this method is out,
move partest to use errorCount and cut ties with the Severity
nested class, so we can move it to the right enclosing class.
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| | |
Avoid the widening bug for q. This resolution also suffers
from the inference of Any, which can trigger a warning and
an anxiety attack. But that's still better than doing the
wrong thing.
Right?
|
|\ \
| | |
| | | |
Better error message than 'bad symbolic reference'.
|
| |/
| |
| |
| |
| |
| | |
Let's not scare people, and try to give them some advice.
PS: we should really come up with a better mechanism for testing errors/warnings
|
|\ \
| | |
| | | |
Assortiment of cleanups and comments around the backend
|