| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | | | | | |
|
| |\ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
[nomerge] Partial fix for SI-7046
|
| | |/ / / / / |
|
| |\ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
SI-9841 Regression test for init SO
|
| | |/ / / / /
| | | | | | |
| | | | | | |
| | | | | | | |
Verifies example behavior in ticket.
|
| |\ \ \ \ \ \
| | |/ / / / /
| |/| | | | | |
SI-9806 Fix incorrect codegen with optimizer, constants, try/catch
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
The constant optimizer phase performs abstract interpretation of the
icode representation of the progam in order to eliminate dead
code.
For each basic block, the possible and impossible states of each local
variable is computed for both a normal and an exceptional exit.
A bug in this code incorrectly tracked state for exception exits.
This appears to have been an oversight: the new state was computed
at each instruction, but it was discarded rather than folded through
the intepreter.
|
| |/ / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
- Support directories in `-doc-external-doc`: It is documented as
accepting a “classpath_entry_path” for the keys but this only worked
for JARs and not for individual class files. When checking for
external-doc mappings for a Symbol, we now find the root directory
relative to a class file instead of using the full class file path.
The corresponding tests for SI-191 and SI8557 are also fixed to
support individual class files instead of JARs in partest. This is
required for the sbt build which runs partest on “quick” instead of
“pack”.
- Fix version and repository handling for bootstrapping. The bootstrap
`scalaInstance` can now be resolved from any repository added to the
project (not just the bootstrap repositories) by using a different
workaround for https://github.com/sbt/sbt/issues/1872.
- Workaround for https://github.com/sbt/sbt/issues/2640 (putting the
wrong `scalaInstance` on partest’s classpath). The required
`ScalaInstance` constructor is deprecated, so we have to disable
deprecation warnings and fatal warnings until there is a better fix.
- Add MiMa to the sbt build (port of the old `test.bc` ant task). The
sbt-mima plugin doesn’t have all the features we need, so we do it
manually in a similar way to what the plugin does. Checks are done
in both directions for the `library` and `compiler` projects. The
base version has to be set in `build.sbt`. When set to `None`, MiMa
checks are skipped. MiMa checks are run sequentially to avoid spurious
errors (see https://github.com/typesafehub/migration-manager/issues/115).
- Port the OSGi tests to the sbt build. The set of JARs that gets copied
into build/osgi as bundles is a bit different from the ant build. We
omit the source JARs but add additional modules that are part of the
Scala distribution, which seems more correct.
- Get rid up `pull-binary-libs.sh` for the sbt build. Add artifacts are
resolved from the special bootstrap repository through Ivy. The
special `code.jar` and `instrumented.jar` artifacts are copied to the
location where partest expects them (because these paths are hardcoded
in partest). Other extra JARs for partest in `test/files/lib` are
referenced directly from the Ivy cache.
- Move common settings that should be available with unqualified names
in local `.sbt` files and on the command line into an auto-plugin.
- Add an `antStyle` setting to sbt to allow users to easily enable
ant-style incremental compilation instead of sbt’s standard name
hashing with `set antStyle := true`.
- Disable verbose `info`-level logging during sbt startup for both,
`validate/test` and `validate/publish-core` jobs. Update logging is
no longer disabled when running locally (where it is useful and
doesn’t generate excessive output).
- Pass optimization flags for scalac down to partest, using the new
partest version 1.0.15\6.
- Call the new sbt-based PR validation from `scripts/jobs/validate/test`.
- Disable the tests `run/t7843-jsr223-service` and `run/t7933` from
https://github.com/scala/scala/pull/4959 for now. We need to set up
a new test project (either partest or junit) that can run them on a
packaged version of Scala, or possibly move them into a separate
project that would naturally run from a packaged Scala as part of the
community build.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-10068 Only permit elidable methods
|
| | |/ / / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
In refchecks, check that symbol with `@elidable` is a method.
When eliding in uncurry, doublecheck.
The check is enabled under `-Xsource:2.13`.
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
SI-10067 Avoid linkage errors with type patterns, Java inner classes
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Followup to the previous commit to remove the unchecked warning
when the speculative outer test is dropped in explicitouter.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
If we pretend they do, we can walk into NoSuchMethodErrors when
translating type patterns path dependent types.
This commit avoids this symptom by changing the explicitouter
info transformer. A following commit will change the pattern
matcher itself to avoid speculatively adding this outer check
that will be always dropped in explicitouter.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The behaviour changed in #5550, this commit adapts to the change so
that we'll be binary compatible after boostrapping.
MiMa alerted us to a change in the parentage of two objects in the
forkjoin package object.
In Scala 2.12.0/1, they implemented `scala.Serializable`. Recently,
this (synthetically added) parent was absent. This appears to be
due to a bug fix in `companionSymbolOf`, which no longer treats
objects and same-named type aliases to be companions.
This commit manually adds the formerly-synthetic parents to these
objects, and documents the change in compiler behaviour with a test.
Fixes scala/scala-dev#290
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Remove deprecated -Y flags
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
This was slated for removal in 2.12.
|
| | |_|_|/ /
| |/| | | |
| | | | | |
| | | | | | |
This was slated for removal in 2.12.
|
|\ \ \ \ \ \
| |_|_|_|/ /
|/| | | | | |
SI-10069 Fix code gen errors with array updates, Nothing
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Crashes in ASM or VerifyErrors used to occur when assigning
an expression of type Nothing to an element of a primitive array.
This commit adapts the RHS of the assignment to the element
type to correct this. `adapt` contains logic to insert an
`ATHROW` of the slot of type `Nothing$`, which makes everything
line up. The subsequent array stores become dead code and are
dropped later on in code gen, so the test case compiles to:
public void foo0(double[]);
Code:
0: bipush 42
2: istore_2
3: aload_1
4: iconst_0
5: aload_0
6: invokevirtual #30 // Method throwExpected:()Lscala/runtime/Nothing$;
9: athrow
I found a similar bug in the emission of primitive unboxing and
fixed that too.
|
|\ \ \ \ \
| |_|/ / /
|/| | | | |
SI-10075 propagate annotations to lazy val's underlying field
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Based on review suggestion by retronym.
See also scala/scala-dev#213
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This likely regressed in #5294.
Review feedback from retronym:
- Tie annotation triaging a bit closer together
durban kindly provided initial version of test/files/run/t10075.scala
And pointed out you must force `lazy val`, since `null`-valued field
is serializable regardless of its type.
Test test/files/run/t10075b courtesy of retronym
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
SI-7046 reflection doesn't see all knownDirectSubclasses
This appears to do the right thing in the most typical scenarios in which `knownDirectSubclasses` would be used. The missing 5% is that subclasses defined in local scopes might not be seen by `knownDirectSubclasses` (see `Local` and `Riddle` in the test below). In mitigation, though, it is almost certain that a local subclass would represent an error in any scenario where `knownDirectSubclasses` might be used.
Errors for such situations are reported by recording (via a symbol attachment) that `knownDirectSubclasses` has been called and reporting an error if any additional children are added subsequently.
Despite these limitations and caveats, I believe that this represents a huge improvement over the status quo, and would eliminate 100% of the failures that I've seen in practice with people using shapeless for type class derivation.
|
| | | | | | |
|
|\ \ \ \ \ \
| |_|/ / / /
|/| | | | | |
Clean up of code guarded by bare -Xexperimental
|
| |/ / / / |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SD-275 Further harden against refs to absentee classes
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
- Limit the strategy of unpickling an external reference to a
module class to a lookup of the module var to non-stub owners
in order to enable fall through to stub symbol creation.
Fixes scala/scala-dev#275
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
SI-10009 Fields survive untypecheck/retypecheck
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Some places in the compiler, and many places in macros, use
`untypecheck` (aka `resetAttrs`) to strip types and local symbols
from a tree before retypechecking it under some different context.
The refactoring of the desugaring of vals and vars in Scala 2.12.0
broke an assumption in this facility.
When a ValDef must be split into multiple members (e.g. a field and
a getter, or a perhaps also a setter), the ValDef that was parsed
assumes the role of the `field`, and the trees for other members are
stached by `Namer` to the `synthetics` map of the compilation unit,
in order to spliced into the right statement list by typechecking.
See `enterGetterSetter` for more details.
However, the parsed ValDef is now used verbatim, carrying the meaning
(ie, the symbol) of the `private[this]` field. This tree now had
an inconsistency between the flags in `tree.mods.flags` and
`tree.symbol.flags`. `tree.name` also differed from `tree.symbol.name`
(the latter was renamed to be a local name, ie one with a trailing space.)
When `ResetAttrs` stripped off the symbol and we retypechecked, we'd
end up with two symbols in scope with the same name.
In the first from the `run` test:
```
================================================================================
{
class a extends scala.AnyRef {
def <init>(): a = {
a.super.<init>();
()
};
private[this] val x: Int = 42;
<stable> <accessor> def x: Int = a.this.x
};
new a()
}
{
class a extends scala.AnyRef {
def <init>() = {
super.<init>();
()
};
val x = 42; // oops, the name is "x" rather than "x " and we've missing `private[this]`!
<stable> <accessor> def x: Int = a.this.x
};
new a()
}
scala.tools.reflect.ToolBoxError: reflective typecheck has failed: x is already defined as value x
```
This commit uses the flags and name of the symbol in `typedValDef`.
I've also had to modify the internals of `CodePrinter` to use the
implicit, override, and deferred flags from the modifiers of an
accessor when recovering pre-typer tree for a ValDef.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
By marking the wrapper classes as sealed, the inliner will be
able to assume finality of defs introduces in the REPL without
requiring the user to mark them as `final`, which is an odd thing
to do in single line of REPL input.
|
| |/ / /
|/| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The REPL has a long running instance of Global which outputs
classfiles by default to a VirtualDirectory. The inliner did not find
any of these class files when compiling calls to methods defined in
previous runs (ie, previous lines of input.)
This commit:
- Adds a hook to augment the classpath that the optimizer searches,
and uses this in the REPL to add the output directory
- Fixes the implementation of `findClassFile` in VirtualDirectory,
which doesn't seem to have been used in anger before. I've factored out
some common code into a new method on `AbstractFile`.
- Fixes a similar problem getSubDir reported by Li Haoyi
- Adds missing unit test coverage.
This also fixes a bug in REPL autocompletion for types defined
in packages >= 2 level deep (with the `:paste -raw` command).
I've added a test for this case.
|
|\ \ \ \
| | | | |
| | | | | |
SI-10071 Separate compilation for varargs methods
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Make sure that methods annotated with varargs are properly mixed-in. This commit
splits the transformation into an info transformer (that works on all symbols, whether
they come from source or binary) and a tree transformer.
The gist of this is that the symbol-creation part of the code was moved to the UnCurry
info transformer, while tree operations remained in the tree transformer. The newly
created symbol is attached to the original method so that the tree transformer can still
retrieve the symbol.
A few fall outs:
- I removed a local map that was identical to TypeParamsVarargsAttachment
- moved the said attachment to StdAttachments so it’s visible between reflect.internal
and nsc.transform
- a couple more comments in UnCurry to honour the boy-scout rule
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
SI-9814 Fix synchronized in specialized overrides
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Specialization creates a subclasses of a specializd class for each
type parameter combination. These contains copies of the methods from
the superclass.
However, before this transform, the pattern of self-synchronization
in a method body had been replace by flag Flag.SYNCHRONIZED on the
method symbol. This was not being propagated to the override, and
hence no locking occured.
This commit modifies the creation of the specialized overload symbol
to copy the SYNCHRONIZED flag, as was already done for ASBOVERRIDE.
I have also done the same for the `@strictfp` annotation.
|
|\ \ \ \
| |/ / /
|/| | | |
SI-6412 remove flaky test
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
I have repeatedly seen this fail CI runs, including recently
as the comment in the test itself says: "I'm not sure this is a great
way to test for memory leaks, since we're also testing how good
the JVM's GC is, and this is not easily reproduced between
machines/over time"
|
|\ \ \ \
| | | | |
| | | | | |
SI-9944 Scan after interp expr keeps CR
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In an interpolated expression `s"""${ e }"""`, the scanner
advances input past the RBRACE. If a multiline string as
shown, get the next raw char, because CR is significant.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-9915 Fix test on windows
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Use `javac: -encoding UTF-8` tool args comment
so javac uses correct source encoding.
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
SI-10059 reset the `DEFERRED` flag for Java varargs forwarders
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
When an abstract method is annotated `@varargs`, make sure that the
generated synthetic Java varargs method does not have the `DEFERRED`
flag (`ACC_ABSTRACT` in bytecode).
The flag lead to an NPE in the code generator, because the ASM framework
leaves certain fields `null` for abstract methods (`localVariables` in
this case).
Interestingly this did not crash in 2.11.x: the reason is that the test
whether to emit a method body or not has changed in the 2.12 backend
(in c8e6050).
val isAbstractMethod = [..] methSymbol.isDeferred [..] // 2.11
val isAbstractMethod = rhs == EmptyTree // 2.12
So in 2.11, the varargs forwarder method was actually left abstract in
bytecode, leading to an `AbstractMethodError: T.m([I)I` at run-time.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-9915 Utf8_info are modified UTF8
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Use DataInputStream.readUTF to read CONSTANT_Utf8_info.
This fixes reading embedded null char and supplementary chars.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Because no one votes against a progressive test.
|
| | | | | | | |
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
When a return in a finalizer was reached through a return within the try
block, the backend ignored the return in the finalizer:
try {
try { return 1 }
finally { return 2 }
} finally { println() }
This expression should evaluate to 2 (it does in 2.11.8), but in 2.12.0
it the result is 1.
The Scala spec is currently incomplete, it does not say that a finalizer
should be exectuted if a return occurs within a try block, and it does
not specify what happens if also the finally block has a return.
So we follow the Java spec, which basically says: if the finally blocks
completes abruptly for reason S, then the entire try statement completes
abruptly with reason S. An abrupt termination of the try block for a
different reason R is discarded.
Abrupt completion is basically returning or throwing.
|
| |/ / / / /
|/| | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Return statements within `try` or `catch` blocks need special treatement
if there's also a `finally`
try { return 1 } finally { println() }
For the return, the code generator emits a store to a local and a jump
to a "cleanup" version of the finally block. There will be 3 versions
of the finally block:
- One reached through a handler, if the code in the try block
throws; re-throws at the end
- A "cleanup" version reached from returns within the try; reads the
local and returns the value at the end
- One reached for ordinary control flow, if there's no return and no
exception within the try
If there are multiple enclosing finally blocks, a "cleanup" version is
emitted for each of them. The nested ones jump to the enclosing ones,
the outermost one reads the local and returns.
A global variable `shouldEmitCleanup` stores whether cleanup versions
are required for the curren finally blocks. By mistake, this variable
was not reset to `false` when emitting a `try-finally` nested within a
`finally`:
try {
try { return 1 }
finally { println() } // need cleanup version
} finally { // need cleanup version
try { println() }
finally { println() } // no cleanup version needed!
}
In this commit we ensure that the variable is reset when emitting
nested `try-finally` blocks.
|