| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
As soon as you have a directory called "language" lying around,
you will appreciate why the advice given regarding SIP-18
should be "import scala.language..." not "import language..."
|
|\
| |
| | |
SI-6286 IllegalArgumentException handling specialized method.
|
| |
| |
| |
| |
| |
| | |
Specialize assigns SpecialOverride info to a specialized method
even when there is a further specialization that should be forwarded
to.
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
When supplementing a fatal error message with context (current
compilation unit, tree, phase, etcetera), we must be cautious to
not to trigger another error which will obscure the original one.
Currently, `supplementErrorMessage` does its working a try catch
that only catches `Exception`. But this fails to catch
CyclicReferenceError (<: TypeError <: Throwable), as was seen
in a recent mailing list post by Greg Meredith.
This commit extends the catch clause.
|
|\
| |
| | |
Revert "SI-6387 Clones accessor before name expansion"
|
| |
| |
| |
| |
| |
| | |
This reverts commit 4e10b2c833fa846c68b81e94a08d867e7de656aa.
Add 6387 test to pending and 7341 to up-to-date.
|
|\ \
| | |
| | | |
SI-6386 typed existential type tree's original now have tpe set
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Tree reification fails for ExistentialTypeTree. The reason is that the
tree passed for reification (see reifyTree at GetTrees.scala) must have
not null tpe (see reifyBoundType at GenTrees.scala), which is not true
in the case of ExistentialTypeTree.
Why is it so? The tree passed to reifyTree was obtained in the reshape
phase of reificationusing using original TypeTrees that reporesent pre-
typer representation of a type. The problem is that original's tpe for
ExistentialTypeTree is not set.
So the solution to the issue is to create ExistentialTypeTree's original
in a such way that is has actual tpe set.
|
|\ \
| | |
| | | |
SI-7289 Less strict type application for TypeVar.
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When a type constructor variable is applied to the wrong number of arguments,
return a new type variable whose instance is `ErrorType`.
Dissection of the reported test case by @retronym:
Define the first implicit:
scala> trait Schtroumpf[T]
defined trait Schtroumpf
scala> implicit def schtroumpf[T, U <: Coll[T], Coll[X] <: Traversable[X]]
| (implicit minorSchtroumpf: Schtroumpf[T]): Schtroumpf[U] = ???
schtroumpf: [T, U <: Coll[T], Coll[X] <: Traversable[X]](implicit minorSchtroumpf: Schtroumpf[T])Schtroumpf[U]
Call it explicitly => kind error during type inference reported.
scala> schtroumpf(null): Schtroumpf[Int]
<console>:10: error: inferred kinds of the type arguments (Nothing,Int,Int) do not conform to the expected kinds of the type parameters (type T,type U,type Coll).
Int's type parameters do not match type Coll's expected parameters:
class Int has no type parameters, but type Coll has one
schtroumpf(null): Schtroumpf[Int]
^
<console>:10: error: type mismatch;
found : Schtroumpf[U]
required: Schtroumpf[Int]
schtroumpf(null): Schtroumpf[Int]
^
Add another implicit, and let implicit search weigh them up.
scala> implicitly[Schtroumpf[Int]]
<console>:10: error: diverging implicit expansion for type Schtroumpf[Int]
starting with method schtroumpf
implicitly[Schtroumpf[Int]]
^
scala> implicit val qoo = new Schtroumpf[Int]{}
qoo: Schtroumpf[Int] = $anon$1@c1b9b03
scala> implicitly[Schtroumpf[Int]]
<crash>
Implicit search compares the two in-scope implicits in `isStrictlyMoreSpecific`,
which constructs an existential type:
type ET = Schtroumpf[U] forSome { type T; type U <: Coll[T]; type Coll[_] <: Traversable[_] }
A subsequent subtype check `ET <:< Schtroumpf[Int]` gets to `withTypeVars`, which
replaces the quantified types with type variables, checks conformance of that
substitued underlying type against `Schtroumpf[Int]`, and then tries to solve
the collected type constraints. The type var trace looks like:
[ create] ?T ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ create] ?U ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ create] ?Coll ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ setInst] Nothing ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], T=Nothing )
[ setInst] scala.collection.immutable.Nil.type( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], U=scala.collection.immutable.Nil.type )
[ setInst] =?scala.collection.immutable.Nil.type( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], Coll==?scala.collection.immutable.Nil.type )
[ create] ?T ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ setInst] Int ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], T=Int )
[ create] ?T ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ create] ?U ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ create] ?Coll ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ setInst] Nothing ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], T=Nothing )
[ setInst] Int ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], U=Int )
[ setInst] =?Int ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], Coll==?Int )
The problematic part is when `?Int` (the type var originated from `U`) is registered
as a lower bound for `Coll`. That happens in `solveOne`:
for (tparam2 <- tparams)
tparam2.info.bounds.hi.dealias match {
case TypeRef(_, `tparam`, _) =>
log(s"$tvar addLoBound $tparam2.tpeHK.instantiateTypeParams($tparams, $tvars)")
tvar addLoBound tparam2.tpeHK.instantiateTypeParams(tparams, tvars)
case _ =>
}
|
|\ \
| |/
|/| |
SI-6937 core type tags are no longer referentially unique
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Type tag factory used to evaluate the provided type creator in the
context of the initial mirror in order to maintain referential equality
of instances of standard tags. Unfortunately this evaluation might fail
if the mirror provided doesn't contain the classes being referred to.
Therefore I think we should avoid evaluating type creators there.
Note that failure of evaluation doesn't mean that there's something
bad going on. When one creates a type tag, the correct mirror /
classloader to interpret that tag in might be unknown (like it happens
here). This is okay, and this is exactly what the 2.10.0-M4 refactoring
has addressed.
Something like `res2.typeTag[A].in(currentMirror)` should be okay.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Currently the map is declared LinkedHashMap, which doesn't align with
other caching maps that are cleared on every run. Linkedness is only
needed to ensure deterministic order on the generated specialized
classes. The same can be accomplished by sorting generated classes
a-posteriori.
|
|\ \
| | |
| | | |
SI-6900 Tail call elimination + dependent method type crasher
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Uncurry's info transformer could generate a MethodType
with cloned parameter symbols. This type was used
for the LabelDef generated in the TailCalls phase.
But, the RHS of the method still contains types that
refer to the original parmameter symbol. Spurious
type errors ensued.
I've spent a good chunk of time pursuing a more
principled fix, in which we keep the symbols in the
tree in sync with those in the MethodType. You can
relive the procession of false dawns:
https://github.com/scala/scala/pull/2248
Ultimately that scheme was derailed by a mismatch
between the type parameter `T` and the skolem `T&`
in the example below.
trait Endo[A] { def apply(a: => A): A }
class Test {
def foo[T] =
new Endo[(T, Unit)] {
def apply(v1: => (T, Unit)) = v1 // no bridge created
}
}
Interestingly, by removing the caching in SingleType,
I got past that problem. But I didn't characterize it
further.
This commit sets asides the noble goal of operating in
the world of types, and sledgehammers past the crash by
casting the arguments to and the result of the label jump
generated in TailCalls.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Now, the InfoTransformer is responsible for erasing the
path dependent types of formal parameters, at the same
place where it flattens nested method types.
This is preferable to having the tree transformer overwrite
the result of the info transformer, as used to be the case
after my previous work on SI-6135 / 493197fc.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
For imminent reuse in the subsequent commit.
The binary compatibility whitelist is updated to
ignore these, as they live in reflect.internal.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The code responsible for this performance bug lives on somewhere
in the combination of Iterator.single and Iterator.++ and is
tracked by SI-7316. What this commit does is bypass the creation
and composition of iterators entirely in favor of applying foreach
to walking the tree.
The important lesson of a bug like this: the occurrence depends on
the existence of multiple implementations of basic structures like
Trees. For each redundant implementation, scrutiny and testing
are divided and "bug diversity" is increased. We should labor
hard to structure collections in such a way that people have no
good reason not to take advantage of the basic and hopefully
battle-tested logic - especially when those people are us.
I hope to remove util.TreeSet entirely. Until then, here is the
impact of this commit on the time to compile a piece of generated
test code.
% time scalac3 ./target/generated/src.scala
Mar 28 13:20:31 [running phase parser on src.scala]
...
Mar 28 13:21:28 [running phase lazyvals on src.scala]
Mar 28 13:21:28 [running phase lambdalift on src.scala] <-- WHOA
Mar 28 13:25:05 [running phase constructors on src.scala]
...
Mar 28 13:25:19 [running phase jvm on icode]
316.387 real, 438.182 user, 8.163 sys
To this:
97.927 real, 211.015 user, 8.043 sys
% time pscalac ./target/generated/src.scala
Mar 28 13:18:47 [running phase parser on src.scala]
...
Mar 28 13:19:44 [running phase lazyvals on src.scala]
Mar 28 13:19:44 [running phase lambdalift on src.scala]
Mar 28 13:19:46 [running phase constructors on src.scala]
...
Mar 28 13:19:57 [running phase jvm on icode]
99.909 real, 223.605 user, 7.847 sys
That's lambdalift dropping from 217 seconds to 2 seconds.
|
|\ \ \
| |/ /
|/| | |
SI-7147 Diagnostic for unexplained assertion in presentation compiler.
|
| | |
| | |
| | |
| | |
| | | |
We don't have a reproducible test for this, so the best we can
do is beef up the assertion to shine a little light on the problem.
|
|\ \ \
| | | |
| | | | |
SI-6793 Don't use super param accessors if inaccessible.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
"Alias replacement" has been with us since 2005 (13c59adf9).
Given:
package a {
class C1(val v0: String)
class C2(v1: String) extends a.C1(v1) { v1 }
}
The reference to `v1` is rewritten as `C2.super.v0()`, and
no field is generated in `C2`.
(Oddly, this optimization doesn't seem to kick in if
these classes are in the empty package. That's probably
a distinct bug.)
However, this rewriting is done without consideration of
the accessibility of `v0` from `C2`.
This commit disables this optimization if there if `v0` is
not accessible.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Because this implementation is more clear than 2.10.x's and it will
simplify a further commit to fix SI-6715.
|
|\ \ \ \
| |_|/ /
|/| | | |
Correct sorting example for Ordering in scaladoc
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Below code snippet,
Sorting.quickSort(pairs)(Ordering.by[(String, Int, Int), Int](_._2)
should be
Sorting.quickSort(pairs)(Ordering.by[(String, Int, Int), Int](_._2))
|
|\ \ \
| | | |
| | | | |
Scaladoc: Load scripts at the bottom, and with a defer attribute
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
To improve latency on modern browsers (which supports defer) and old browsers:
* https://www.webkit.org/blog/1395/running-scripts-in-webkit/
* http://developer.yahoo.com/blogs/ydn/posts/2007/07/high_performanc_5/
|
| | | | |
|
| |_|/
|/| |
| | |
| | |
| | |
| | |
| | |
| | | |
We now use the unified diff format, hence the updated check files.
It's not clear to me how partest's classpath is managed,
but the approach in this commit works for the ant task and script invocation.
The diffutils jar is injected in the parent classloader.
|
|\ \ \
| | | |
| | | | |
SI-7285 Fix match analysis with nested objects
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The fix for SI-6146 introduced `nestedMemberType` to
enumerate sealed subtypes based on the (prefixed) type
of the scrutinee and the symbols of its sealed subclasses.
That method needed to widen `ThisType(modSym)`s to
`ModuleTypeRef(modSym)` before calling `asSeenFrom`.
However, this could lead to confused in the match analysis,
which sees `ModuleTypeRef` as distinct from singleton types
on the same modules (after all, they aren't =:=). Spurious
warnings ensued.
This commit makes two changes:
- conditionally re-narrow the result of `asSeenFrom` in `nestedMemberType`.
- present `a.b.SomeModule.type` as `SomeModule` in warnings emitted
by the pattern matcher.
|
|\ \ \ \
| | | | |
| | | | | |
SI-7290 Discard duplicates in switchable alternative patterns.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
- make a def a val, we only need to compute it once
- add a clarifying comment
- only report the first duplicate
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The pattern matcher must not allow duplicates to hit the
backend when generating switches. It already eliminates then
if they appear on different cases (with an unreachability warning.)
This commit does the same for duplicated literal patterns in an
alternative pattern: discard and warn.
|
|\ \ \ \
| |_|/ /
|/| | | |
SI-6387 Clones accessor before name expansion
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When a symbol's name is expanded due to a conflict during
composition (e.g. multiple traits with same-named members, but
which are not both visible at the language level in the concrete
class) the compiler renames some symbols with expanded names which
embed the full name of the declaring class to avoid clashes.
In the rare cases when the accessor overrides the member in base
class, such expansion either results in AbstractMethodError when
the base method is abstract, or, even worse, can change the
semantics of the program.
To avoid such issues, we clone the accessor symbol, clear its
ACCESSOR flag and enter the symbol with an unchanged name.
|
|\ \ \ \
| | | | |
| | | | | |
[backport] SI-7237 Always choose ForkJoinTaskSupport
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
... on Java 6 and above.
ForkJoinTaskSupport works on Hotspot, Avian and J9,
while ThreadPoolTaskSupport causes the test
test/files/scalacheck/parallel-collections
to reliably hang on all three.
We keep ThreadPoolTaskSupport around to keep the hope
alive that we still have a glimpse of 1.5 support.
|
|\ \ \ \
| | | | |
| | | | | |
SI-7246 Make $outer pointer elision Java aware
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In e0853b3, a space-saving optimization elided the outer pointer
of inner classes if the the (protected) outer pointer of the
immediate parent class was guaranteed to point to the same instance.
But, this check failed to account for Java parent classes, which
don't follow the Scala scheme. This commit disables the optimization
in that case.
The original test case in e0853b3 was anemic, I've fleshed it out to:
- test the presense or absense of $outer pointers with Java reflection
- test the optimization works in the presense of aliased and annotated
aliased types. (The former worked already, the latter required a
change to the implementation.)
- Test the negative case when the prefixes don't line up and the
subclass in fact needs its own $outer.
This patch is based on work by Euguene Vigdorchik with some
additions by Jason Zaugg.
|
|\ \ \ \
| | | | |
| | | | | |
SI-7299 Improve error message for eta-expanding 23+ param method
|
| | |_|/
| |/| |
| | | |
| | | | |
Before, we got `error: missing arguments for method f`.
|
|\ \ \ \
| | | | |
| | | | | |
Read version 51 (JDK 7) class files.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Based on the review of https://github.com/scala/scala/pull/2257, this
commit adds a debuglog when an invokedynamic instruction is found
during class file parsing as a reminder that the implementation is
just a place holder.
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This commit makes the ClassFileReader/ICodeReader parse class files
from JDK 7 (class file version 51). It does that by skipping over
the method handle related entries in the constant pool and by doing
some dummy processing on invoke dynamic instructions. The inliner
is updated to not try to inline a method with an invoke dynamic
instruction. A place holder INVOKE_DYNAMIC instruction is added to ICode
but it is designed to create an error if there's ever any attempt to
analyze it. Because the inliner is the only phase that ever tries
to analyze ICode instructions not generated from Scala source and
because Scala source will never emit an INVOKE_DYNAMIC, the place
holder INVOKE_DYNAMIC should never cause any errors.
A test is included that generates a class file with INVOKE_DYNAMIC
and then compiles Scala code that depends on it.
|
| |/ /
|/| |
| | |
| | |
| | |
| | |
| | | |
Because it will generate a useless element like "</img>".
To made matters worse, Scaladoc used to generate the element with
attributes (like </img src="...">). That's why we had SI-6580.
|
|\ \ \
| | | |
| | | | |
Build cleanup 2.10
|
| |\ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
Conflicts:
build.xml
|