| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
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.
|
|\ \
| | |
| | | |
More clear implicitNotFound error for ExecutionContext
|
| | | |
|
|\ \ \
| | | |
| | | | |
Update description of explicitouter phase.
|
| | | |
| | | |
| | | |
| | | | |
Patern translation now happens earlier.
|
|\ \ \ \
| |_|/ /
|/| | | |
SI-7883 - don't iterate over all keys in MapWrapper.containsKey()
|
| | | | |
|
| | | | |
|
|\ \ \ \
| |_|/ /
|/| | | |
Prevent useless filter operation in docs
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
IterableLike grouped : fix documentation
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | | |
scala> Seq(1,2,3).grouped(2).toList
res1: List[Seq[Int]] = List(List(1, 2), List(3))
|
|\ \ \ \ \
| | | | | |
| | | | | | |
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
|
|\ \ \ \ \ \
| |_|_|_|_|/
|/| | | | | |
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
|
|\ \ \ \ \ \
| |_|/ / / /
|/| | | | | |
deprecates raw tree manipulation facilities in macros.Context
|
| | |_|/ /
| |/| | | |
|
|\ \ \ \ \
| |_|/ / /
|/| | | | |
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.
|
| | | | | |
|
| | | | | |
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This commit extracts out freshTermName and freshTypeName to the top-level
with implicit fresh name creator argument. This will let to refactor out
more methods out of tree builder into treegen that are dependent on fresh
name generator. We also save quite a bit of boilerplate by not having to
redefined fresh functions all over the place.
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | | |
For sake of consistency with noSelfType.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
emptyValDef should always be reified as emptyValDef. After the the
introduction of SyntacticValDef this ceased to be true.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
As it was pointed out by @paulp current isCaseDefStart method's name
doesn't really correspond to one of it's primary usages: checking if
the block within case has reached it's end.
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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.
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In order to implement this a new parser entry point
`parseStatsOrPackages` that augments current parseStats with ability
to parse "package name { ... }" syntax.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This will help to re-use same logic for creating range positions even
if atPos isn't used to assign position to the tree.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Partial functions are left outside of the call to statSeq to allow
re-use and overriding capabilities for quasiquotes.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Recent runtime reflection sync pull request, which among other things,
introduced more restricted package completion rules, led to a nightmarish
regression on java7, which prevented the entire scalac from starting up.
This commit temporarily disables the introduced assert in order to hotfix
runtime reflection. In the hours to come I'll be looking into the root of
the problem, preparing a pull request that reinstates the assert, which
indicates a bug in our code that's been there since 2.10.0-M3, and fixes
the said bug.
Details: https://groups.google.com/forum/#!topic/scala-internals/hcnUFk75MgQ
|
|\ \ \ \ \
| | | | | |
| | | | | | |
reflection sync
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
https://github.com/scala/scala/pull/3029
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
We do need lazy to be robust, because initialization sequence might
trigger synced operations in unexpected order, leading to NPE's.
Even if this is optimizable by removing some of the lazies or by
carefully reordering cake layers, there's no guarantee that all this
effort won't break after another reflection refactoring.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Fixes this glaring omission of synchronization for a core part of Symbol.info.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This is another optimization we discussed with Roland.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This is one of the changes suggested by Roland in order to reduce contention
caused by reflection GIL.
Locks optimized away here are indirectly used for such fundamental operations
as subtyping tests, so the optimization looks quite important.
|