| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
SI-8520 Fix -Dscalac.patmat.analysisBudget=off
|
| |
| |
| |
| | |
Correctly parse "off" instead of throwing java.lang.NumberFormatException
|
|\ \
| | |
| | | |
SI-8430 Less non-determinism in patmat exhautiveness warnings
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Another mole whacked on the head by using `LinkedHashMap`.
Caution: `LinkedHashMap` doesn't preserve its runtime type if
you map through the generic interface. I've noted this gotcha as
SI-8434. I've structured this patch to enforce that concrete
collection with types, which is a good idea anyway.
My method to track this down was to place breakpoints in
`Hash{Map,Set}`.{foreach,iterator}` to see where that was
used from within pattern match translation. This approach was
drastically faster than my previous rounds of whack-a-mole.
The counter-examples are still a bit off; I'm going to merge
that aspect of this ticket with SI-7746, in which we've
pinpointed the culpable part of the implementation, but haven't
had success in fixing the bug.
|
|\ \ \
| | | |
| | | | |
SI-7992 Fix super-accessor generation after a local class
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The transformer in the superaccessors phase uses the var
`validCurrentOwner` to track whether we're in a part of the
code that won't end up in the host method, and as such, will
need to access super-method via a super-accessor.
But, this bit of bookkeeping was not correctly reset after traversing
out of a local class. A `VerifyError` ensued.
This commit changes `atOwner` to save and restore that flag, rather
than leaving it set to `true`.
I've also added a test variation using a by-name argument.
|
|\ \ \ \
| |_|_|/
|/| | | |
SI-8450 no "implicit numeric widening" in silent mode
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Before this fix, we get a second, spurious warning.
```
t8450.scala:5: warning: implicit numeric widening
def elapsed: Foo = (System.nanoTime - 100L).foo
^
t8450.scala:11: warning: implicit numeric widening
def elapsed: Foo = (System.nanoTime - 100L).foo
^
error: No warnings can be incurred under -Xfatal-warnings.
two warnings found
one error found
```
By respecting silent contexts, we now get only one.
I sneakily fixed similar occurrences without adding a test.
|
|\ \ \ \
| | | | |
| | | | | |
SI-8466 fix quasiquote crash on recursively iterable unlifting
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In order to handle unquoting quasiquotes needs to know if type is
iterable and whats the depth of the iterable nesting which is called
rank. (e.g. List[List[Tree]] is rank 2 iterable of Tree)
The logic that checks depth of iterable nesting didn't take a situation
where T is in fact Iterable[T] which caused infinite recursion in
stripIterable function.
In order to fix it stripIterable now always recurs no more than
non-optional limit times.
|
| | | | | |
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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`.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Better encapsulation for `DivergentImplicitRecovery` by replacing
the vars `countDown` and `implicitSym` with a single var holding
`Option[DivergentImplicitTypeError]`.
Also adds a pending test for SI-8460 that will be addressed in the
next commit. This commit is just groundwork and should not change
any results of implicit search.
|
|\ \ \ \
| |/ / /
|/| | | |
SI-8388 consistently match type trees by originals
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
|\ \ \ \
| |/ / /
|/| | | |
SI-8437 macro runtime now also picks inherited macro implementations
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously it didn't matter much that we used Class.getDeclaredMethods
instead of just getMethods, but with the introduction of macro bundles
it can make a difference which is fixed in this commit.
I'd also like to note that the fact that getMethods only returns public
methods and getDeclaredMethods also sees private methods, doesn't make
a difference, because macro implementations must be public.
|
|\ \ \
| |/ /
|/| | |
SI-8420 don't crash on unquoting of non-liftable native type
|
| | |
| | |
| | |
| | |
| | |
| | | |
Previously quasiquote's type-based dispatch failed to handle situation
where unquotee's type is native but non-liftable and was used to splice
with non-zero cardinality.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In SI-7944 / 251c2b93, we discovered that typechecking of an implicit
candidate could leave orphaned undetermined type parameters in the
implicit search context. This resulted in naked type parameters
leaking into implicit expansions. The fix seemed easy: just copy
any symbols from `implicitSearchContext.undetparams` to the enclosing
context (other than ones in `SearchResult#subst`).
However, the test case in this ticket reveals a subtle flaw in that
fix: `implicitSerachContext.undetparams` only contains the type params
from the most recently typechecked candidate!
Why? Implicit search uses the same context to typecheck all plausibly
compatible candidates. The typechecking itself is driven by
`typedImplicit1`.
Side note, that explains the heisenbug behaviour noted in the ticket:
Not *all* plausibly implicit candidates are typechecked. If
the current 'best' eligible candidate is more specific than the next
candidate, we can skip that altogether.Implicit search actually
exploits this for performance by ordering the candidates according to
usage statistics. This reordering, means that commenting out lines
elsewhere in the file changed the behaviour!
This commit simply stores the undet. tparams in the `SearchResult`,
where it is safe from the vaguries of typechecking other candidates.
That makes `Test1` and `Test2` with in the enclosed test case fail
uniformly, both with each other, and with an explicit call to
the view.
This is ostensibly a regression from 2.10.3. To get there,
we need an implicit search that has to infer `Nothing` in a covariant
position. In 2.10.3, we would just let the `G` out into the wild,
which did the right thing for the wrong reasons.
|
|\ \ \
| |/ /
|/| | |
SI-8425 don't create double-dollar names in c.freshName
|
| | |
| | |
| | |
| | |
| | |
| | | |
If we append a dollar to a user-provided prefix that ends in a dollar,
we create a potential for confusion for backend phases. That's why
this commit prevents such situations from happening.
|
|\ \ \
| |/ /
|/| | |
SI-4492 More informative error when class not found on classpath
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Position the error based on Select tree that failed to type check,
presumably due to an underlying MissingRequirementError, which has no position.
There are lots of other ways we could rewrap a MRE and supplement position info,
but that remains TODO. Jason's review comment is recorded in the code.
Also try to detect the case of a missing module and provide some advice,
as well as linking to the forthcoming 2.11 guide at
http://docs.scala-lang.org/overviews/core/scala-2.11.html.
|
|\ \ \
| | | |
| | | | |
SI-8368 respect user-supplied scala.usejavacp
|
| |/ /
| | |
| | |
| | | |
Now also works when the option is -Dscala.usejavacp=false...
|
|\ \ \
| | | |
| | | | |
SI-8266 Amend advice for deprecated octal 042
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Improve the advice for `f"\042"` to read:
```
use ${'"'} or a triple-quoted literal """with embedded " or \u0022""" instead.
```
as per the discussion on SI-6476.
Knuth says that Charles XII came close to introducing octal arithmetic to Sweden,
and Wikipedia doesn't deny it.
I imagine an alternative history in which octal literals are deprecated in Scala
but required by legislation in Akka. #octal-fan-fiction
|
|\ \ \ \
| |_|/ /
|/| | | |
SI-8402 Restore 2.10 variance behavior under -Xsource:2.10
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | | |
Issue deprecation warning under -Xsource:2.10 so time
travelers can have an authentic deprecation experience before
finding that their unsound code no longer compiles in 2.11.
The relevant ticket to the soundness issue is SI-6566.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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`.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Regressed in https://github.com/scala/scala/pull/2848. In particular,
see 0cf47bdb5b and 017460e63c.
Because of the regression, this pattern:
(s @ (_s @ (_: String)))
was translated into `typeTestStep`, rather than a `bindingStep`. This
came down the the use of `unbind` in the `TypeBound` extractor.
My first step was to remove the `unbind`. That led to another
problem: the tree now matches `SymbolAndTypeBound`, which extracted
`symbol = s, tpe = String`, ignoring the `_s`. I changed that
extractor to no longer recursively apply to the sub-pattern tree,
which is what `MaybeTypedBound` used to do.
I also checked for other uses of `unbind` in the match translation.
The only place I found it is in `BoundTree#pt`. I believe that this
usage is correct, or at least, not obviously incorrect.
|
|\ \
| | |
| | | |
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-8366 make partial function and match trees disjoint
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.)
|
|\ \ \ \
| | | | |
| | | | | |
SI-8368 respect user-supplied -Dscala.usejavacp in Windows runner
|
| |/ / / |
|
|/ / / |
|
|\ \ \
| | | |
| | | | |
SI-8385 make sure $quasiquote$tuple gets reified properly
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Previously due to greediness of SyntacticApplied there was a chance that
quasiquote tuple placeholder got reified as its representation rather
than its meaning.
|
|\ \ \ \
| | | | |
| | | | | |
SI-8331 make sure type select & applied type doesn't match terms
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
1. Tighten up the if else to avoid duplication
2. Add doc comments
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
|\ \ \ \
| | | | |
| | | | | |
SI-8367 revert SI-8192's change to primaryConstructor when isJavaDefined
|
| | | | |
| | | | |
| | | | |
| | | | | |
this is some weird stuff
|
|\ \ \ \ \
| |_|_|/ /
|/| | | | |
SI-8368 respect user-supplied -Dscala.usejavacp in unix runner
|