| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
SI-8519 collection.immutable.Map.apply is inefficient
|
| |
| |
| |
| |
| |
| | |
Added customized apply and contains methods for EmptyMap, Map1 - Map4 and ListMap (both EmptyListMap and Node).
The modifications appear to be able to (sometimes) change the SerialVersionUID of EmptyListMap, so that has been fixed at the old value.
|
|\ \
| | |
| | | |
SI-8944 A more resiliant naming scheme for case accessors
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Case class parameters that are less that public have an extra
accessor method created to ensure universal pattern matchability.
See #4081 for more background.
Currently, this is given a fresh name based on the parameter name.
However, this is fragile and the name can change based on unrelated
edits higher up in the source file.
This commit switches to a stable naming scheme for these methods.
A non-public case field `foo` has a corresponding accessor
`foo$access$N`, where `N` is the index of the parameter within
the constructor parameter list.
The enclosed tests show a case that used to trigger a linkage
error under separate compilation that now works; shows that by
choosing the `foo$access$1` rather than `foo$1` we don't clash with
lambda lifted methods in the class; and shows the names of the
accessor methods as seen via Java reflection.
|
|\ \ \
| | | |
| | | | |
SI-8462: Int shift Long result corrected
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Constant folding was incorrectly promoting to Long when the
operand was Long, as with other binary ops, but the result
type depends on the receiver.
Per SLS 12.2.1.
This fixes ((1 << 2L): Int) and the other shift ops and
the other integral types.
|
|\ \ \ \
| |/ / /
|/| | | |
SI-8691 SeqView throws exception when prepending a collection
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Prepend was throwing segfaults as it was handled differently from Append. This brings the two into line with each other.
There are various optimizations that could be applied that have not been, however, such as intercepting sequential prepends and generating one multi-prepend instead of nested single-element prepends.
Unit test added to verify minimally that bug is gone.
|
|\ \ \
| | | |
| | | | |
SI-7981 toSeq on immutable Map and Set return ArrayBuffer
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Switched to `Vector` for the default `MapLike`/`SetLike`, then back again in `mutable.MapLike`/`mutable.SetLike`.
Preliminary performance testing indicates an across-the-board improvement due to cutting out a great deal of indirection. In the case of empty immutable maps or sets, the improvement is enormous: it quickly returns Vector.empty instead of jumping through all sorts of hoops to eventually create an empty `ArrayBuffer`.
One possible downside is that `Vector` is pretty memory-hungry for small collections. Need to evalute this; rather than abandoning this change, it's probably better to make `Vector` smarter about small collections.
Also fixed test with literal "ArrayBuffer" in output (`s/ArrayBuffer/Vector/g`).
|
|\ \ \
| | | |
| | | | |
SI-8819 Range slice does not return a Range
|
| | |/
| |/|
| | |
| | | |
Added an override to the `slice` method that creates a `Range`. No tests (except verifying by hand that it solves the bug); scala-collections-laws found and will test this.
|
|\ \ \
| | | |
| | | | |
SI-8814 mutable.LongMap loses its LongMapness when adding with +
|
| |/ /
| | |
| | |
| | |
| | |
| | | |
Added overrides for +, ++, and updated to both LongMap and AnyRefMap.
No tests; this was caught by scala-collections-laws.
|
|\ \ \
| | | |
| | | | |
SI-8765 immutable.HashSet exposes internal updated0 method
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Made most internal methods protected or private[immutable], as appropriate. (Coverage was scattershot before.)
updated0 is private[collection] since it is used by ParHashSet. (Not sure how wise this is for maintainability, but let's not rock this boat now.)
No deprecation, as there was no real way to sanely use these. No test, as this is better caught by inspection than compilation failure tests.
|
|\ \ \
| |/ /
|/| | |
SI-8727 Map.filterKeys result's contains and get are inconsistent
|
|/ /
| |
| |
| | |
Changed documentation and code so that predicate for filterKeys is always applied before the map is queried.
|
|\ \
| | |
| | | |
SI-7521 Fix erasure of parametric value classes.
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`Erasure.boxingErasure` exists to ensure that we use boxed primitives
to represent the value, if the value class has type parameters
referred to by its element type.
However, this is implenented with a type map that runs deeply
across the type. In the enclosed test case, we have
`Repr=Array[Int]`, which should be erased to `Array[Int]`, _not_
to `Array[Integer]`.
This commit ensures that the `boxingErasure` map only applies
boxing at the top level, and not within array arguments. (Other
type arguments will be erased, so we don't have to deal with them.)
|
|\ \
| | |
| | | |
SI-8251 Remove ListBuffer.readOnly as deprecated
|
| | |
| | |
| | |
| | | |
Complete the story arc.
|
|\ \ \
| |/ /
|/| | |
SI-8835 Lazier slice for Iterator
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
An iterator for slicing that does not drop eagerly.
A series of `take m drop n` that results in nothing taken
will not call the underlying iterator.
Chained invocations do not create intermediate iterators.
This PR against 2.12 (because of the change to laziness)
does not include the expanded unit test from #4075.
Fix the parallel iterable splitter, which overrides `take`
and `slice`, to also override `drop`. Drop is now eager
there, like the drop of slice.
Enhance `stringOf` to handle `ParIterable` again. A commit
from a previous decade added that under the aegis of `Iterable`.
As of 2.11, `stringOf((0 until 512).to[Vector].par, 10)`
does not truncate.
|
|\ \
| |/
|/| |
SI-8862 Fix treatment of inherited implicits in package objects
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Introduce `Symbol#packageObject` and `Type#packageObject`
to lookup the member package object of a package class/module,
and use this far and wide.
- Replace the overly complicated (and still buggy) implementation
of `Context#isInPackageObject` with a one liner. The simplifying
insight is that if we select a symbol from a package prefix
that does not own that symbol, it *must* have really been
selected from the package object.
- Change implicit search to use the cache in
`ModuleSymbol#implicitMembers` via `Type#implicitMembers`,
which lets the client code read more naturally.
Fixes a bug with `adapt::insertApply` that Adriaan spotted in a feat
of lateral thinking. This is tested in t8862b.scala. alladin763.scala
adds the test case from the bug originally remedied by `insertApply`
to check we haven't regressed.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Two spots in implicit search fell prey to a trap with package
objects. Members of a package object are entered into the scope
of the enclosing package, but that doesn't form a suitable prefix
for determing the member type.
A REPL transcript paints a picture that speaks a 1000 words:
```
scala> :paste -raw
// Entering paste mode (ctrl-D to finish)
package p { class C[A] { def foo: A = ??? }; object `package` extends C[String] }
// Exiting paste mode, now interpreting.
scala> val p = rootMirror.getPackageIfDefined("p")
warning: there was one deprecation warning; re-run with -deprecation for details
p: $r.intp.global.Symbol = package p
scala> p.info.decls
res0: $r.intp.global.Scope = Scopes(class C, package object p, method foo)
scala> val foo = p.info.decl(TermName("foo"))
foo: $r.intp.global.Symbol = method foo
scala> p.typeOfThis memberType foo
res1: $r.intp.global.Type = => A
scala> val fooOwner = foo.owner
fooOwner: $r.intp.global.Symbol = class C
scala> p.info.decl(nme.PACKAGE).typeOfThis memberType foo
res3: $r.intp.global.Type = => String
```
This commit detects if we find an implicit in a package module,
and then uses the self type of the corresponding package object
as the prefix for the `ImplicitInfo`. This is done in both
`Context.implicitss` (which collects in-scope implicits), and
in `companionImplicitMap` (which harvests them from the implicit
scope.) In addition, it was necessary / possible to remove a special
case that excluded package object implicits, the referenced tests for
SI-3999 now pass without this.
|
|\ \
| |/
|/| |
SI-8575 Fix subtyping transitivity with aliases, compound types
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Thanks to @b-studios and @Blaisorblade for investigation into this
bug.
`RefinedType#normalize` is responsible for flattening nested
compound types to a flat representation.
Types are normalized during `=:=` in search of a successful
result.
This means that `((A with B) with C) =:= (A with B with C)`.
However, if we introduce a type alias for `A with B` on the LHS,
the attempt at flattening is thwarted.
This commit changes normalization of refined types. If a parent is
an alias for another refined type, it is dealiased during the
flattening process.
Two tests are included. The first demonstrates a symptom of this
problem: failure to install a bridge method resulted in a linkage
error.
The second test uses the reflection API to directly show transitivity
of subtyping now holds.
Targetting at 2.12, as bug fixes in subtyping usually can be shown
to lead to binary incompatibilities between code using the old and
new compilers.
|
|\
| |
| | |
SI-8955 Fix hanging fork-join pool via parallel collections
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A recent change [1] to Scala's default fork join thread pool caused
intermittent deadlocks. This is only visible in the development series
of Scala, 2.12.0-SNAPSHOT.
We changed our thread factory to place a hard limit the number of
threads created (equal to the desired parallelism.)
I have extracted a test case [2] that uses jsr166e directly, rather
than using Scala's parallel collections and abstractions on top of FJ.
In the comments of the bug, Viktor suggests this was too aggressive
and instead we ought to increase the limit to parallelism + 256
(with a system property override.)
He explained:
> The number 256 is going to be the default for the max threads for
> FJP in Java9 (down from 32k) so this change will harmonize the
> settings while making it possible to override from the outside.
>
> The cause of the deadlock is twofold:
>
> 1) The test uses ExecutionContext.global, which is not designed
> for typical ForkJoin workloads since it has async = true
> (FIFO instead of LIFO)
> 2) And we capped the default max number of threads to be created
> when doing managed blocking from 32k to number of cores
> (a tad too aggressive it seems)
Through testing, I found that for this example I could trigger the
hang with:
parallelismLevel | maxThreads
-----------------------------
2 | <= 4
4 | <= 9
8 | <= 11
16 | <= 15
I have emailed concurrency-interest [3] to help analyse the problem
further, but in the interest of avoiding hangs in the
scalacheck/parallel-collections test, I'm implementing Viktor's
suggestion in the interim.
[1] https://github.com/scala/scala/pull/4042
[2] https://gist.github.com/retronym/2e14cdab6d5612562d95
[3] http://markmail.org/message/czphdyjxpkixeztv
|
|\
| |
| | |
SIP-14 improvements
|
| |
| |
| |
| |
| |
| | |
There was an unfortunate side-effect from having `Implicits.global` be
of type `ExecutionContextExecutor`; it is more specific than `ExecutionContext`,
as such it would be picked over other `ExecutionContexts` in the implicit scope.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- `def transform[S](f: Try[T] => Try[S])(implicit executor: ExecutionContext): Future[S]`
- `def transformWith[S](f: Try[T] => Future[S])(implicit executor: ExecutionContext): Future[S]`
- `def flatten[S](implicit ev: T <:< Future[S]): Future[S]`
- `def zipWith[U, R](that: Future[U])(f: (T, U) => R)(implicit executor: ExecutionContext): Future[R]`
Add missing utilities:
- `val unit: Future[Unit]` in `object Future`
- `object never extends Future[Nothing]` in `object Future`
- `def defaultBlockContext: BlockContext` in `object BlockContext`
- `def toString: String` on stdlib implementations of `Future`
Refactors:
- the `scala.concurrent.Future` trait to not explicit create any `Promises`,
so that implementations can control implementation type,
this is mainly facilitated through adding of the `transform` and `transformWith` methods.
- the implementation of `ExecutionContextImpl` has been cleaned up
- the `scala.concurrent.impl.DefaultPromise` has been reimplemented to not use `sun.misc.Unsafe`
Securing:
- Add a self-check in `completeWith` and `tryCompleteWith` to avoid cycles in trait Promise
- Capping the maximum number of threads for the global `ExecutionContext` to the max parallelism
- Implementing (almost) all `Future` combinators on `transformWith` and `transform` means
that `DefaultPromise` linking works on both `(flat)map` and `recover(With)`
- Nested `blocking {}` should not spawn extra threads beyond the first.
Removes:
- the private `internalExecutor` method in favor of an import in trait `Future`
- the private `internalExecutor` method in favor of an import in trait `Promise`
- the `AtomicReferenceFieldUpdater` in `AbstractPromise` since we're using `Unsafe`
- `scala.concurrent.impl.Future` is no longer needed
Deprecates:
- `Future.onSuccess` - discourage the use of callbacks
(and is also redundant considering `foreach` and `onComplete`)
- `Future.onFailure` - discourage the use of callbacks
(and is also redundant considering `onComplete` and `failed.foreach`)
- `ExecutionContext.prepare` - it was ill specced and it is too easy to forget to call it
(or even know when to call it or call it more times than needed)
- All classes in scala.concurrent.forkjoin. Scala 2.12 will be Java 8+ and as such the jsr166e
should be used as included in java.util.concurrent.
Reimplements:
- `failed` - in terms of `transform`
- `map` - in terms of `transform`
- `flatMap` - in terms of `transformWith`
- `recover` - in terms of `transform`
- `recoverWith` - in terms of `transformWith`
- `zip` - in terms of `flatMap` + `map`
- `fallbackTo` - in terms of `recoverWith` + `recoverWith`
- `andThen` - in terms of `transform`
Miscellaneous:
- Giving the threads of `ExecutionContext.global` sensible names
- Optimizes `object Future.successful` and `object Future.failed` are now separate implementations,
to optimize for the result, avoiding doing work for the "other branch".
- Optimizes `compressedRoot()` by avoiding double-calls to volatile get.
Documentation:
- Almost all methods on `Future` and `Promise` have been revisited and had their ScalaDoc updated
Tests:
- Yes
|
|\
| |
| | |
Merge 2.11.x to 2.12.x
|
|/|
| |
| |
| | |
merge/2.11.x-to-2.12.x-20140930
|
| |\
| | |
| | | |
spec: generated TOC, with linkable headers and return to top links
|
| | |
| | |
| | |
| | | |
...and a Scala favicon.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This adds a table of contents to the spec, with a way to get the link of a
header on hover (like on GitHub) and a "return to top" small icon at the
end of each section.
Jekyll generates the H1-level table of contents, and then the current
one is expended using jQuery all the way down to H5 titles. Examples and
H6 headers are ignored.
GitHub's (MIT licensed) octicons are used for nice "link" and "up"
icons.
|
| |\ \
| | | |
| | | | |
Cleanup a few compiler flags in test/files/
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
* 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.
|
| |\ \ \
| | | | |
| | | | | |
Bump timeout in interactive tests from 10s -> 30s.
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Seeing too many of these failures on our build servers.
https://scala-webapps.epfl.ch/jenkins/view/2.N.x/job/scala-nightly-auxjvm-2.11.x/148/jdk=jdk8,label=auxjvm/console
This is most likely due to load on the machines.
|
| |\ \ \
| | |/ /
| |/| | |
Avoid test fragility to changes in Predef
|
| |/ /
| | |
| | |
| | |
| | |
| | | |
The check file used to contain a stack trace entry from
Predef with a line number. I've made the macro fail
in a different manner that avoids this fragility.
|
| |\ \
| | | |
| | | | |
Merge 2.10.x to 2.11.x
|
| |/| |
| | | |
| | | |
| | | | |
merge/2.10.x-to-2.11.x-20140925
|
| | |\ \
| | | | |
| | | | | |
[backport] SI-7756 Uncripple refchecks in case bodies
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In 65340ed4ad2e, parts of RefChecks were disabled when
we traversed into the results of the new pattern matcher.
Similar logic existed for the old pattern matcher, but in
that case the Match / CaseDef nodes still existed in the tree.
The new approach was too broad: important checks no longer
scrutinized the body of cases.
This commit turns the checks back on when it finds the remnants
of a case body, which appears as an application to a label def.
Conflicts:
src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
Cherry pick of 3df1d77fc984b976efa68098206e801cf3b83a9e
|