| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
SI-7455 Drop dummy param for synthetic access constructor
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Java synthesizes public constructors in private classes to
allow access from inner classes. The signature of
that synthetic constructor (known as a "access constructor")
has a dummy parameter appended to avoid overloading clashes.
javac chooses the type "Enclosing$1" for the dummy parameter
(called the "access constructor tag") which is either an
existing anonymous class or a synthesized class for this purpose.
In OpenJDK, this transformation is performed in:
langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
(Incidentally, scalac would just emits a byte-code public
constructor in this situation, rather than a private constructor /
access constructor pair.)
Scala parses the signature of the access contructor, and drops
the $outer parameter, but retains the dummy parameter. This causes
havoc when it tries to parse the bytecode for that anonymous class;
the class file parser doesn't have the enclosing type parameters
of Vector in scope and crash ensues.
In any case, we shouldn't allow user code to see that constructor;
it should only be called from within its own compilation unit.
This commit drops the dummy parameter from access constructor
signatures in class file parsing.
|
|\ \
| | |
| | | |
SI-7636 Fix a NPE in typing class constructors
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If we encountered an erroneous super call due to a
failure in parent type argument inference, we must
avoid inspecting the untyped children of erroneous
trees.
|
|\ \ \
| | | |
| | | | |
SI-7687 Handle spaces in %COMSPEC% path in scala.bat.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Double quoted %COMSPEC% to allow for spaces in the path to the
default interpreter (cmd.exe or equivalent).
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | | |
introduced in 5b54681: the end position of Postfix operators should
take the operator length into account.
review by @som-snytt
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently we allow macros to override non-abstract methods (in order
to provide performance enhancements such as foreach for collections),
and we also disallow macros to override abstract methods (otherwise
downcasting might lead to AbstractMethodErrors).
This patch fixes an oversight in the disallowing rule that prohibited
macros from overriding a concrete method if that concrete method itself
overrides an abstract method. RefCheck entertains all overriding pairs,
not only the immediate ones, so the disallowing rule was triggered.
Now macros can override abstract methods if and only if either the base
type or the self type contain a matching non-abstract method.
|
|\ \
| | |
| | | |
SI-7336 Link flatMapped promises to avoid memory leaks
|
| |/ |
|
|\ \
| | |
| | | |
SI-7265 General test for spec version
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The test for isJavaAtLeast uses the specification.version.
The method argument must have the form "major.minor".
The scaladoc is updated to reflect the new reality and a
test is added under junit.
Note that this implementation aims to be a simple
compromise between the functional and imperative camps,
that is, to be free of both closures and while loops.
And to elicit no cruft like regexes and wrappers for strings.
No doubt even more could be done in this department, but we
don't wish to spoil the fun on codegolf.stackexchange.com.
However, we might decide to sponsor a new site:
codereviewpingpong.com
For 2.10.x, javaSpecVersion is provided as a private member.
The active test is under `run` and the `junit` test must
bide its time in `pending`.
For 2.11, the private members can be public and the app test
replaced with the unit test.
|
|\ \ \
| | | |
| | | | |
SI-7649 Fix positions for reshaped tag materializers
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Calls to `materializeClassTag[T]` are replaced during reification with
`implicitly[ClassTag[T]]` in the `reify` macro. This is done to avoid
referring to symbols in scala-compiler.jar. Class- and Type-Tag
materialization is treated in the same way.
This commit positions the replacement trees to avoid triggering
assertions under -Yrangepos.
|
|\ \ \
| | | |
| | | | |
fix typo in BigInt/BigDecimal deprecation messages
|
| |/ / |
|
|\ \ \
| | | |
| | | | |
SI-7617 typedAssign no longer expands lhs
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This makes sure that setter and updateDynamic macros work as intended
rather than in some cases expanding incorrectly or prematurely.
Setter invocations are desugared from assignments of values to getters.
If a typecheck of an assignment's lhs yields an invocation of a getter,
then the assignment is rewritten into an invocation of a setter. However
if a getter is a macro, then it just expands, destroying the prerequisite
for desugaring. Therefore we need to disable expansion for the typecheck
of an lhs.
Similar thing happens to updateDynamic that first desugars a getter
invocation into q"$target.updateDynamic($fieldName)" and then expects
typedAssign to rewrite the corresponding Assign node into an additional
application of a partially applied updateDynamic to a rhs. Here we also
need to disable the typecheck of an lhs, because macros cannot be
partially applied.
|
| | | | |
|
| |/ /
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The crash was caused by a symbol lookup to rewire the super calls,
done after pickler, but specialization added new traits and new
members, thus making the super rewiring impossible. To avoid such
problems, this patch moves symbol lookup after specialization,
so the changes done by specialization (and miniboxing) become
visible to mixin.
NOTE: This patch will be followed by a similar patch to master.
Review by @adriaanm or @retronym.
|
|\ \ \
| | | |
| | | | |
SI-7603 Speculative fix for annotation binding error
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Reports of:
error: trait Test is abstract; cannot be instantiated
11:09:50 [ant:scalac] @Test def testClientRequestNum = {
11:09:50 [ant:scalac] ^
Suggest that the deferred processing of a LazyAnnotationInfo is binding
the identifier `Test` to the wrong symbol. Inspection of the code shows
that the closure also defers capture of the (mutable) field
`Namer#typer.context`.
This commit captures the context eagerly, and adds logging to let us
know if that eagerly captured context ever differs from the its value
at the point when the annotation info is forced.
I spent a few hours trying to craft a test to back this up, but to no
avail. Here's what the log output will look like:
[log typer] The var `typer.context` in scala.tools.nsc.typechecker.Namers$NormalNamer@1f5ebb08 was mutated before the annotation new a() was forced.
current value = Context(C@Import unit=<console> scope=123861466 errors=false, reportErrors=true, throwErrors=false)
original value = Context(C@Import unit=<console> scope=123861466 errors=false, reportErrors=true, throwErrors=false)
This confirms the hypothesis for the cause of SI-7603. If you see this message, please comment on that ticket.
|
|\ \ \
| | | |
| | | | |
Less noise on a partest failure.
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Throwing a BuildException is the polite way to fail the Ant build.
Before:
BUILD FAILED
/Users/jason/code/scala2/build.xml:1522: java.lang.RuntimeException: Test suite finished with 1 case failing:
/Users/jason/code/scala2/test/files/pos/lub-dealias-widen.scala [FAILED]
at scala.sys.package$.error(package.scala:27)
[20 lines elided]
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Total time: 2 minutes 35 seconds
After:
BUILD FAILED
/Users/jason/code/scala2/build.xml:1522: Test suite finished with 1 case failing:
/Users/jason/code/scala2/test/files/pos/lub-dealias-widen.scala [FAILED]
Total time: 2 minutes 34 seconds
|
|\ \ \
| | | |
| | | | |
SI-7344 Specialize methods in private scopes
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This performs method specialization inside a scope other than a {class,
trait, object}: could be another method or a value. This specialization
is much simpler, since there is no need to record the new members in
the class signature, their signatures are only visible locally.
It works according to the usual logic:
- we use normalizeMember to create the specialized symbols
- we leave DefDef stubs in the tree that are later filled in by tree
duplication and adaptation
The solution is limited by SI-7579: since the duplicator loses the sym
annotations when duplicating, this expansion and rewiring can only take
place in code that has not been subject to duplication. You can see the
test case for an example.
Review by @dragos, @paulp or @axel22.
|
|\ \ \
| | | |
| | | | |
SI-7571 Allow nesting of anonymous classes in value classes
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
5d9cde105e added deep prohibition of nested classes within
a value class. This has the undesirable side effect of
prohibiting partial functions literals in method bodies
of a value class.
The intention of that prohibition was to avoid problems
in code using Type Tests, such as:
class C(val inner: A) extends AnyVal {
class D
}
def foo(a: Any, other: C) = a match { case _ : other.D }
Here, the pattern usually checks that `a.$outer == other`.
But that is incongruent with the way that `other` is erased
to `A`.
However, not all nested classes could lead us into this trap.
This commit slightly relaxes the restriction to allow anonymous
classes, which can't appear in a type test.
The test shows that the translation generates working code.
|
|\ \ \ \
| |_|/ /
|/| | |
| | | |
| | | | |
viktorklang/wip-cleaner-Future-method-implementations-2.10-√
General SIP-14 Future method implementation cleanup
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Optimizations:
1) Avoiding isDefinedAt + apply and using applyOrElse to allow for optimizations later
2) Reducing method sizes to be more JIT + inliner friendly
3) Reusing core combinators to reuse inliner/JIT optimizations and be more code-cache friendly
|
|\ \ \ \
| | | | |
| | | | | |
SI-7343 Fixed phase ordering in specialization
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Specialization rewires class parents during info transformation, and
the new info then guides the tree changes. But if a symbol is created
during duplication, which runs after specialization, its info is not
visited and thus the corresponding tree is not specialized.
One manifestation is the following:
```
object Test {
class Parent[@specialized(Int) T]
def spec_method[@specialized(Int) T](t: T, expectedXSuper: String) = {
class X extends Parent[T]()
// even in the specialized variant, the local X class
// doesn't extend Parent$mcI$sp, since its symbol has
// been created after specialization and was not seen
// by specialzation's info transformer.
...
}
}
```
We can fix this by forcing duplication to take place before specialization.
Review by @dragos, @paulp or @axel22.
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | | |
It was never used since its introduction in 3ee6b3653 by @dragos.
Review by @dragos or @axel22 or @paulp.
|
|/ / / |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously, the `split` method of the `ParTrieMap` iterator threw
an exception when splitting a splitter that iterated over nodes
whose hash codes collide.
This was due to reusing the iterator of the list of colliding keys
rather than creating a new splitter.
This commit changes the `subdivide` method to create a new
iterator using the factory method of the current trie map
iterator rather than returning a `LinearSeqLike` iterator.
|
|\ \ \
| | | |
| | | | |
Test for reading JDK 8 (classfile format 52) class files.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
We had several tests designed to only run if the JDK version was at
least some specified version. This commit refactors that common logic
into DirectTest.
|
|\ \ \ \
| | | | |
| | | | | |
SI-6841 Fix bug at the intersection of DelayedInit and named args
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The DelayedInit transformation analyses the constructor to partition
regular initialization from calls to super constructors / trait
initializers.
It failed to find such super calls if they were nested in a Block,
which can happens when using named or default arguments.
This commit makes that code peer into Blocks to correctly partition
the constructor statements.
This change doesn't affect the result of run/t4680.scala, which was
mentioned in nearby comments and which chronicles bugs with DelayedInit
when used in inheritance hierarchies.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-7558 Fix capture of free local vars in toolbox compiler
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
It was creating an `ObjectRef[<notype>]` because of a small
bug in `capturedVariableType`.
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
SI-7556 Fix runtime reflection involving ScalaLongSignature
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Scala type information is stored in classfiles in encoded in a String
in the ScalaSignature annotation. When it is too big for a single
String, it is split into an array of Strings in a different annotation,
ScalaLongSignature.
The enclosed test, with a class containing 3000 methods, uses the latter.
It exposes a bug in the way runtime reflection decodes that data.
It must concatentate and *then* decode, rather that the other way around.
|
|\ \ \ \ \
| |_|_|_|/
|/| | | | |
SI-7507 Fix lookup of private[this] member in presence of self type.
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In the following code:
trait Cake extends Slice
trait Slice { self: Cake => // must have self type that extends `Slice`
private[this] val bippy = () // must be private[this]
locally(bippy)
}
`ThisType(<Slice>)`.findMember(bippy)` excluded the private local member on
the grounds that the first class in the base type sequence, `Cake`, was
not contained in `Slice`.
scala> val thisType = typeOf[Slice].typeSymbol.thisType
thisType: $r.intp.global.Type = Slice.this.type
scala> thisType.baseClasses
res6: List[$r.intp.global.Symbol] = List(trait Cake, trait Slice, class Object, class Any)
This commit changes `findMember` to use the symbol of the `ThisType`, rather
than the first base class, as the location of the selection.
|
|\ \ \ \
| |/ / /
|/| | | |
SI-7375 ClassTag for value class aliases
|
| | | |
| | | |
| | | |
| | | | |
reifyRuntimeClass now always dealiases its argument prior to processing.
|
|\ \ \ \
| |_|/ /
|/| | | |
SI-6138 Centralize and refine detection of `getClass` calls
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
`getClass` is special cased in the compiler; this is described
in in the comments on `Definitions.Any_getClass`.
Part of this happens in `Typer#stabilize`. This was trying to determine
if an Ident or Select node was a call to `getClass` by merits of the name
of the tree's symbol and by checking that the its type (if it was a
MethodType or PolyType) had no parameters in the primary parameter list.
Overloaded user defined `getClass` methods confused this check. In the
enclosed test case, the tree `definitions.this.getClass` had an
`OverloadedType`, and such types always report an empty list of `params`.
This commit:
- changes `stabilize` to use `isGetClass`, rather than the
homebrew check
- changes `isGetClass` to consider a `Set[Symbol]` containing all
`getClass` variants. This moves some similar code from `Erasure`
to `Definitions`
- keeps a fast negative path in `isGetClass` based on the symbol's name
|
|\ \ \ \
| |_|/ /
|/| | | |
SI-7391 Always use ForkJoin in Scala actors on ...
|