| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
SI-7275 allow flattening of blocks with ..$
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
1. Adds tests for new synthetic unit stripping.
2. Marks implementation-specific parts of Holes as private.
3. Trims description of iterated method a bit.
4. Provides a bit more clear wrapper for q interpolator.
5. Refactors SyntacticBlock, adds documentation.
6. Makes q"{ ..$Nil }" return q"" to be consist with extractor.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit extends current splicing rules to allow flattening of
trees into other trees.
Without such support it is impossible to correctly create vals with
patterns and use it in other location as they could expand into
multiple-statement blocks:
scala> q"val (a, b) = (1, 2)"
res0: reflect.runtime.universe.Tree =
{
<synthetic> <artifact> private[this] val x$1 = scala.Tuple2(1, 2):
@scala.unchecked match {
case scala.Tuple2((a @ _), (b @ _)) => scala.Tuple2(a, b)
};
val a = x$1._1;
val b = x$1._2;
()
}
scala> q"..$res0; println(a + b)"
res1: reflect.runtime.universe.Tree =
{
<synthetic> <artifact> private[this] val x$1 = scala.Tuple2(1, 2):
@scala.unchecked match {
case scala.Tuple2((a @ _), (b @ _)) => scala.Tuple2(a, b)
};
val a = x$1._1;
val b = x$1._2;
println(a.$plus(b))
}
|
| |
| |
| |
| |
| | |
Error out type args on binary op after emitting error.
Let the parse limp into the whirring blades.
|
|\ \
| | |
| | | |
Newline after empty string interp
|
| | |
| | |
| | |
| | |
| | | |
Consume the newline non-raw for safe handling after
single-line interpolation.
|
|\ \ \
| | | |
| | | | |
-Xsource:2.10: lenient treatment of variance in <:<, =:=
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The soundness hole was exploited in Scalaz. They have fixed their
codebase correctly for Scalac 7.1.x, but have less freedom to
break source compatiblity in 7.0.x.
After this commit, they could choose to compile that branch with
-Xsource:2.10
|
|\ \ \ \
| |/ / /
|/| | | |
SI-8171 make tq"" an alias for empty type tree
|
| | | | |
|
|\ \ \ \
| |_|/ /
|/| | | |
ListMap.tail is returning wrong result
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Reverted the commit that introduced the bug, and modified HashMap to no
longer assume that tail is O(1).
Review by @Ichoran, @soc
|
|\ \ \ \
| |_|/ /
|/| | | |
Preliminary support for building and testing with Java 8
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Replace the use of `Ordering` by custom, dummy trait Xyz defined in test's
source.
By not inheriting from Ordering in abstract-report2 we make the test
less dependent on both Scala and Java library. The reason we are less
dependent on Java is because Ordering extends Java's comparator.
This change is motivated by the fact that Java 8 introduced default
method `reversed` to Comparator interface and we get a failure due to
conflicting inheritance:
-abstract-report2.scala:9: error: trait Bippy inherits conflicting members:
- method reversed in trait TraversableOnce of type => List[(T2, String)] and
- method reversed in trait Comparator of type ()java.util.Comparator[T3]
-(Note: this can be resolved by declaring an override in trait Bippy.)
-trait Bippy[T1, T2, T3] extends Collection[T1] with TraversableOnce[(T2, String)] with Ordering[T3]
- ^
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | | |
JDK7 and JDK8 have a bug that causes JVM to print some warning about
applets that is unrelated to whatever we are testing in Scala. Let's
work it around using test/files/filters mechanism that allows us to filter
out output lines based on regexp.
|
|\ \ \
| |_|/
|/| | |
SI-6879 improves Context.freshName
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Instead of per-compilation unit unique counters, the freshName API now
uses a per-Global counter. Fresh names now also contain dollars to exclude
clashes with supported user-defined names (the ones without dollar signs).
This doesn’t fix the bug, because per-Global counters get created anew
every time a new Global is instantiated, and that provides some potential
for name clashes even for def macros, but at least it completely excludes
clashes in typical situations.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In 2.11 we've changed TupleClass, ProductClass and FunctionClass
endpoints to be exposed as (Int => Symbol) functions that never throw
exceptions but rather return NoSymbol instead of previous error-prone
indexed access on array that could explode.
While simplifying one use case (indexed access) it complicated
ability to check if symbol at hand is in fact a tuple, product or
function:
(1 to 22).map(TupleClass).toList.contains(symbol)
To cover this extra use case we add a seq method to the variable arity
class definitions that exposes a corresponding sequence of class symbols:
TupleClass.seq.contains(symbol)
|
|\ \ \
| |/ /
|/| | |
Improve naming of ReadStdin
|
| | |
| | |
| | |
| | |
| | | |
We don't need to say everything twice, methods are already prefixed
with “read”.
|
|\ \ \
| | | |
| | | | |
deprecates resetAllAttrs and resetLocalAttrs in favor of the new API
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
We now have c.untypecheck, which is supposed to be a counterpart of c.typecheck
in the sense that it goes back from typed trees to untyped ones:
http://stackoverflow.com/questions/20936509/scala-macros-what-is-the-difference-between-typed-aka-typechecked-an-untyped.
Let’s hope that c.untypecheck will soon be able to solve our problems
with partially/incorrectly attributed trees emitted by macros:
https://groups.google.com/forum/#!topic/scala-internals/TtCTPlj_qcQ.
|
|\ \ \ \
| | | | |
| | | | | |
SI-8151 Remove -Yself-in-annots and associated implementation
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This experimental option typechecked arguments of annotations
with an injected value in scope named `self`:
@Foo(self.foo < 1)
This has been slated for removal [1] for some time.
This commit removes it in one fell swoop, without any attempt
at source compatibility with code that constructs or pattern
matches on AnnotatedType.
[1] https://groups.google.com/d/msg/scala-internals/VdZ5UJwQFGI/C6tZ493Yxx4J
|
|\ \ \ \
| | | | |
| | | | | |
Fix regression with package objects, overloading
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Regressed in f5c336d56, a refactoring of `typedIdent`. In that
commit, an (ostensibly) accidental change arrived, equivalent to:
- val pre1 = if (qual == EmptyTree) NoPrefix else if (sym.isTopLevel) sym.owner.thisType else qual.tpe
+ val pre1 = if (sym.isTopLevel) sym.owner.thisType else if (qual == EmptyTree) NoPrefix else qual.tpe
Here, `qual` is a tree returned in the successful result of
`Context#lookup`.
This change itself looks innocuous (top level symbols can be prefixed
with a qualifier or not, right?), but it exposed us to a bug in
`makeAccessible`. It is responsible for rewriting, e.g,
`scala.List` to `scala.package.List`. It has a few cases, but one
of them relies relies on typechecking `Ident(nme.PACKAGE)`, and
hoping that it will bind to the right place. That's fraught with
danger, and breaks in the enclosed tests.
This commit binds that Ident symbolically, and in the process
factors a tiny bit of code in common with `TreeGen`. (More work
is still needed here!)
In the next commit, I'm going to revert the change to `pre1`. That
would have also fixed the regression, albeit symptomatically.
|
|\ \ \ \
| |_|_|/
|/| | | |
fixes some typos and types
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Apparently, even though the compiler has safeguards against infinite type
printouts, having a depth counter, we didn’t account for the cases when
printouts are both self-referential and self-multiplying.
For one, SI-8158 provides an example of such a type, which is a structural
type that refers to itself twice in return types of its methods. At first,
printing such a type would go deeper and deeper, but then it will hit
the depth limit and start multiply indefinitely.
This commit fixes this particular problem by recognizing self-references
as this.type’s and printing them out as such. The subsequent commit will
introduce a more general facility.
|
|\ \ \ \
| |/ / /
|/| | | |
|
| |\ \ \
| | | | |
| | | | | |
Fix bug with super-accessors / dependent types
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Super-accessors are generated as `DefDef`'s with `EmptyTree` as a
placeholder for the RHS. This is filled in later in `Mixin` in
`completeSuperAccessor`.
A change in `Uncurry` (SI-6443 / 493197f), however, converted this
to a `{ EmptyTree }`, which evaded the pattern match in mixin.
This commit adds a special case to the dependent method treatment
in Uncurry to avoid generating redundant blocks.
|
| |\ \ \ \
| | | | | |
| | | | | | |
[nomaster] Backport variance validator performance fix
|
| | |/ / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
% time qbin/scalac test/files/pos/t8146-performance.scala
real 0m2.015s
user 0m2.892s
sys 0m0.215s
% time scalac-hash v2.10.3 test/files/pos/t8146-performance.scala
real 1m13.652s
user 1m14.245s
sys 0m0.508s
Cherry-picks one hunk from 882f8e64.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Merge 2.10.x
|
| |\| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Conflicts:
src/compiler/scala/tools/nsc/typechecker/Typers.scala
|
| | |\ \ \ \
| | | |/ / /
| | |/| | | |
Repair symbol owners after abandoned named-/default-args
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Names/Defaults eagerly transforms an application with temporaries
to maintain evaluation order, and dutifully changes owners of
symbols along the way.
However, if this approach doesn't work out, we throw away this
and try a auto-tupling. However, we an still witness symbols
owned by the temporaries.
This commit records which symbols are owned by the context.owner
before `transformNamedApplication`, and rolls back the changes
before `tryTupleApply`.
Perhaps a better approach would be to separate the names/defaults
applicability checks from the evaluation-order-preserving transform,
and only call the latter after we have decided to go that way.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
We can't backport SI-7120 to 2.10.x as it changes erased signatures,
which can lead to interop problems between 2.10.3 and 2.10.4.
But, we can detect one of the nasty symptoms -- a bridge method
with the same signature as its target -- and treat that.
This commit detects duplicate bridges in the ASM (only) backend
and removes them.
|
| |\| | | | |
|
| | |/ / /
| | | | |
| | | | |
| | | | | |
Progressed to working in SI-7636 / c4bf1d5.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
As it was discovered in SI-8104, whiteboxity doesn’t apply equally to
type parameters and type members of materialized type classes.
During implicit search and subsequent type inference, whitebox type parameters
are consistently erased to wildcards, whereas whitebox type members sometimes
remain as is and get in the way of signature conformance checks.
Unfortunately, 2.10.x can’t make use of type parameter whiteboxity, because
it requires fundep materializers that were only merged into 2.11:
https://github.com/scala/scala/pull/2499, and therefore Si-8104 seems to be
a hard blocker for 2.10.x at the moment. Stay tuned for updates.
|
| |\| | |
| | |_|/
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Check files updated: test/files/presentation/t8085*.check
Conflicts:
build.xml
src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
A source file like:
import foo.bar
package object baz
Is parsed into:
package <empty> {
import foo.bar
package baz {
object `package`
}
}
A special case in Namers compensates by adjusting the owner of
`baz` to be `<root>`, rather than `<empty>`.
This wasn't being accounted for in `BrowserTraverser`, which
underpins `-sourcepath`, and allows the presentation compiler to
load top level symbols from sources outside those passes as
the list of sources to compile.
This bug did not appear in sources like:
package p1
package object p2 { ... }
... because the parser does not wrap this in the `package <empty> {}`
This goes some way to explaining why it has gone unnoticed for
so long.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
* The presentation compiler sourcepath is now correctly set-up.
* Amazingly enough (for me at least), the outer import in the
package object seem to be responsible of the faulty behavior.
In fact, if you move the import clause *inside* the package object,
the test succeed!
The test's output does provide the correct hint of this:
```
% diff /Users/mirco/Projects/ide/scala/test/files/presentation/t8085-presentation.log /Users/mirco/Projects/ide/scala/test/files/presentation/t8085.check
@@ -1,3 +1,2 @@
reload: NodeScalaSuite.scala
-prefixes differ: <empty>.nodescala,nodescala
-value always is not a member of object scala.concurrent.Future
+Test OK
```
Notice the ``-prefixes differ: <empty>.nodescala,nodescala``. And compare
it with the output when the import clause is placed inside the package
object:
```
% diff /Users/mirco/Projects/ide/scala/test/files/presentation/t8085-presentation.log /Users/mirco/Projects/ide/scala/test/files/presentation/t8085.check
@@ -1,4 +1,2 @@
reload: NodeScalaSuite.scala
-reload: NodeScalaSuite.scala
-open package module: package object nodescala
Test OK
```
Notice now the ``-open package module: package object nodescala``!
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
We used to silently skip class files that would exceed the JVM's size limits.
While rare, this should still be an error.
While I was at it, also included the name of the offending method.
|
| | |\ \
| | | | |
| | | | | |
Revert ", importable _."
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This reverts commit d2316df920ffa4804fe51e8f8780240c46efa982.
We can't make `_` an illegal identifier -- it's legal in Java,
so we must be able to name these Java underscores.
|
| | |\ \ \
| | | |/ /
| | |/| | |
Fix inliner cycle with recursion, separate compilation
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
ICodeReaders, which decompiles JVM bytecode to ICode, was not
setting the `recursive` attribute of `IMethod`. This meant that
the inliner got into a cycle, repeatedly inlining the recursive
call.
The method name `filter` was needed to trigger this as the inliner
heuristically treats that as a more attractive inlining candidate,
based on `isMonadicMethod`.
This commit:
- refactors the checking / setting of `virtual`
- adds this to ICodeReaders
- tests the case involving `invokevirtual`
I'm not sure how to setup a test that fails without the other changes
to `ICodeReader` (for invokestatic and invokespecial).
|