| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
These pop up as the owner of symbols in annotation arguments,
such as the ones introduced by the names/defaults desugaring.
The first two test cases here motivate the two patches to Unpicker.
The third requires both fixes, but exploits the problem directly,
without using `@deprecated` and named arguments.
See also 14fa7be / SI-8708 for a recently remedied kindred bug.
|
|
|
|
|
|
|
|
|
|
| |
* String interpolation isn't Xexperimental anymore
A few useless Xexperimental flags in tests were left behind by 6917cca,
after string interpolation was made non-experimental in 983f414.
* things added under -Xfuture in 2.10 are very much Xpresent now, the
flag isn't needed anymore.
|
|\
| |
| | |
This ensures that typechecking custom unapplications in silent mode
|
| |
| |
| |
| |
| |
| | |
doesn't leak uncatchable errors. Interestingly enough, the problem
only manifested itself for custom unapply methods, not for synthetic
ones generated for case classes.
|
|/
|
|
|
|
| |
Regressed in 2a1b15e / SI-8283. Another specimen of an archetypal
bug: unwanted dealising by using `typeSymbol`, rather than
`typeSymbolDirect`.
|
|\
| |
| | |
SI-8498 @compileTimeOnly should be aware of bridge methods.
|
| |
| |
| |
| |
| |
| | |
Calling a @compileTimeOnly method from another @compileTimeOnly
method happens when the former gets a bridge method. It should not
throw an error. Calling the bridge or the method will anyway.
|
|\ \
| | |
| | | |
SI-8410 Don't warn fatally on disabled flag
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Since boolean settings can now be set false by user,
summary warnings should not be issued when the flag
is explicitly off (as opposed to unset, default).
In particular, `-Xfatal-warnings` should not fail
if there were no warnings otherwise.
```
$ ~/scala-2.11.2/bin/scalac -d /tmp -deprecation:false test/files/pos/t8410.scala
$ ~/scala-2.11.2/bin/scalac -d /tmp -deprecation:false -Xfatal-warnings test/files/pos/t8410.scala
warning: there were three deprecation warnings; re-run with -deprecation for details
error: No warnings can be incurred under -Xfatal-warnings.
one warning found
one error found
```
After this commit:
```
$ skalac -d /tmp -Xfatal-warnings test/files/pos/t8410.scala
warning: there were three deprecation warnings; re-run with -deprecation for details
error: No warnings can be incurred under -Xfatal-warnings.
one warning found
one error found
$ skalac -d /tmp -deprecation:false -Xfatal-warnings test/files/pos/t8410.scala
```
Similarly for other collecting flags:
```
$ skalac -d /tmp -optimise -Yinline-warnings -deprecation:false -Xfatal-warnings test/files/pos/t8410.scala
test/files/pos/t8410.scala:14: warning: Could not inline required method dropWhile because access level required by callee not matched by caller.
def k = List(0).dropWhile(_ < 1) // inlining warns doubly
^
test/files/pos/t8410.scala:14: warning: At the end of the day, could not inline @inline-marked method dropWhile
def k = List(0).dropWhile(_ < 1) // inlining warns doubly
^
error: No warnings can be incurred under -Xfatal-warnings.
two warnings found
one error found
$ skalac -d /tmp -optimise -Yinline-warnings:false -deprecation:false -Xfatal-warnings test/files/pos/t8410.scala
```
Footnote: handling of deprecated locals also changed in 2014:
```
$ ~/scala-2.11.0-M7/bin/scalac -d /tmp -deprecation -Xfatal-warnings test/files/pos/t8410.scala
test/files/pos/t8410.scala:8: warning: method f in object Test is deprecated:
Console println f // warns
^
error: No warnings can be incurred under -Xfatal-warnings.
one warning found
one error found
$ ~/scala-2.11.0-M8/bin/scalac -d /tmp -deprecation -Xfatal-warnings test/files/pos/t8410.scala
test/files/pos/t8410.scala:5: warning: method _f is deprecated:
def g = { @deprecated("","") def _f = f ; _f } // warns in 2.11.0-M8
^
test/files/pos/t8410.scala:6: warning: class X is deprecated:
def x = { @deprecated("","") class X { def x = f } ; new X().x } // warns in 2.11.0-M8
^
test/files/pos/t8410.scala:8: warning: method f in object Test is deprecated:
Console println f // warns
^
error: No warnings can be incurred under -Xfatal-warnings.
three warnings found
one error found
```
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
5dfcf5e reverted a change to `Symbol#isEffectivelyFinal` (made in
adeffda) that broke overriding checks, and moved the new enhanced
version to a new method.
However, the test for inaccessible type access still uses the old one,
so it lost the ability to see that the owner of some method is either
final or sealed and not overridden.
This just makes it use the new `isEffectivelyFinalOrNotOverriden`.
|
|\ \
| |/
|/| |
SI-8793 Fix patmat regression with extractors, existentials
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In the same vein as SI-8128 / 3e9e2c65a, revert to the 2.10.x style
of determining the types of the product elements of an extractor
when using `TupleN`.
I believe we can discard the special casing for Option/Tuple/Seq
altogether with judicious application of `repackExistential` in
`unapplyMethodTypes`. That ought to also fix fix SI-8149. But I'll
target that work at 2.12.x.
|
|/
|
|
|
|
|
|
|
| |
Avoid the widening bug for q. This resolution also suffers
from the inference of Any, which can trigger a warning and
an anxiety attack. But that's still better than doing the
wrong thing.
Right?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This mode of macro expansion is used by the presentation compiler to
leave the original macro applications ("expandees") in the type
checked trees, annotated with the types of the expansions.
However, under some circumstances involving implicits, we would
re-expand the macro. If the macro wasn't stable, this could lead
to a type mismatch.
The originally reported problem was with the shapeless
`mkSingletonOps` macro. Its expansion had the type of a freshly-named
class local to the expansion. Upon the re-expansion, a new class
was generated, which lead to errors like:
client/Client.scala:4: error: type mismatch;
found : fresh$macro$2
required: fresh$macro$1
This commit suppressed re-expansion of the expandee by use of
the existing, tree attachment driven mechanism.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code that generated the Java varargs forwarder was basing
things on the `ValDef-s` of the parameters of the source method.
But, their types refer to a type parameter skolems of the enclosing
method, which led to a type mismatch when typechecking the forwarder.
Instead, I've reworked the code to simply use the `DefDef`-s symbol's
info, which *doesn't* refer to skolems. This actually simplifies the
surrounding code somewhat; rather than repeated symbols in a map
we can just time travel the pre-uncurry method signatures to figure
out which params are releated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MultiChoice allows -language to work like -Xlint.
The bug as described was that the setting value was set instead of updated
(++=) with additional flags.
The unreported bug was that `_` no longer set all settings.
The corrected behavior is that "contains" means "it was enabled, or
_ was set and it was not disabled explicitly."
That is the behavior of `-Xlint` but with a different mechanism,
since each lint option is a Setting.
A semantic difference is that -Xlint enables all the lint options,
but -language does not enable all the language features. `scalac -X` does
not explain this additional behavior of the `-Xlint` flag.
Also worth noting that `scalac -feature -language unused.scala` failed
in 2.11.1 but succeeds silently now.
|
|\
| |
| | |
relaxes attachment-matching rules
|
| |
| |
| |
| |
| |
| | |
It came as a surprise recently, but attachments.contains/get/update/remove
require the class of the payload to match the provided tag exactly, not
taking subclassing into account. This commit fixes the oversight.
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
When a sealed class or trait has local children, they are not pickled
in as part of the children of the symbol (introduced in 12a2b3b to fix
Aladdin bug 1055). Instead the compiler adds a single child class
named LOCAL_CHILD. The parents of its ClassInfoType were wrong: the
first parent should be a class. For sealed traits, we were using the
trait itself.
Also, the LOCAL_CHILD dummy class was entered as a member of its
enclosing class, which is wrong: it represents a local (non-member)
class, and it's a synthetic dummy anyway.
|
|\
| |
| |
| |
| |
| |
| | |
merge/2.10.x-to-2.11.x-20140604
Conflicts:
src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Regressed in SI-7915 / 3009a525b5
We should be deriving the position of the synthetic `Select`
from `basefun1`, rather than `basefun`. In the new, enclosed
test, the difference amounts to:
new Container().typeParamAndDefaultArg[Any]()
`------------ basefun1 --------------'
`----------------- basefun ---------------'
For monomorphic methods, these are one and the same, which is
why `presentation/t7915` was working. I've extended that test
to a polymorphic method to check that hyperlink resolution works.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Tracked down this error:
<none> is invariant, but type Y2 is declared covariant
<none>'s bounds<notype> are stricter than type X2's declared bounds >: Nothing <: Any, <none>'s bounds<notype> are stricter than type Y2's declared bounds >: Nothing <: Any
to `Symbol#typeParams` returning `List(NoSymbol)` if the symbol
was not initialized.
This happends in the enclosed test for:
// checkKindBoundsHK()
hkArgs = List(type M3)
hkParams = List(type M2)
This commit forces the symbol of the higher-kinded type argument
before checking kind conformance.
A little backstory:
The `List(NoSymbol)` arises from:
class PolyTypeCompleter... {
// @M. If `owner` is an abstract type member, `typeParams` are all NoSymbol (see comment in `completerOf`),
// otherwise, the non-skolemized (external) type parameter symbols
override val typeParams = tparams map (_.symbol)
The variation that triggers this problem gets into the kind
conformance checks quite early on, during naming of:
private[this] val x = ofType[InSeq]
The inferred type of which is forced during:
def addDerivedTrees(typer: Typer, stat: Tree): List[Tree] = stat match {
case vd @ ValDef(mods, name, tpt, rhs) if !noFinishGetterSetter(vd) =>
// If we don't save the annotations, they seem to wander off.
val annotations = stat.symbol.initialize.annotations
(cherry picked from commit 03a06e02483eaf442158339c2edd6bcfd99847a3)
|
| |\
| | |
| | | |
[nomaster] Fix non-deterministic <:< for deeply nested types
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Backported from master. This is a squashed commmit comprising:
SI-8146 Pending test, diagnosis for bug in decidability of <:<
(cherry picked from commit 8beeef339ad65f3308ece6fb0440cdb31b1ad404)
SI-8146 Test cases for typechecking decidability
Taken from "On Decidability of Nominal Subtyping with Variance"
(Pierce, Kennedy), which was implemented in 152563b.
Part of the implementation (SubTypePair) will be changed in the
following commit to fix the non-deterministic errors typechecking
heavily nested types involving aliases or annotations.
(cherry picked from commit 2e28cf7f76c3d5fd0c2df4274f1af9acb42de699)
SI-8146 Fix non-deterministic <:< for deeply nested types
In the interests of keeping subtyping decidable [1], 152563b
added some bookkeeping to `isSubType` to detect cycles.
However, this was based on a hash set containing instances of
`SubTypePair`, and that class had inconsistencies between its
`hashCode` (in terms of `Type#hashCode`) and `equals`
(in terms of `=:=`).
This inconsistency can be seen in:
scala> trait C { def apply: (Int @unchecked) }
defined trait C
scala> val intUnchecked = typeOf[C].decls.head.info.finalResultType
intUnchecked: $r.intp.global.Type = Int @unchecked
scala> val p1 = new SubTypePair(intUnchecked, intUnchecked)
p1: $r.intp.global.SubTypePair = Int @unchecked <:<? Int @unchecked
scala> val p2 = new SubTypePair(intUnchecked.withoutAnnotations, intUnchecked.withoutAnnotations)
p2: $r.intp.global.SubTypePair = Int <:<? Int
scala> p1 == p2
res0: Boolean = true
scala> p1.hashCode == p2.hashCode
res1: Boolean = false
This commit switches to using `Type#==`, by way of the standard
case class equality.
The risk here is that you could find a subtyping computation that
progresses in such a manner that we don't detect the cycle. It would
need to produce an infinite stream of representations for types that
were `=:=` but not `==`. If that happened, we'd fail to terminate,
rather than judging the relationship as `false`.
[1] http://research.microsoft.com/pubs/64041/fool2007.pdf
(cherry picked from commit a09e143b7fd1c6b433386d45e9c5ae3548819b59)
Conflicts:
src/reflect/scala/reflect/internal/tpe/TypeComparers.scala
src/reflect/scala/reflect/runtime/JavaUniverseForce.scala
|
| | | |
|
| | |
| | |
| | |
| | | |
The tree to create a `NoManifest` was unpositioned.
|
| | |
| | |
| | |
| | |
| | | |
It is important to append the fresh 'N' after '$'. Otherwise, we
find out the hard way that ("foo$11" + "1") == ("foo$1" + "11").
|
|\ \ \
| | | |
| | | | |
SI-8546 Pattern matcher analysis foiled by over-widening
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In the enclosed test, the prefix checkable type
`ModuleTypeRef(F2.this, C)` was being inadvertently widened to
`ModuleTypeRef(F2[?], C)`. This started after some misguided
future-proofing in SI-6771 / 3009916.
This commit changes the `dealiasWiden` to a `delias`.
|
|\ \ \ \
| | | | |
| | | | | |
SI-8531 Better space efficiency for patmat analysis
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
By adding logging to `clause`, I found that the majority of
calls provide 0 or 1 elements. In SI-7020 / 69557da55, we changed this
method to use a `LinkedHashSet` to have deterministic results
for clauses with more elements. But I suspect that this
contributes to higher memory usage from the pattern matcher.
The enclosed test case, carefully whittled down by @oxbowlakes,
used to consume an inordinate amount of memory and time.
After this patch, it is back to 2.10.4 performance.
I have run `neg/t7020.scala` in a loop and it still is deterministic.
|
|\ \ \ \ |
|
| |\ \ \ \
| | | | | |
| | | | | | |
makes bundles friendly to -Ywarn-dead-code
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Apparently, the `new Bundle(???).impl` synthetic tree generated as a
macro impl ref for bundles evokes -Ywarn-dead-code warnings.
This pull requests changes `???` to `null` in order not to stress out
the checker. What's in the argument doesn't actually make any difference
anyway.
|
| |\ \ \ \ \
| | | | | | |
| | | | | | | |
SI-8537 Puts SI-8157 fix under Xsource
|
| | | |/ / /
| | |/| | | |
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This is a follow-up to SI-5702 which enabled use of
`*` in infix notation in patterns.
Most of the work is in distinguishing infix from a
sequence pattern.
Also, do not take backticked star as the repeated
parameter marker in postfix position. That is,
`Int``*``` is not `Int*` -- I hope double-tick
renders as tick. There is not a special use case
except that backticks mean "I am an identifier, as
is, and not a keyword."
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Used to enable `-Xcheckinit` (now also `-Ybackend:GenBCode`) when
compiling tests in the respective jenkins builds. This is currently
broken, as you can see in [recent build logs] [1], `-Xcheckinit` is
missing:
[partest] Scalac options are: -optimise
Adds `.flags` files for macro tests (correct range positions not
enforced) and for tests failing due to SI-8560 or SI-8562.
[1]: https://scala-webapps.epfl.ch/jenkins/view/nightlies/job/scala-nightly-checkinit/2058/consoleFull
|
|\ \ \ \
| |/ / /
|/| | | |
SI-8329 Better hygiene for patmat partial functions
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Don't enter synthetic parameters of `applyOrElse` et al into
scope when typechecking the user-code; instead reference those
symbolically.
There is an exception to this principle. Currently we allow:
val x: PartialFunction[A, B] = x => x match { ... }
For this pattern of code, we use the given name `x` for the
corresponding method parameter of `applyOrElse` and `isDefinedAt`
and we actually need this to be in scope when we typecheck the
scrutinee. This construct is tested in `run/virtpatmat_partial.scala`.
A new parameter, `paramSynthetic`, differentiates this
case from the more typical `val x: PF[A, B] = { case ... => ... ; ... }
case, which uses a fresh name need not be in scope. (We could get
away with it, as it is fresh, but I thought it better to exclude it.)
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Fixes an inconsistency introduced in these two spots:
https://github.com/scala/scala/pull/3033/files#diff-6ce1a17ebee31068f41c36a8a2b3bc9aR79
https://github.com/scala/scala/pull/3033/files#diff-c455cb229f5227b1bcaa1544478fe3acR452
The bug shows up when pickling then unpickling an AnnotatedType
that has only non-static annotations.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Implicit search detects likely cycles by looking at the stack of
open implicits and checking the same implicit appears twice, and
if the second occurrence is trying satisfy an implicit search for
a "dominant" type.
Originally, this condition immediately failed the entire implicit
search. However, since Scala 2.10, this mechanism has been refined to
continue searching after the first divergent implicit is detected.
If a second divergence is found, we fail immediately. If the followup
search fails, we report the first divergence. Otherwise, we
take the successful result.
This mechanism was originally built around exceptions. This proved
to be fragile, and was refactored in SI-7291 / accaa314 to instead
use the `Context.errors` to control the process.
But, since that change, the pattern of implicits in scalanlp/breeze
and Shapeless have been prone to reporting the divergent implicit
errors where they used to recover.
So long as we left the `DivergentImplictTypeError` that originates
from a nested implicit search in `context.errors`, we are unable to
successfully typecheck other candidates. This commit instead
stashes the first such error away in `DivergentImplicitRecovery`,
to clear the way for the alternative path to succeed.
We must retain any other divergent implicit errors, as witnessed by
test/files/neg/t2031.scala, which loops unless we retain divergent
implicit errors that we don't stash in `DivergentImplicitRecovery`.
|
| | | | |
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Regressed in dbd8457 which changed `Context#make` to automatically
include the imports from the given `Tree` if it was an `Import`
tree, rather than requiring callers to call `makeNewImport`.
However, this turns out to double up the imports for the "inner" namer
of a template that starts with imports. The inner namer has a new
scope, but the same owner and tree as its parent.
This commit detects this case by seeing if the `Import` tree used
to consruct the child context is the same as the parent context.
If that is the case, we don't augment `Context#imports`.
|
|\ \ \
| | | |
| | | | |
SI-8376 Fix overload resolution with Java varargs
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When comparing specificity of two vararg `MethodTypes`, `isAsSpecific`
gets to:
```
case mt @ MethodType(_, _) if bothAreVarargs =>
checkIsApplicable(mt.paramTypes mapConserve repeatedToSingle)
```
The formal parameter type of a Java varargs parameter is represented
as `tq"${defintions.JavaRepeatedParamClass}[$elemTp]"`. For a Scala
repeated parameter, we instead use `defintions.RepeatedParamClass`.
`bothAreVarargs` detects `JavaRepeatedParamClass`, by virtue of:
```
def isRepeatedParamType(tp: Type) = isScalaRepeatedParamType(tp) || isJavaRepeatedParamType(tp)
```
But, `repeatedToSingle` only considers `RepeatedParamClass`.
This bug was ostensibly masked in 2.10.3, but became apparent after
a not-quite-refactoring in 0fe56b9770. It would be good to pin that
change down to a particular line, but I haven't managed that yet.
|
|\ \ \ \
| | | | |
| | | | | |
SI-8363 Disable -Ydelambdafy:method in constructor position
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
As @magarciaEPFL has done in his experimental optimizer [1], we can
avoid running into limitations of lambdalift (either `VerifyError`s,
ala SI-6666, or compiler crashes, such as this bug), by using the
old style of "inline" lambda translation when in a super- or self-
construtor call.
We might be able to get these working later on, but for now we
shouldn't block adoption of `-Ydelamndafy:method` for this corner
case.
[1] https://github.com/magarciaEPFL/scala/blob/GenRefactored99sZ/src/compiler/scala/tools/nsc/transform/UnCurry.scala#L227
|
|\ \ \ \
| |/ / /
|/| | | |
SI-8367 revert SI-8192's change to primaryConstructor when isJavaDefined
|
| | | |
| | | |
| | | |
| | | | |
this is some weird stuff
|