| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
SI-7872 Plug a variance exploit in refinement types
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Refinement types are collapsed to a TypeTree with an original
during type checking; this was enough to evade variance validation
in refchecks.
This commit:
- validates the original of `TypeTree`s in refchecks
- changes VarianceValidator to recurse into:
- the originals of `TypeTree`s
- `TypTree` (to cover, e.g. `CompoundTypeTree` / `SelectFromTypeTree`)
It also finds an unreported variance violation in an existing
test case, variances.scala. This looks to be legitimate.
|
|\ \
| | |
| | | |
SI-8001 spurious "pure expression does nothing" warning
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`isPureExprForWarningPurposes` doesn’t warn on `()`, but `(): Unit`
leaves it confused. This patch fixes the problem.
The fix is important in the context of the recent split between blackbox
and whitebox macros. Macro engines wrap expansions of blackbox macros
in type ascriptions, so a macro that expands into `()` would actually
produce `(): Unit`, which would trigger a spurious warning. Thanks
@milessabin for spotting this problem!
|
|\ \ \
| | | |
| | | | |
SI-7967 Account for type aliases in self-type checks
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
These eluded the check for "illegal inheritance; self-type does not
conform" as AliasTypeRef doesn't forward `typeOfThis`.
This commit dealiases before calling `typeOfThis`. That seems to be
the most localised change.
Without the dealias, we had:
parent.tpe = TypeRef(pre, sym = AliasTypeSymbol("CC"), Nil)
parent.tpe.typeOfThis = parent.tpe.transform(sym.typeOfThis) = CC
After:
parent.tpe.dealias = TypeRef(pre, sym = ClassSymbol("C"), Nil)
parent.tpe.dealias.typeOfThis = C with B
|
|\ \ \ \
| | | | |
| | | | | |
Unifying -Ydelambdafy:{inline, method}
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Avoids calling `thisType` on the owner if it is a term symbol,
which doesn't make much sense.
This method is used internally in tree factory methods that
create, e.g, a `DefDef` based on the info of a `Symbol`.
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Previously, new synthetic parameter symbols were created for the
apply method parameters, but only used in its `MethodType`. The
`ValDef` trees of the function, along with their symbols, were
used directly as the parameter trees of the apply method.
% cat sandbox/test.scala
object Test {
(x: Int) => {
(y: Int) => ???
}
}
% scalac-hash v2.10.3 -Xprint:typer,uncurry -uniqid ../scala2/sandbox/test.scala | egrep 'syntax|\bx'
[info] v2.10.3 => /Users/jason/usr/scala-v2.10.3-0-g88b5d19
[[syntax trees at end of typer]] // test.scala
((x#12152: Int#351) => x#12152)#12151
[[syntax trees at end of uncurry]] // test.scala
final def apply#15952(x#12152: Int#351): Int#351 = x#12152
This approach dates back a long way: c64152bc3. @odersky tells me it
was most likely due to insufficent substitution/cloning machinery
at the time.
% qbin/scalac -Xprint:typer,uncurry -uniqid ../scala2/sandbox/test.scala | egrep 'syntax|\bx'
[[syntax trees at end of typer]] // test.scala
((x#13685: Int#1760) => x#13685)#13671
[[syntax trees at end of uncurry]] // test.scala
final def apply#13959(x#13960: Int#1760): Int#1760 = x#13960
To make this work, I had to fix a problem in symbol substition; this
was commited in the previous commit. In the enclosed test, at Uncurry,
the symbol of the nested class `N` had a `ClassInfoType`, which listed
as a parent `M[a.C]`. When we substituted the new method parameter
symbol `a` for the eponymous function parameter symbol, this was not
touched.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
An upcoming change to uncurry, in which I plan to make substitution of
`lambda params -> apply method params` requires that I first to fix a
problem in symbol substition.
This situation can arise when the body of this definition:
def owner1(a: A) = {
class C extends M[a.B]
}
is transplanted into a new owner that has a different symbol for `a`.
I speculated that value classes might also be prone to the
fact that symbol substitution neglected `ClassInfoType#parents`.
We can test change with Value Classes: Partial Functions that are
dependent on value class param type used to fail with a spurious
overriding error, now they work correctly.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
- Use tree factories that accept symbols and encapsulate ValDef
creation
- Use `gen.mkForwarder` to handle the conditional addition of
`: _*` for varargs functions. We don't need to predicate this
on `etaExpandKeepsStar`; the only place that need to do that
is EtaExpansion.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Update Eclipse classpath files
|
| | | | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Revise paragraph (a revised #3164)
|
| | |_|_|_|/
| |/| | | |
| | | | | | |
Revise text further, following suggestions in #3164 and part of the suggestions by @som-snytt. But I've kept "appear", since this paragraph documents the external behavior, not the implementation.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
correctly fails implicit search for invalid implicit macros
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
There was a rare corner case when implicit search wouldn’t discard
an invalid implicit macro (e.g. the one with mismatching macro impl or
the one with macro impl defined in the same compilation run) during
typechecking the corresponding candidate in typedImplicit1. This is now fixed.
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
s.u.c.NonFatal: StackOverflowError is fatal
|
| | |_|/ / / /
| |/| | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
As demonstrated in
https://groups.google.com/d/topic/scala-language/eC9dqTTBYHg, SOEs
should be considered fatal, because all popular JVM implementations
seem to run into inconsistent state (ignoring finally blocks leading
to not running monitorExit, leading to locks not being unlocked, ...)
if one just pushes them enough.
|
|\ \ \ \ \ \ \
| |/ / / / / /
|/| | | | | | |
Fix implicit divergence regression
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
While debugging pos/t7983.scala, I noticed that:
complexity(scala.type): 1
complexity(Int): 2
The intent of the code is that top level classes should have
a complexity of one. This commit restores that for cases when
we see the prefix type as a ThisType, rather than a SingleType.
I can't construct a test case in which this small difference
is observable in the divergence checks.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
And use List#sum, rather than a fold.
No functional change.
|
| | |/ / / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
As seen in Slick. Regressed in 039b1cb1a5b8.
In that commit, a call to `normalize` was replaced with `dealiasWiden`
as part of a broad sweeping change. However, while the latter does
less than the former with regards to eta expansion ofhigher kinded
type refs (the motivation of that commit), it also does more when it
comes to singleton types: they are widened to the underlying type.
This was widening away `SingleType(<<package a.b>>, <<package c>>)`
before the special case assiging that type component a complexity of
zero could kick in.
In the test case, extracted from Slick, this meant that the
divergence check would consider that the second type below to
outrank the first in the complexity measure, and abort the implicit
search.
Shape[?, ? (Coffees, Coffees), ?]
Shape[DivergenceTest.this.Flat, ?, Coffees, ?]
After this change, the number of packages enclosing `DivergenceTest`
no longer has a bearing on the complexity score of the type.
Here's how the race was run before hand:
complexity(<noprefix>): 0
complexity(<root>): 1
complexity(foo.type): 2
complexity(foo.bar.type): 3
complexity(foo.bar.baz.type): 4
complexity(DivergenceTest.this.type): 5
complexity(<noprefix>): 0
complexity(<root>): 1
complexity(foo.type): 2
complexity(foo.bar.type): 3
complexity(foo.bar.baz.type): 4
complexity(DivergenceTest.this.type): 5
complexity(DivergenceTest.this.Flat): 6
complexity(<noprefix>): 0
complexity(<root>): 1
complexity(scala.type): 2
complexity(Int): 3
complexity(?): 1
complexity(DivergenceTest.this.Shape2[DivergenceTest.this.Flat,Int,?]): 16
complexity(<noprefix>): 0
complexity(<root>): 1
complexity(foo.type): 2
complexity(foo.bar.type): 3
complexity(foo.bar.baz.type): 4
complexity(DivergenceTest.this.type): 5
complexity(?): 1
complexity(<noprefix>): 0
complexity(<root>): 1
complexity(scala.type): 2
complexity(<noprefix>): 0
complexity(Coffees): 1
complexity(<noprefix>): 0
complexity(<root>): 1
complexity(scala.type): 2
complexity(Int): 3
complexity((Coffees, Int)): 7
complexity(?): 1
complexity(DivergenceTest.this.Shape2[?,(Coffees, Int),?]): 15
dominates(DivergenceTest.this.Shape2[_ <: DivergenceTest.this.Flat, Int, U2], DivergenceTest.this.Shape2[_ <: Level, (Coffees, Int), U1]): true
And afterwards:
complexity(DivergenceTest.this.type): 1
complexity(DivergenceTest.this.type): 1
complexity(DivergenceTest.this.Flat): 2
complexity(scala.type): 1
complexity(Int): 2
complexity(?): 1
complexity(DivergenceTest.this.Shape2[DivergenceTest.this.Flat,Int,?]): 7
complexity(DivergenceTest.this.type): 1
complexity(?): 1
complexity(scala.type): 1
complexity(<noprefix>): 0
complexity(Coffees): 1
complexity(scala.type): 1
complexity(Int): 2
complexity((Coffees, Int)): 5
complexity(?): 1
complexity(DivergenceTest.this.Shape2[?,(Coffees, Int),?]): 9
dominates(DivergenceTest.this.Shape2[_ <: DivergenceTest.this.Flat, Int, U2], DivergenceTest.this.Shape2[_ <: Level, (Coffees, Int), U1]): false
Notice that even in the after shot, `scala.Int` has a complexity of 2.
It should be 1; this will be fixed in a separate commit.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-7985 Allow qualified type argument in patterns
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Just parse as though it is a type, and post process to
add the Bind if it turns out to be a type variable.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
As per the last commit, tighten up the interpretation of a lower
cased identifier meaning that we're looking at a type variable.
|
| |/ / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
We were considering the lower case `s` in `case _: Array[scala.Int]`
as a sign that we were dealing with a type variable pattern.
Now, we only do this if a lookahead confirms the absence of a the `.`
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-7221 Rewrites pollForWork non-recursively
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Fixes #1001407
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
more precise isMacroApplication check
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Replaces the `symbol.isMacro` check with `symbol.isTermMacro`.
Doesn’t make any difference to trunk but helps a lot with macro annotations.
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
Remove deprecated constructor from the migration annotation
|
| | |_|/ / / / /
| |/| | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
The migration annotation had a deprecated 2 arg constructor that was
deprecated in 2.10.0. This commit removes that constructor. Because
migration is private to the scala package this change shouldn’t affect
the rest of the community.
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
Refactor out fresh name prefix extraction logic
|
| | | | | | | | | |
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
1. refactor out FreshNameExtractor out of Quasiquotes cake into
SymbolTable (can’t put it outside due to the fact that names are
path-dependent)
2. add optional parameter to the fresh name creator to cover additional
qq$ prefix needed for quasiquotes
3. add unit tests
|
|\ \ \ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
Removing deprecated code.
|
| | |/ / / / / / /
| |/| | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
Code which has been deprecated since 2.10.0 and which allowed
for straightforward removal.
|
|\ \ \ \ \ \ \ \ \
| |_|_|_|_|_|_|_|/
|/| | | | | | | | |
Deprecate Pair and Triple
|
| |/ / / / / / / |
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
deprecate scala.Responder
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
As discussed earlier it doesn’t really belong to the scala package.
|
|\ \ \ \ \ \ \ \ \
| |/ / / / / / / /
|/| | | | | | | | |
Handle TypeApply(fun, ...) for symbol-less funs
|
| |/ / / / / / /
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Such as class literals, as one could conjure in `classOf[Int][Int]`
Before, this would crash with a `NullPointerException`
|
|/ / / / / / / |
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Fix a typo in the `scala` man page
|
| | | | | | | | |
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
SI-7280 Scope completion not returning members provided by imports
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
Updates localeContext() to return the best context possible when there are none directly
associated with the given position. It happens when an expression cannot be
successfully typed, as no precise ContextTree covers the expression location, or if the
position is not inside any expression.
Adds corresponding tests
|