| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
The differences when running with method based delambdafication aren't
important enough yet to create specialized versions that use method
based delambdafication.
|
|
|
|
|
|
| |
This commit includes several tests where there's a variation in
signatures between inline delambdafication and method based
delambdafication.
|
|
|
|
|
|
|
|
| |
During development of late delmabdafying there was a problem where
specialization would undo some of the work done in uncurry if the body
of the lambda had a constant type. That would result in a compiler crash
as when the delambdafy phase got a tree shape it didn't understand.
This commit has a fix and a test.
|
|
|
|
|
|
|
|
| |
During development of delayed delambdafy there was a problem where
GenASM would eliminate a loadmodule for all methods defined within that
module even if those methods were static. The result would be broken
byte code that failed verification. This commit fixes that and adds a
test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit puts a real body on the Delambdafy phase.
From a lambda, Delambdafy will create
1) a static forwarder at the top level of the class that contained
the lambda
2) a new top level class that
a) has fields and a constructor taking the captured environment
(including possbily the "this" reference)
b) an apply method that calls the static forwarder
c) if needed a bridge method for the apply method
3) an instantiation of the newly created class which replaces the
lambda
Trees.scala is modified to add two more convenient factories
for templates and classdefs.
A few basic tests are included to verify that it works as expected.
Further commits will have additional tests.
|
|
|
|
|
| |
the body of a lambda into a local def. Tests are included to show the
different tree shapes.
|
|
|
|
|
|
| |
This commit adds a do-nothing phase called "Delambdafy" that will
eventually be responsible for doing the final translation of lambdas
into classes.
|
|
|
|
|
|
|
|
|
| |
The future-spec tests were spawning threads in object constructors which
meant they were on the ragged edge of entering deadlock from the static
initialization lock acquired during the static initialization blocks we
use to construct object reference fields. My work on restructuring
lambdas pushed it over the edge. This commit refactors the tests to use
class constructors rather than object constructors.
|
|\
| |
| | |
SI-7605 Deprecate procedure syntax
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit covers three cases:
- constructor definitions (def this {...})
- concrete method definitions (def foo {...})
- abstract method declarations (def foo)
The deprecation is currently hidden behind -Xfuture pending IDE support
for migrating users from procedures to methods.
|
|\ \
| | |
| | | |
SI-6385 Avoid bridges to identical signatures over value classes
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
As Paul noted in the comments to SI-6260 (from which I mined some
test cases) "there is no possible basis for conflict here":
scala> class C[A](val a: Any) extends AnyVal
defined class C
scala> class B { def x[A](ca: C[A]) = () }
defined class B
scala> class D extends B { override def x[A](ca: C[A]) = () }
<console>:8: error: bridge generated for member method x: [A](ca: C[A])Unit in class D
which overrides method x: [A](ca: C[A])Unit in class B
clashes with definition of the member itself;
both have erased type (ca: Object)Unit
class D extends B { override def x[A](ca: C[A]) = () }
^
What was happening?
Bridge computation compares `B#x` and `D#x` exitingErasure, which
results in comparing:
ErasedValueType(C[A(in B#x)]) =:= ErasedValueType(C[A(in D#x)])
These types were considered distinct (on the grounds of the unique
type hash consing), even though they have the same erasure and
involve the same value class.
That triggered creation of an bridge. After post-erasure eliminates
the `ErasedValuedType`s, we find that this marvel of enginineering is
bridges `(Object)Unit` right back onto itself. The previous
resolution of SI-6385 (d435f72e5fb7fe) was a test case that confirmed
that we detected the zero-length bridge and reported it nicely, which
happened after related work in SI-6260. But we can simply avoid
creating in it in the first place.
That's what this commit does. It does so by reducing the amount
of information carried in `ErasedValueType` to the bare minimum needed
during the erasure -> posterasure transition.
We need to know:
1. which value class wraps the value, so we can box and unbox
as needed
2. the erasure of the underlying value, which will replace this
type in post-erasure.
This construction means that the bridge above computation now
compares:
ErasedValueType(C, Any) =:= ErasedValueType(C, Any])
I have included a test to show that:
- we don't incur any linkage or other runtime errors in the
reported case (run/t6385.scala)
- a similar case compiles when the signatures align
(pos/t6260a.scala), but does *not* compile when the just
erasures align (neg/t6260c.scala)
- polymorphic value classes continue to erase to the instantiated
type of the unbox: (run/t6260b.scala)
- other cases in SI-6260 remains unsolved and indeed unsolvable
without an overhaul of value classes: (neg/t6260b.scala)
In my travels I spotted a bug in corner case of null, asInstanceOf
and value classes, which I have described in a pending test.
|
| | |
| | |
| | |
| | | |
(for f in $(find test -name '*.check' -o -name '*.flags'); do bare=$(echo $f | sed -E 's/\.\w+$//'); ([[ -f "$bare" ]] || [[ -d "$bare" ]] || [[ -f "$bare.scala" ]] || [[ -f "$bare.test" ]] || echo $f) done;) | xargs rm
|
|/ /
| |
| |
| | |
for f in $(find test -name '*.check' -o -name '*.flags'); do [[ $(wc -c $f | sed -E 's/ *([0-9]+).*/\1/') == "0" ]] && rm $f; done
|
|\ \
| | |
| | | |
Favour module accessors symbols in rebind
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The Refchecks tree transformer transforms a nested modules that
overrides a method into a pair of symbols: the module itself, and
an module accessor that matches the overridden symbol.
[[syntax trees at end of typer]] // test1.scala
package <empty> {
abstract trait C2 extends scala.AnyRef {
def O1: Any
};
class C1 extends AnyRef with C2 {
object O1 extends scala.AnyRef
}
}
[[syntax trees at end of refchecks]] // test1.scala
package <empty> {
abstract trait C2 extends scala.AnyRef {
def O1: Any
};
class C1 extends AnyRef with C2 {
object O1 extends scala.AnyRef
@volatile <synthetic> private[this] var O1$module: C1.this.O1.type = _;
<stable> def O1: C1.this.O1.type = {
C1.this.O1$module = new C1.this.O1.type();
C1.this.O1$module
}
}
}
When constructing a TypeRef or SingleType with a prefix and and a symbol,
the factory methods internally use `rebind` to see if the provided symbol
should be replaced with an overriding symbol that is available in that prefix.
Trying this out in the REPL is a bit misleading, because even if you change
phase to `refchecks`, you won't get the desired results because the transform
is not done in an InfoTransformer.
scala> val O1 = typeOf[C1].decl(TermName("O1"))
O1: $r.intp.global.Symbol = object O1
scala> typeRef(typeOf[C2], O1, Nil)
res13: $r.intp.global.Type = C2#O1
scala> res13.asInstanceOf[TypeRef].sym.owner
res14: $r.intp.global.Symbol = class C1
But debugging the test case, we get into `rebind` during an AsSeenFrom
which is where we crashed when `suchThat` encountered the overloaded
module and module accessor symbols:
typeOf[OuterObject.Inner.type].memberType(symbolOf[InnerTrait.Collection])
...
singleTypeAsSeen(OuterTrait.this.Inner.type)
val SingleType(pre, sym) = tp
// pre = OuterTrait.this.type
// sym = OuterTrait.Inner
val pre1 = this(pre) // OuterObject.type
singleType(pre1, sym)
rebind(pre1, sym) // was crashing, now OuterObject.Inner
}
This commit excludes the module symbol from symbol lookup in the prefix in rebind.
|
|\ \ \
| | | |
| | | | |
Update description of explicitouter phase.
|
| | | |
| | | |
| | | |
| | | | |
Patern translation now happens earlier.
|
|\ \ \ \
| |/ / /
|/| | | |
SI-7883 - don't iterate over all keys in MapWrapper.containsKey()
|
| | | | |
|
|\ \ \ \
| |_|_|/
|/| | | |
Tests for protected access
|
| | | |
| | | |
| | | |
| | | |
| | | | |
I've marked a few minor cases in the test with !!! where I believe
the behaviour goes beyond the spec.
|
| | | |
| | | |
| | | |
| | | | |
c39f26382dddaa7 fixed the bug but didn't commit a test case.
|
|\ \ \ \
| | | | |
| | | | | |
Filter JVM debug output for custom options in partest
|
| | | | |
| | | | |
| | | | |
| | | | | |
The Picked up _JAVA_OPTIONS line occurs on Sun's JDK as a debug output when you use that variable to set up custom VM options
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-6840 fixes weird typing of quasiquote arguments
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Previously quasiquote arguments were type checked against Any
which caused weird inference that made splicing of complex expressions
unusable:
val l1 = List(q"foo")
val l2 = List(q"bar")
q"f(..${l1 ++ l2})" // argument type checked as Any instead of List[Tree]
This is fixed by forcing compiler to type check against type
variable which itself isn't used in any other way.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
better macro impl shape errors
|
| |/ / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
With the advent of quasiquotes, we allowed both arguments and return types
of macro impls to be c.Tree's (as opposed to traditional c.Expr[T]'s).
This warrants an update of macro def <-> macro impl signature mismatch
errors that include a printout of suggested macro impl signatures. Now
along with a signature that contains exprs, we suggest another signature
that has all exprs replaced by trees
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Deterministic warnings for pattern matcher, take 2
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
The previous swing at determinism, ebb01e05cbe4, made decent
contact but apparently didn't hit it out of the park. The test
wavered every hundred or so runs, as witnessed occasionally in
nightly builds or pull request validation.
I setup a test to run neg/7020.scala a few hundred times, and
could trigger the failure reliably.
I then swept through the pattern matcher in search of HashMap and
HashSet creation, and changed them all to the Linked variety.
The results of that are published in retronym#ticket/7020-3 [1].
This commit represents the careful whittling down of that patch
to the minimal change required to exhibit determinism.
[1] https://github.com/retronym/scala/compare/ticket/7020-3
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
SI-7519: Additional test case covering sbt/sbt#914
|
| | |/ / / / /
| |/| | | | | |
|
|\ \ \ \ \ \ \
| |_|_|_|_|_|/
|/| | | | | | |
fixes handling of fancy nested classes in runtime reflection
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Replaces the `jclazz.isMemberClass` check for whether we have an
inner/nested class with `jclazz.getEnclosingClass != null`, because there
exist classes produced by javac (see the attached jar file and the test log)
which have the following properties:
* They are nested within a parent class
* getEnclosingClass returns a non-null value
* isMemberClass returns false
Previously such classes were incorrectly treated as non-nested, were
incorrectly put into an enclosing package rather than an enclosing class,
and had their names trimmed in the process, leading to situations when
a package has multiple declarations with the same name. This is now fixed.
When changing the check, we need to be careful with interpretation of
what Class.getEnclosingXXX methods return. If getEnclosingClass produces
a non-null result, this doesn't mean that the class is inner or nested,
because getEnclosingClass is also not null for local classes (the ones
with getEnclosingMethod != null || getEnclosingConstructor != null).
This is expressed in the order of pattern match clauses in `sOwner`.
Now when the bug is fixed, I also revert b18a2f8798b2, restoring a very
important integrity check in runtime reflection, which I had to disable
a couple hours ago to fix a master breakage. More details at scala-internals:
https://groups.google.com/forum/#!topic/scala-internals/hcnUFk75MgQ
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
This test has been a source of spurious failures as in, for example
https://github.com/scala/scala/pull/3029#issuecomment-26811129,
so I'm disabling it for the time being while I investigate the issue.
|
|\ \ \ \ \ \ \
| |_|_|/ / / /
|/| | | | | | |
deprecates raw tree manipulation facilities in macros.Context
|
| | | | | | | |
|
| | | | | | | |
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
test/disabled, not test/files/disabled.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
File.pathSeparator, rather than ":"
|
| |_|/ / / /
|/| | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Removes the Unix-specific command-line sanity check put in place in recently
committed reflection tests.
On Windows, something like `C:\Java\jdk1.6.0_24-x64\jre\bin\java` might
be a valid command (pointing to `java.exe` or `java.bat`) even if
the eponymous file does not exist.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Add support for packages into quasiquotes and toolbox, improve handling of fresh names, unhardcode quasiquote expansion logic
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
This should ensure that concurrent access to the
fresh name creator is properly synchronized.
|
| | | | | | | |
|
| | | | | | | |
|
| | | | | | | |
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
During parsing some names are generated artificially using freshTermName & freshTypeName (e.g. `x$1`). Such names should be reified in a different way because they are assumed to be always fresh and non-overlapping with the environment. So `x$1` should reify down to equivalent of `freshTermName("x$")` rather than `TermName("x$1")`.
But this is not enough. One name can be used more than once in a tree. E.g. `q"_ + 1"` desugars into `q"x$1 => x$1 + 1"`. So we need to ensure that every place where `x$1` is used gets the same fresh name. Hence the need for `withFreshTermName` that lets q"_ + 1" quasiquote desugare into equivalent of `withFreshTermName("x$") { freshx => q"$freshx => $freshx + 1" }`.
For pattern quasiquotes it's a bit different. Due to the fact that end-result must be a pattern we need to represent fresh names as patterns too. A natural way to express that something is fresh is to represent it as a free variable (e.g. any name will do in that place). But due to possible use of the same name in multiple places we need to make sure that all such places have the same values by adding a sequence of guards to the pattern.
Previously such names were reified naively and it could have caused name collision problems and inability to properly much on trees that contain such names.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Previously due to limited support for expansion in apply position
quasiquotes had to use a compiler hook for deconstruction. Now with
recent changes in pattern matcher it's possible to remove that special
case.
|
| | | | | | | |
|