| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit gets rid off code wrapping that was previously used by
toolbox to get into correct parsing mode. Instead combination of
templateStats/accept(EOF) is used. This is the same solution as the one
used in repl and built-in scriptRunner
This pull request doesn't attempt to generalize this approach in any
way and re-use it all over the place due to the caution of possible
accidental compatibility breakage. I plan to do it separately against
master.
Additionally there are a few more changes that make importers be aware
of positions and a test for that (via @jedesah).
|
|\
| |
| | |
SI-4907 SI-4615 scala.bat now honors -J and -D options.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This makes scala.bat parse and use -J and -D arguments.
Specifically:
- Parameters starting with -J are stripped of the prefix, unquoted if
necessary and appended to %JAVA_OPTS% or default values.
- Parameters starting with -D are unquoted if necessary and then
appended to the others. The right-hand side of a property can be
quoted or not.
- All of those are given to `java` before any other parameters.
- The above only happens on parameter preceding the first parameter
that does not start with "-" (usually a class name).
- The exact arguments passed to scala.bat are also given as-is to
the scala launcher (including -J and -D arguments).
set JAVA_OPTS=-Xmx512m
scala -J-Xmx128m -Dprop1=42 -Dprop2="hello world" "-Dprop3=bar"
"-J-Xms64m" Test foo
will result in
java -Xmx512m -Xmx128m -Dprop1=42 -Dprop2="hello world" -Dprop3=bar
-Xms64m [cp, scala main] -J-Xmx128m -Dprop1=42 -Dprop2="hello world"
"-Dprop3=bar" "-J-Xms64m" Test foo
|
|\ \
| | |
| | | |
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-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.
|
|\ \
| | |
| | | |
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.
|
|\ \ \
| | | |
| | | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
|\ \
| |/
|/| |
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-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
|
|/
|
|
|
|
| |
This commit makes building PostfixSelect robust against a bad pos
on its operand, which can happen if a bad for expression results
in an EmptyTree.
|
|\
| |
| | |
c.typeCheck(silent = true) now suppresses ambiguous errors
|
| |
| |
| |
| |
| |
| | |
Otherwise use cases like the one shown in the attached test (trying to
typecheck something, which leads to an ambiguous overload error) will
mysteriously fail compilation.
|
|\ \
| | |
| | | |
SI-6424 Scaladoc: Use mapNodes.get(_) to avoid NoSuchElementException
|
| | |
| | |
| | |
| | | |
Use mapNodes.get(_) instead of mapNodes(_) to avoid NoSuchElementException.
|
|\ \ \
| | | |
| | | | |
Prevent slash duplication.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Don't add trailing slash to external doc URL if it already ends with
one.
|
|/ / /
| | |
| | |
| | | |
What a touchy beast the compiler is.
|
|\ \ \
| | | |
| | | | |
easy way of writing not implemented macros
|
| |/ /
| | |
| | |
| | |
| | |
| | | |
Even though it's easy to mark regular method bodies as stubs (using ???),
there's no simple way of doing the same for macro methods. This patch
fixes the inconvenience.
|
| | |
| | |
| | |
| | | |
Oops, I miss when unreachable code was an error.
|
|\ \ \
| | | |
| | | | |
SI-5886 Remove check for packed type conformance.
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | | |
Nothing breaks. Why did by-name arguments have this
extra check? What's the difference to a () => T?
The check was added originally in 8414eba.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit daefab18b8b0c170c372991022357413ec69b2af attempted to fix a bug
related to Scaladoc filtering, meanwhile breaking Scaladoc keyboard
shortcuts.
Before commit daefab18b8b0c170c372991022357413ec69b2af, Scaladoc's
filter wouldn't consider the last character of a search term entered
into the (left) Scaladoc filter pane, but toggling with the `tab` key
between filter panes did work.
After daefab18b8b0c170c372991022357413ec69b2af, Scaladoc's left pane
filter correctly searches for the full search term, but pressing the
`tab` key causes the "focus" of the input bar to be stuck on the
filter panel in the right Scaladoc filter pane, rendering it useless.
End result: annoying Scaladoc interface bug present in 2.10.1, but
which wasn't present in 2.10.0.
This pull request fixes this, enabling both behaviors. The `tab` key
toggle needed to be triggered on a `keydown` event (currently it's
not), while everything else is fine to be triggered on a `keyup`
event. This pull request enables the correct behavior by binding both
a `keydown` and a `keyup` event rather than lumping everything all
together in a `keyup` event (as was the case before).
|
|\ \
| | |
| | | |
makes sense of implicit macros!
|
| | |
| | |
| | |
| | | |
Shame-driven development at its best.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Despite inferImplicit usually being nice and buffering errors, apparently
it can also throw DivergentImplicit exception. This patch catches it and
only reports it if silent is set to false.
NOTE: we no longer have the DivergentImplicit exception in master,
so this commit only makes sense in 2.10.x.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
silent = true now throws a TypecheckException even if we don't know why
an implicit search has failed (i.e. if context.hasErrors is false).
NOTE: this commit is a part of a pull request for 2.10.x, which makes sense of
implicit macros. Everything in that pull request is [nomaster] due to one
reason or another. This commit would work equally well in both 2.10.x and
master, but I'm marking it as [nomaster] as well, because I'm anyway going
to resubmit the whole pull request into master soon, so there's no reason
to introduce additional confusion.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Since we don't throw exceptions for normal errors it was a bit odd
that we don't do that for DivergingImplicit.
As SI-7291 shows, the logic behind catching/throwing exception
was broken for divergence. Instead of patching it, I rewrote
the mechanism so that we now another SearchFailure type related
to diverging expansion, similar to ambiguous implicit scenario.
The logic to prevent diverging expansion from stopping the search
had to be slightly adapted but works as usual.
The upside is that we don't have to catch diverging implicit
for example in the presentation compiler which was again showing
that something was utterly broken with the exception approach.
NOTE: This is a partial backport of https://github.com/scala/scala/pull/2428,
with a fix for SI-7291, but without removal of error kinds (the former is
absolutely necessary, while the latter is nice to have, but not a must,
therefore I'm not risking porting it to 2.10.x). Also, the fix for SI-7291
is hidden behind a flag named -Xdivergence211 in order not to occasionally
break the code, which relies on pre-fix behavior.
|