| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The InnerClass attribute needs to contain an entry for every nested
class that is defined or referenced in a class. Details are in a
doc comment in BTypes.scala.
Instead of collecting ClassBTypes of nested classes into a hash map
during code generation, traverse the class before writing it out to
disk. The previous approach was incorrect as soon as the generated
bytecode was modified by the optimzier (DCE, inlining).
Fixes https://github.com/scala/scala-dev/issues/21.
|
|
|
|
|
|
|
| |
Allow annotating individual callsites @inline / @noinline using an
annotation ascription
c.foo(): @inline
|
|
|
|
|
|
| |
A post-inline request is allowed to refer to a callsite that does not
exist anymore because it was alredy inlined while handling some other
inline request, or because it was DCE'd.
|
|
|
|
| |
Clean up inliner test
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When traversing the call graph and collecting inline reqeusts, rule
out callsites that we already know cannot be inlined.
Note that we cannot perform all necessary checks already at this
stage: checks that depend on the callee body (the inlined code) are
deferred until the callsite is actually inlined. The reason is that
the code may change. Example:
@inline final def f = try 1 catch { case _: Throwable => 2 }
@inline final def g = f
def t = println(g)
When collecting inline requests, the body of g invokes the public
method f, so g could be inlined into t. However, once f is inlined
into g, the body of g contains a try-catch block. Now we cannot inline
g into t anymore, because the call stack at the g callsite is
non-empty (the stack is cleared when entering a handler).
|
| |
|
|\ |
|
| |\
| | |
| | | |
get test suite passing on Windows
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
this was causing a mysterious compilation failure on Windows. (it may
not have been a sufficient cause in itself -- which is why I say
"mysterious" -- but in any case, adding the newline made the failure
go away. and besides, the newline should be there. so here it is.)
(it's tempting to make a big commit that fixes this in every
source file. resisting for now)
|
| | |
| | |
| | |
| | | |
includes comment with full details
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
usually it hardly matters, but it's still a bug, and on Windows we
can't delete an open file, so this can cause trouble for someone
writing a test that relies on being able to generate icode files
and then clean them up afterwards. (and in fact, two
IcodeComparison-based tests were failing.)
|
| | | |
|
| |\ \
| | | |
| | | | |
Improve implicits wildcard imports in the IDE
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In 451cab967a, I changed handling of selection of members from
package objects so as to correctly use `somePackage.package.type`
as the prefix, rather than `somePackage`. This fixed generic
substitution for members inherited from superclasses of the
package object.
However, this has subtly changed the scope from which we collect
implicits given a wildcard import. It seems that the IDE gets into
a situation after a scaladoc lookup, which temporarily typechecks
the sources of a package object of a third party library, in which
the members of package object differ from the members of the enclosing
package.
The upshot of this was spurious type errors due to implicit search
discarding an candidate implicit whose symbol is not matched by
typechecking an identifier with the symbol's name at the implicit
usage site (this is how we discard shadowed implicits.)
I'd like to ge to the bottom of this, but in the meantime, I've found
that we can fix the regression by looking up the implicit member
symbols in the package, even while correctly using the package object
as the prefix.
|
| |/ /
| | |
| | |
| | |
| | | |
Previously _.result() was invoked in the "real" ExecutionContext, but this is an
unnecessary use of the context.
|
| | | |
|
| |\ \
| | | |
| | | | |
SI-9029 Fix regression in extractor patterns
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | | |
It remains from the days of yore, when patterns survived this long
in the compiler.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The unified treatment of classical and named-based pattern matching
does not correctly handle the generalization of "tuple capture".
By "tuple capture", I mean:
```
scala> object Extractor { def unapply(a: Any): Option[(Int, String)] = Some((1, "2")) }
defined object Extractor
scala> "" match { case Extractor(x: Int, y: String) => }
scala> "" match { case Extractor(xy : (Int, String)) => }
warning: there was one deprecation warning; re-run with -deprecation for details
scala> :warnings
<console>:9: warning: object Extractor expects 2 patterns to hold (Int, String) but crushing into 2-tuple to fit single pattern (SI-6675)
"" match { case Extractor(xy : (Int, String)) => }
^
```
Name based pattern matching, new in Scala 2.11, allows one to
deconstruct the elements that structurally resembles `ProductN`:
```
scala> class P2(val _1: Int, val _2: String)
defined class P2
scala> object Extractor { def unapply(a: Any): Option[P2] = Some(new P2(1, "2")) }
defined object Extractor
scala> "" match { case Extractor(x: Int, y: String) => }
```
However, attempting to extract the `P2` in its entirety leads to
an internal error:
```
scala> "" match { case Extractor(p2: P2) => }
<console>:10: warning: fruitless type test: a value of type (Int, String) cannot also be a P2
"" match { case Extractor(p2: P2) => }
^
<console>:10: error: error during expansion of this match (this is a scalac bug).
The underlying error was: type mismatch;
found : P2
required: (Int, String)
"" match { case Extractor(p2: P2) => }
^
```
Note that this match was legal and warning free in 2.10.
This commit avoids the hard-coded assumption that the "tuple capture"
results in a `TupleN`, and instead keeps track of the product-ish
type from which we extracted the element types. I have also opted not
to limit the deprecation warning to `TupleN` extractors.
|
| |\ \ \
| | | | |
| | | | | |
add support for MSys2 to bin/scala shell script
|
| | | | | |
|
| | | | | |
|
| |\ \ \ \
| | |_|_|/
| |/| | | |
fix indentation
|
| | | | |
| | | | |
| | | | |
| | | | | |
this sneaked into 2d025fe2d0c9cd0e01e390055b0531166988f901
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
A trio of problems were hampering autocompletion of annotations.
First, given that that annotation is written before the annotated
member, it is very common to end parse incomplete code that has a
floating annotation without an anotatee.
The parser was discarding the annotations (ie, the modifiers) and
emitting an `EmptyTree`.
Second, the presetation compiler was only looking for annotations
in the Modifiers of a member def, but after typechecking annotations
are moved into the symbol.
Third, if an annotation failed to typecheck, it was being discarded
in place of `ErroneousAnnotation`.
This commit:
- modifies the parser to uses a dummy class- or type-def tree,
instead of EmptyTree, which can carry the annotations.
- updates the locator to look in the symbol annotations of the
modifiers contains no annotations.
- uses a separate instance of `ErroneousAnnotation` for each
erroneous annotation, and stores the original tree in its
`original` tree.
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In the code:
```
s"${fooo<CURSOR"
```
The parser treats `fooo` as a interpolator ID for the quote that
we actually intend to end the interpolated string.
Inserting a space (in addition to `__CURSOR__` that we already
patch in to avoid parsing a partial identifier as a keyword),
solves this problem.
|
| |\ \ \
| | | | |
| | | | | |
[backport] SI-9375 add synthetic readResolve only for static modules
|
| | | |/
| | |/|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
For inner modules, the synthetic readResolve method would cause the
module constructor to be invoked on de-serialization in certain
situations. See the discussion in the ticket.
Adds a comprehensive test around serializing and de-serializing
modules.
|
|\ \ \ \
| | | | |
| | | | | |
Make AnyRefMap serializable
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Fixing signatures of universal methods on `Any` and `AnyRef`.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Methods `getClass`, `isInstanceOf`, `asInstanceOf`, `notify`, `notifyAll`, and `wait` should be final.
Method `getClass` should exist only on Any.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
I found another spot where I had previously needed to manually
invalidate a TypeRef cache, and modified that to route through
the newly added `invalidatedCaches`.
`invalidatedCaches` now invalidates all the other caches I could
find in our types of types. I opted for a non-OO approach here,
as we've got a fairly intricate lattice of traits in place that
define caches, and I didn't have the stomach for adding a polymorphic
`Type::invalidatedCaches` with the the right sprinkling over overrides
and super calls.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Typechecking a pattern that defines a pattern type variable
initially assigns abstract type symbol with open type bounds.
Later on, pattern type inference kicks in to sharpen the type
of the variable based on constraints imposed by the expected
type (ie, the type of scrutinee of the pattern.)
However, before inference does this, a `TypeRef` to the abstract
type symbol can be queried for its base type with respect to some
class, which leads to it populating an internal cache. This cache
becomes stale when the underlying symbol has its type mutated.
The repercussions of this meant that a subsequent call to `baseType`
gave the wrong result (`NoType`), which lead to an `asSeenFrom`
operation to miss out of substitution of a type variable. Note the
appearance of `A` in the old type errors in the enclosed test case.
This commit takes an approach similar to 286dafbd to invalidate
caches after the mutation. I've routed both bandaids through the
same first aid kit: I'm sure over time we'll add additional calls
to this method, and additional cache invalidations within it.
|
|\ \ \ \ \ \
| |_|/ / / /
|/| | | | | |
Remove the old REPL tab completion implementation
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
We kept it around behind an option in 2.11.x, but we can
jettison it in 2.12.x.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SD-33 Consider methods annotated @CallerSensitive not safe to inline
|
| |/ / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Fixes https://github.com/scala/scala-dev/issues/33
Methods annotated `sun.reflect.CallerSensitive` should not be inlined,
their implementation may depend on the call stack.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Fixes https://github.com/scala/scala-dev/issues/39
When inlining an indyLambda closure instantiation into a class, and
the closure type is serializable, make sure that the target class has
the synthetic `$deserializeLambda$` method.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This allows accessing the method from the inliner, which doesn't have
access to the Global instance.
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | | |
Until now, there was no good place to hold various utility functions
that are used acrosss the backend / optimizer.
|
|\ \ \ \ \
| | |/ / /
| |/| | | |
|
| |\ \ \ \
| | | | | |
| | | | | | |
Topic/completely 2.11
|
| | | | | | |
|
| | |\ \ \ \ |
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Before:
```
scala> {" ".char<TAB>}
charAt chars
scala> {" ".char<CURSOR>}}
```
I noticed that pressing <SPACE>-<BACKSPACE> re-rendered the line
correctly, so I've added this workaround to our customization of
the JLine console reader.
After:
```
scala> {" ".char<TAB>}
charAt chars
scala> {" ".char<CURSOR>}
```
We can delete this workaround when JLine 2.13.1 is released, but
I haven't heard back about when this might happen.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Recover part of the identifier that preceded the cursor from the
source, rather than from the name in the `Select` node, which might
contains an encoded name that differs in length from the one in
source.
|