summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* SI-9369 Fix pattern matcher warnings for diamond shaped inheritance.Gerard Basler2015-09-121-1/+5
| | | | | | | | | | A previous optimization (d44a86f432a7f9ca250b014acdeab02ac9f2c304) for pattern matcher exhaustivity checks used a smarter encoding to ensure that the scrutinee can be equal to one child only. However, in case of traits between the root and leave type, a child can be of several types and these types should not be in a mutually exclusive group. A simple solution (hat tip to retronym) is to just put traits and classes into separate groups.
* Merge pull request #4714 from Ichoran/issue/9407Seth Tisue2015-09-081-10/+1
|\ | | | | SI-9407 Vector implementation bit-shift bugfix
| * SI-9407 Vector implementation bit-shift bugfixRex Kerr2015-08-291-10/+1
| | | | | | | | | | | | Fixed logically incorrect or unnecessary code in Vector as reported by Dirk Toewe. No tests. Because of the size of the vectors, tests would be impractically slow. Also, the logic is quite clear: when you are recursing through a tree, using the wrong bit shift means you hit the wrong part of the tree, and when you create and then always overwrite a mutable var, you should just not do it to begin with.
* | Merge pull request #4333 from Ichoran/opt-Iterator-2.11.xSeth Tisue2015-09-081-59/+162
|\ \ | | | | | | Performance optimization - Iterator
| * | Performance optimization - Iterator span, collect, dropWhileRex Kerr2015-08-071-35/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite of span to avoid double-indirection of `.buffered` and to avoid use of `mutable.Queue` unless it is absolutely necessary. Rewrite of `span` and `dropWhile` to also avoid `.buffered` (less DRY but single vs. double indirection and object allocation). Performance improvements: ``` method reason =========== =============================================================== collect 2.3x faster on small collections, 1.5x on large span 1.6-1.7x faster on small collections 0.85x-1.8x slower/faster on large collections depending on how much must be cached (0.85x all, 1.8x none) dropWhile 1.2x faster on small collections, half the garbage ```
| * | Performance optimization - Iterator flatMap, find, indexWhere, indexOfRex Kerr2015-08-071-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tightened up bytecode, logic, and/or performance by using local return instead of a mutable variable in several methods. Performance/bytecode size improvements (smaller bytecode = better inlining) ``` method reason =========== =============================================================== flatMap hasNext bytecode 34 bytes down from 62 find bytecode 41 bytes instead of 53 indexWhere 1.5x faster on small collections (some contexts) indexOf bytecode 89 bytes instead of 110 ```
* | | Merge pull request #4713 from SethTisue/batch-of-typosJason Zaugg2015-09-086-8/+8
|\ \ \ | | | | | | | | fix typos/spelling
| * | | fix assorted typosSeth Tisue2015-08-286-8/+8
| | |/ | |/|
* | | Merge pull request #4722 from janekdb/2.11.x-scaladoc-in-context-AnyValDick Wall2015-09-062-2/+2
|\ \ \ | | | | | | | | Link to completed value classes SIP page instead of pending version
| * | | Link to completed value classes SIP page instead of pending versionJanek Bogucki2015-09-012-2/+2
| | | |
* | | | Merge pull request #4706 from VladUreche/issue/tree-checkerJason Zaugg2015-09-061-1/+8
|\ \ \ \ | | | | | | | | | | Re-enable tree checkers
| * | | | Re-enable tree checkersVlad Ureche2015-08-241-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | My expectation is that tree checkers are re-typechecking the trees and making sure they are consistent. Unfortunately, following patch aced32d05c97651534f468bc9a475ea5f6ae75b8, the call to clearType() was removed, thus the typer no longer recursed inside the trees, rendering the type checkers framework useless. This is an attempt to make the tree checkers run again, by resetting the type of a tree before the call to super.typed, thus allowing the typer to actually visit the entire tree (not just the outer package definition). The work was prompted by SI-9442, where the type checkers would gladly allow validate the inconsistent trees.
* | | | | Merge pull request #4704 from VladUreche/issue/9442Jason Zaugg2015-09-063-10/+55
|\ \ \ \ \ | | | | | | | | | | | | SI-9442 Fix the uncurry-erasure types
| * | | | | SI-9442 Fix the uncurry-erasure typesVlad Ureche2015-08-233-10/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using the "uncurry-erased" type (the one after the uncurry phase) can lead to incorrect tree transformations. For example, compiling: ``` def foo(c: Ctx)(l: c.Tree): Unit = { val l2: c.Tree = l } ``` Results in the following AST: ``` def foo(c: Ctx, l: Ctx#Tree): Unit = { val l$1: Ctx#Tree = l.asInstanceOf[Ctx#Tree] val l2: c.Tree = l$1 // no, not really, it's not. } ``` Of course, this is incorrect, since `l$1` has type `Ctx#Tree`, which is not a subtype of `c.Tree`. So what we need to do is to use the pre-uncurry type when creating `l$1`, which is `c.Tree` and is correct. Now, there are two additional problems: 1. when varargs and byname params are involved, the uncurry transformation desugares these special cases to actual typerefs, eg: ``` T* ~> Seq[T] (Scala-defined varargs) T* ~> Array[T] (Java-defined varargs) =>T ~> Function0[T] (by name params) ``` we use the DesugaredParameterType object (defined in scala.reflect.internal.transform.UnCurry) to redo this desugaring manually here 2. the type needs to be normalized, since `gen.mkCast` checks this (no HK here, just aliases have to be expanded before handing the type to `gen.mkAttributedCast`, which calls `gen.mkCast`)
* | | | | | Merge pull request #4726 from janekdb/2.11.x-now-Oracle-urlsSeth Tisue2015-09-037-7/+7
|\ \ \ \ \ \ | | | | | | | | | | | | | | Update Java and Sun URLs to replacement Java and Oracle URLs
| * | | | | | Update Java and Sun URLs to replacement Java and Oracle URLsJanek Bogucki2015-09-027-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For each URL - Where it redirected the target of the redirection was used - Where is no longer existed a replacement was selected
* | | | | | | Merge pull request #4715 from Ichoran/issue/9424Seth Tisue2015-09-021-2/+13
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | SI-9424 Clarify behavior of PriorityQueue toString
| * | | | | | SI-9424 Clarify behavior of PriorityQueue toStringRex Kerr2015-08-291-2/+13
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | Clarified that PriorityQueue will not print in order and gave an example of a workaround if one needs it. Documentation change only; no tests.
* | | | | | Merge pull request #4701 from janekdb/2.11.x-scaladoc-in-context-OptionSeth Tisue2015-09-021-1/+1
|\ \ \ \ \ \ | |_|_|_|/ / |/| | | | | Improve comment in Option.collect example
| * | | | | Improve implementation comments in Option.collect exampleJanek Bogucki2015-08-311-1/+1
| | |/ / / | |/| | |
* | | | | Merge pull request #4692 from JanBessai/Fix-SI-6636Adriaan Moors2015-08-312-0/+23
|\ \ \ \ \ | |_|/ / / |/| | | | SI-6636 Fix macro expansion in toolboxes
| * | | | SI-6636 Fix macro expansion in toolboxesJan Bessai2015-08-232-0/+23
| | | | |
* | | | | Merge pull request #4707 from fthomas/topic/pins-linkLukas Rytz2015-08-281-2/+3
|\ \ \ \ \ | | | | | | | | | | | | Add link to online version of Programming in Scala
| * | | | | Add link to online version of Programming in ScalaFrank S. Thomas2015-08-241-2/+3
| | |_|/ / | |/| | |
* | | | | Merge pull request #4710 from retronym/ticket/9450Seth Tisue2015-08-271-2/+4
|\ \ \ \ \ | | | | | | | | | | | | SI-9450 Fix triple quoted strings in REPL :power mode
| * | | | | SI-9450 Fix triple quoted strings in REPL :power modeJason Zaugg2015-08-271-2/+4
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some extra synthetic code generated under this mode failed to escape input before adding it to a literal string. It used to get away with this most of the time by triple quoting the literal. This commit reuses Scala string escaping logic buried in `Constant` to do this properly. Actually, the proper approach would be to build the synthetic code with trees and quasiquotes, and avoid the mess of stringly-genererated code. I threw in some defensive hygiene for the reference to `Nil` while I was in the neighbourhood.
* / / / / SI-8346 Re-established soundness of toSet (element type widening)Rex Kerr2015-08-265-5/+43
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | toSet needs to rebuild some child classes, but not others, as toSet is allowed to widen element types (which the invariant Set normally cannot do), and some sets rely upon their invariance. Thus, sets that rely upon their invariance now rebuild themselves into a generic set upon toSet, while those that do not just sit there. Note: there was a similar patch previously that fixed the same problem, but this is a reimplementation to circumvent license issues. Note: the newBuilder method was benchmarked as (surprisingly!) the most efficient way to create small sets, so it is used where sets may need to be rebuild.
* | | | Fix typo in the name of a private methodMichał Pociecha2015-08-231-5/+5
| | | | | | | | | | | | | | | | Since it's a private method, it's safe to just rename it.
* | | | Fix typos in spec, docs and commentsMichał Pociecha2015-08-2319-23/+23
| |/ / |/| |
* | | Merge pull request #4693 from scala/revert-3791-ticket/8346Seth Tisue2015-08-203-24/+6
|\ \ \ | | | | | | | | Revert "SI-8346 Rebuild invariant sets in #toSet, avoiding CCE"
| * | | Revert "SI-8346 Rebuild invariant sets in #toSet, avoiding CCE"Adriaan Moors2015-08-183-24/+6
| |/ /
* | | Merge pull request #4697 from martijnhoekstra/patch-3Seth Tisue2015-08-191-2/+2
|\ \ \ | | | | | | | | Fix documentation of Stream.filter introduced in 13f30c
| * | | Fix documentation of filter introduced in 13f30cmartijnhoekstra2015-08-191-2/+2
| |/ /
* / / Fix method name reference in Predef documentationJanek Bogucki2015-08-191-1/+1
|/ /
* | Merge pull request #4678 from stusmall/2.11.xLukas Rytz2015-08-101-0/+4
|\ \ | | | | | | Improved error message for "filename too long" build errors
| * | SI-3623 Improved error message for "filename too long" build errorsstusmall2015-08-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | When building on ecryptfs filenames can be limited to ~142 characters. This limit doesn't take long to hit and can leave the the user with a hard to diagnosis error message. Some legacy file systems will have similarly small limits. This just adds a hint that the error might be related to the underlying fs.
* | | Merge pull request #4688 from retronym/topic/typer-debug-implicitsLukas Rytz2015-08-102-3/+5
|\ \ \ | |_|/ |/| | Fix tracing of implicit search under -Ytyper-debug
| * | Fix tracing of implicit search under -Ytyper-debugJason Zaugg2015-08-062-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The log messages intented to chronicle implicit search were always being filtered out by virtue of the fact that the the tree passed to `printTyping` was already typed, (e.g. with an implicit MethodType.) This commit enabled printing in this case, although it still filters out trees that are deemed unfit for typer tracing, such as `()`. In the context of implicit search, this happens to filter out the noise of: ``` | | | [search #2] start `()`, searching for adaptation to pt=Unit => Foo[Int,Int] (silent: value <local Test> in Test) implicits disabled | | | [search #3] start `()`, searching for adaptation to pt=(=> Unit) => Foo[Int,Int] (silent: value <local Test> in Test) implicits disabled | | | \-> <error> ``` ... which I think is desirable. The motivation for this fix was to better display the interaction between implicit search and type inference. For instance: ``` class Foo[A, B] class Test { implicit val f: Foo[Int, String] = ??? def t[A, B](a: A)(implicit f: Foo[A, B]) = ??? t(1) } ``` ```` % scalac -Ytyper-debug sandbox/instantiate.scala ... | |-- t(1) BYVALmode-EXPRmode (site: value <local Test> in Test) | | |-- t BYVALmode-EXPRmode-FUNmode-POLYmode (silent: value <local Test> in Test) | | | [adapt] [A, B](a: A)(implicit f: Foo[A,B])Nothing adapted to [A, B](a: A)(implicit f: Foo[A,B])Nothing | | | \-> (a: A)(implicit f: Foo[A,B])Nothing | | |-- 1 BYVALmode-EXPRmode-POLYmode (site: value <local Test> in Test) | | | \-> Int(1) | | solving for (A: ?A, B: ?B) | | solving for (B: ?B) | | [search #1] start `[A, B](a: A)(implicit f: Foo[A,B])Nothing` inferring type B, searching for adaptation to pt=Foo[Int,B] (silent: value <local Test> in Test) implicits disabled | | [search #1] considering f | | [adapt] f adapted to => Foo[Int,String] based on pt Foo[Int,B] | | [search #1] solve tvars=?B, tvars.constr= >: String <: String | | solving for (B: ?B) | | [search #1] success inferred value of type Foo[Int,=?String] is SearchResult(Test.this.f, TreeTypeSubstituter(List(type B),List(String))) | | |-- [A, B](a: A)(implicit f: Foo[A,B])Nothing BYVALmode-EXPRmode (site: value <local Test> in Test) | | | \-> Nothing | | [adapt] [A, B](a: A)(implicit f: Foo[A,B])Nothing adapted to [A, B](a: A)(implicit f: Foo[A,B])Nothing | | \-> Nothing ```
* | | Merge pull request #4620 from lastland/patch-1Seth Tisue2015-08-071-1/+2
|\ \ \ | | | | | | | | Fix the bug in the example in scala.sys.process
| * | | Wait until the cat process is finished.Li Yao2015-08-071-1/+2
| | | |
| * | | Fix the bug in the example in scala.sys.processLi Yao2015-07-111-1/+1
| | | | | | | | | | | | There's no `!` method with argument type `ProcessIO`. I suppose this is intended to be `run`.
* | | | Merge pull request #4443 from adriaanm/abstractpromise-avoid-unsafeSeth Tisue2015-08-061-30/+7
|\ \ \ \ | | | | | | | | | | SI-8362: AbstractPromise extends AtomicReference, avoids sun.misc.Unsafe
| * | | | SI-8362: AbstractPromise extends AtomicReferenceMariot Chauvin2015-07-291-30/+7
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid `sun.misc.Unsafe`, which is not supported on Google App Engine. Deprecate `AbstractPromise` --> extend `j.u.c.atomic.AtomicReference` directly. `AtomicReference.compareAndSet()` should also provide better performance on HotSpot, which compiles it down to the machine's CAS instruction. The binary incompatible change is ok because it's in an internal package. I can't think of any real issue with adding a superclass (which contributes only final methods) to a class in an implementation package (as long as those methods were not introduced in any illicit subclasses of said class). Instead of changing `DefaultPromise`'s super class, let's be more conservative, and do it closest to the source. This is both clearer and more focussed, leaving those subclasses of AbstractPromise we never heard of unaffected. Genesis of the commit: since the work on `Future` performance, `AbstractPromise` is using `Unsafe`, breaking the ability for `Future` to be executed on GAE. At that time, viktorklang suggested to implement a fallback in case `Unsafe` is not available. carey proposed an implementation, and mchv submitted a patch, which was refined by adriaanm.
* | | | Merge pull request #4554 from som-snytt/issue/1931Seth Tisue2015-08-062-11/+23
|\ \ \ \ | | | | | | | | | | SI-1931 Hide Predef.any2stringadd in REPL
| * | | | SI-1931 Hide Predef.any2stringadd in REPLSom Snytt2015-07-062-11/+23
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | User imports that reference Predef are relocated to the top of the wrapping template so that they can hide implicits defined in Predef. Only one import from Predef is retained for special treatment. This is simple and sane. The test shows that `import Predef._` restores Predef implicits even if a user-defined term would normally be in scope. A smart `:import` command to turn off or quarantine imports explicitly would allow fine-grained control.
* | | | Merge pull request #4672 from janekdb/2.11.x-scaladoc-compilerSeth Tisue2015-08-0610-21/+21
|\ \ \ \ | | | | | | | | | | ScalaDoc fixes for compiler
| * | | | ScalaDoc fixes for compilerJanek Bogucki2015-07-2910-21/+21
| | |/ / | |/| |
* | | | Merge pull request #4675 from retronym/ticket/9425Seth Tisue2015-08-061-1/+2
|\ \ \ \ | | | | | | | | | | SI-9425 Leave Companion.apply if constructor is less accessible
| * | | | SI-9425 Leave Companion.apply if constructor is less accessibleJason Zaugg2015-07-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calls to synthetic case class apply methods are inlined to the underlying constructor invocation in refchecks. However, this can lead to accessibility errors if the constructor is private. This commit ensures that the constructor is at least as accessible as the apply method before performing this tranform. I've manually checked that other the optimization still works in other cases: scala> class CaseApply { Some(42) } defined class CaseApply scala> :javap -c CaseApply Compiled from "<console>" public class CaseApply { public CaseApply(); Code: 0: aload_0 1: invokespecial #9 // Method java/lang/Object."<init>":()V 4: new #11 // class scala/Some 7: dup 8: bipush 42 10: invokestatic #17 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer; 13: invokespecial #20 // Method scala/Some."<init>":(Ljava/lang/Object;)V 16: pop 17: return }
* | | | | Merge pull request #4684 from janekdb/2.11.x-unit-return-in-mapSeth Tisue2015-08-061-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Stop mapping to Unit when executing finally code.