| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Synthetic defs introduced by transforms like named/default arguments,
ANF (in scala-async) often introduce a type tree (the tpt of the temporary)
that are based on the types of expressions. These types are scrutinized in
RefChecks to check that type parameter bounds are satisfied.
However, the type of the expression might be based on slack a LUB that
fails to capture constraints between type parameters.
This slackness is noted in `mergePrefixAndArgs`:
// Martin: I removed this, because incomplete. Not sure there is a
// good way to fix it. For the moment we just err on the conservative
// side, i.e. with a bound that is too high.
The synthesizer can now opt out of bounds by annotating the type as follows:
val temp: (<expr.tpe> @uncheckedBounds) = expr
This facility is now used in named/default arguments for the temporaries
used for the reciever and arguments.
The annotation is hidden under scala.reflect.internal, rather than in
the more prominent scala.annotation.unchecked, to reflect the intention
that it should only be used in tree transformers.
The library component of this change and test case will be included in the
next commit. Why split like this? It shows that the 2.10.3 compiler will
work with 2.10.2 scala-reflect.jar.
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously PackageScopes from scala.reflect ignored all classes that
had $'s in non-rightmost positions in their names.
Unfortunately this behaviour is inconsistent with how scalac does things,
and I reconciled this as usual, by pulling corresponding logic into
scala-reflect.jar and sharing it between runtime reflection and compiler.
This change has seprate pull requests for 2.10.x and 2.11.0. The latter
deprecates `scala.tools.nsc.util.ClassPath.isTraitImplementation`
whereas the former (which you're looking at right now) does not, because
we can't deprecated members in minor releases.
|
| |
| |
| |
| |
| |
| |
| | |
Apparently there are still discrepancies between how the vanilla compiler
turns class files into symbols and how the reflective compiler does it.
Working on bringing these guys in sync, one bug at a time.
|
| |\
| | |
| | | |
SI-7336 Link flatMapped promises to avoid memory leaks
|
| | | |
|
| |/ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`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
|
| |
| |
| |
| |
| |
| |
| |
| | |
Optimizations:
1) Avoiding to call 'synchronized' in tryComplete and in tryAwait
2) Implementing blocking by using an optimized latch so no blocking ops for non-blockers
3) Reducing method size of isCompleted to be cheaper to inline
4) 'result' to use Try.get instead of patmat
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Updates ForkJoinPool and dependent classes to the latest jsr166y revisions:
ForkJoinPool.java:
Revision 1.185
Sat Feb 16 20:50:29 2013 UTC (2 months, 2 weeks ago) by jsr166
ForkJoinTask.java:
Revision 1.100
Tue Feb 5 17:09:54 2013 UTC (3 months ago) by jsr166
ForkJoinWorkerThread.java:
Revision 1.73
Wed Nov 21 19:54:39 2012 UTC (5 months, 2 weeks ago) by dl
- Includes Akka-contributed `sun.misc.Unsafe` detection to support Android.
See changeset 06d685c1bbd8a0d058ee8a3f374569f8097f2acc
- Adds private `CountedCompleter` class.
This class is only visible and used in `ForkJoinPool.java`.
- Updates desired.sha1 for updated forkjoin.jar.
- Updates binary compatibility whitelists to exclude package-private methods
in the `forkjoin` package.
- Also fixes SI-7438.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In classfile parser: mark symbols which represent interface
methods yet have code attributes with new flag DEFAULTMETHOD.
These must be kept distinct from regular method bodies so that
an error can be issued when a regular concrete method is
overridden without the override keyword, but not when the
overridden method is a default.
In java source parser: mark Modifiers of interface default
methods with DEFAULTMETHOD flag.
Writing the test was everything I dreamed, and more! However,
% test/partest --debug test/files/run/t7398.scala
Skipping java8-specific test under java version 1.7.0_21
testing: [...]/files/run/t7398.scala [ OK ]
All of 1 tests were successful (elapsed time: 00:00:04)
% test/partest --debug test/files/run/t7398.scala
Attempting java8-specific test under java version 1.8.0-ea
testing: [...]/files/run/t7398.scala [ OK ]
All of 1 tests were successful (elapsed time: 00:00:13)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In 692372ce, we added a warning (under -Xlint) when binding
a `TupleN` in to a single pattern binder, which wasn't allowed
before 2.10.0, and more often than not represents a bug.
However, that warning overstretched, and warned even when
using a Tuple Pattern to bind to the elements of such a value.
This commit checks for this case, and avoids the spurious warnings.
A new test case is added for this case to go with the existing
test for SI-6675:
$ ./tools/partest-ack 6675
% tests-with-matching-paths ... 3
% tests-with-matching-code ... 2
# 3 tests to run.
test/partest --show-diff --show-log \
test/files/neg/t6675-old-patmat.scala \
test/files/neg/t6675.scala \
test/files/pos/t6675.scala \
""
Testing individual files
testing: [...]/files/pos/t6675.scala [ OK ]
Testing individual files
testing: [...]/files/neg/t6675-old-patmat.scala [ OK ]
testing: [...]/files/neg/t6675.scala [ OK ]
All of 3 tests were successful (elapsed time: 00:00:03)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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 _ =>
}
|
| |
| |
| |
| |
| |
| |
| | |
For imminent reuse in the subsequent commit.
The binary compatibility whitelist is updated to
ignore these, as they live in reflect.internal.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 54a84a36d5b435a787d93ca48d45399136c7e162.
This is necessary to maintain binary compatibility with 2.10.0.
run/t6989.check had to be updated as it also (indirectly) tested SI-6548
Conflicts:
test/files/lib/javac-artifacts.jar.desired.sha1
test/files/run/t6548.check
test/files/run/t6548/Test_2.scala
|
| |
| |
| |
| |
| |
| | |
This reworks 02ed5fb so that we don't change JavaUniverse's super classes.
This is necessary to maintain binary compatibility with 2.10.0.
|
| |
| |
| |
| |
| |
| | |
This reverts commit 0429f0fd9224499cd8b606490d04b1a8dcffbca8.
This is necessary to maintain binary compatibility with 2.10.0.
|
| |
| |
| |
| |
| |
| | |
Inlined AdaptedForkJoinTask, made uncaughtExceptionHandler private[this].
This is necessary to maintain binary compatibility with 2.10.0.
|
| |
| |
| |
| | |
This is necessary to maintain binary compatibility with 2.10.0.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Reworks d526f8bd74.
This is necessary to maintain binary compatibility with 2.10.0.
matchName="scala.collection.mutable.MutableList.tailImpl"
problemName=MissingMethodProblem
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Also revert "SI-4664 [Make scala.util.Random Serializable] Add test case"
This reverts commit 0b92073a38f9d1823f051ac18173078bfcfafc8a.
This reverts commit 2aa66bec86fd464712b0d15251cc400ff9d52821.
This is necessary to maintain binary compatibility with 2.10.0.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit a557a973608a75c7a02f251bbcf49fe6f6b6655e.
This is necessary to maintain binary compatibility with 2.10.0.
Mima says:
matchName="scala.collection.immutable.Range.head"
problemName=IncompatibleResultTypeProblem
The bridge method appeared because result is now Int, whereas
the super-method's result type erases to Object
|
|
|
|
|
|
|
|
|
|
| |
Using @gkossakowski's contribution to mima (in 0.1.5-SNAPSHOT),
make sure bc.run doesn't fail by filtering out all binary incompatibilities.
Each subsequent commit will comment out the filters it makes irrelevant,
until we only need to filter out permitted binary incompatibilities.
We only allow binary incompatibilities in scala.reflect.internal.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to the fact that all TypTrees are transformed into TypeTrees
during typechecking one couldn't treat typed type trees in the same
way as they treat untyped type trees.
This change implements support for pattern matching of TypeTrees as their
corresponding TypTree equivalent using tree preserved in the original.
The implementation itself is a trivial wrapping of regular TypTree
extractors into MaybeTypeTreeOriginal.
|
|
|
|
|
|
|
|
|
| |
I just realized that our tag-based shortcuts were incomplete, because
they only work with root mirrors (doing just u.typeTag[T].tpe means that
the type is going to be resolved in u.rootMirror because that's the default).
This commit fixes this oversight. I'm hoping for 2.11.0-RC3, but also feel
free to reschedule to 2.12.0-M1 if it becomes clear that RC3 isn't happening.
|
|\
| |
| | |
SI-8200 provide an identity liftable for trees
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This liftable hasn't been originally included in the set of standard
liftables due to following contradiction:
1. On one hand we can have identity lifting that seems to be quite
consistent with regular unquoting:
q"..${List(1,2)}" <==> q"1; 2"
q"${List(1,2)}" <==> q"s.c.i.List(1, 2)"
q"..${List(q"a", q"b")}” <==> q"a; b"
q"${List(q"a", q"b")}" <==> q"s.c.i.List(a, b)"
This is also consistent with how lisp unquoting works although they
get lifting for free thanks to homoiconicity:
// scala
scala> val x = List(q"a", q"b); q"f($x)"
q"f(s.c.i.List(a, b))"
// scheme
> (let [(x (list a b))] `(f ,x))
'(f (list a b))
2. On the other hand lifting is an operation that converts a value into
a code that when evaluated turns into the same value. In this sense
Liftable[Tree] means reification of a tree into a tree that
represents it, i.e.:
q"${List(q"a", q"b")}"
<==>
q"""s.c.i.List(Ident(TermName("a")), Ident(TermName("b")))"""
But I belive that such lifting will be very confusing for everyone
other than a few very advanced users.
This commit introduces the first option as a default Liftable for trees.
|
|/
|
|
|
| |
Make the head iterator a constructor parameter, for easier
construction and implementation of ++.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously one could match a partial function with match quasiquote:
scala> val q"$scrutinee match { case ..$cases }" = q"{ case Foo => Bar
}"
scrutinee: universe.Tree = <empty>
cases: List[universe.CaseDef] = List(case Foo => Bar)
This was quite annoying as it leaked encoding of partial functions as
Match trees with empty tree in place of scrutinee.
This commit make sure that matches and partial functions are disjoint
and don't match one another (while preserving original encoding under
the hood out of sight of the end user.)
|
|
|
|
|
|
| |
Due to tree re-use it used to be the fact that type quasiquotes could
match term trees. This commit makes sure selections and applied type and
type applied are all non-overlapping between q and tq.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The b8a76f688c6ce2a4c305da064303bb46b53be875 introduced ArrayOps.{unzip,
unzip3} methods. Both of those methods have ClassTags as context bounds on
their type parameters so they can create (and return) instances of Arrays.
The type inference for those methods is supposed to be guided by
implicit evidence that T <: (T1, T2) (or T <: (T1, T2, T3) in unzip3 case).
However, context bounds are desugared into implicit parameters that
prepended in front of implicit parameters declared in source code. That
means the implicit evidence won't have a chance to guide type inference
because it comes as last implicit parameter.
This commit desugars context bounds and puts them at the end of implicit
parameter list. This way type inference is guided properly and we get
expected compiler errors for missing class tags.
The change to parameters order breaks binary compatibility with respect
to 2.11.0-RC1. I added filters to our binary compatibility configuration
files. We can get rid of them as soon as 2.11.0 is out.
|
|
Changes in the package scala.reflect.internals are ignored.
|