summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #4709 from adriaanm/namers-accessorsJason Zaugg2015-09-085-80/+99
|\ | | | | Streamline logic related to accessor derivation in MethodSynthesis & Namers
| * Review feedback from retronymAdriaan Moors2015-09-021-2/+3
| |
| * Simplify decision whether to derive accessorsAdriaan Moors2015-09-023-27/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally (modulo renaming & reduction of double negation in previous commit): ``` def deriveAccessors(vd: ValDef) = vd.mods.isLazy || !( !owner.isClass || (vd.mods.isPrivateLocal && !vd.mods.isCaseAccessor) // this is an error -- now checking first || (vd.name startsWith nme.OUTER) || (context.unit.isJava) // pulled out to caller || isEnumConstant(vd) ) def deriveAccessorTrees(vd: ValDef) = !( (vd.mods.isPrivateLocal && !vd.mods.isLazy) // lazy was pulled out to outer disjunction || vd.symbol.isModuleVar // pulled out to caller || isEnumConstant(vd)) ``` With changes in comments above, these conditions are now captured by one method.
| * Streamline MethodSynthesis & NamersAdriaan Moors2015-09-024-58/+84
| | | | | | | | | | | | | | | | | | Give Getter control over whether a setter is needed. For now, only mutable ValDefs entail setters. In the new trait encoding, a trait val will also receive a setter from the start. Similarly, distinguish whether to derive a field from deferredness of the val. (Later, fields will not be emitted for traits, deferred or not.)
* | Merge pull request #4671 from lrytz/t9375-easyJason Zaugg2015-09-089-24/+346
|\ \ | | | | | | SI-9375 add synthetic readResolve only for static modules
| * | SI-9375 add synthetic readResolve only for static modulesLukas Rytz2015-07-307-7/+338
| | | | | | | | | | | | | | | | | | | | | | | | | | | For inner modules, the synthetic readResolve method would cause the module constructor to be invoked on de-serialization in certain situations. See the discussion in the ticket. Adds a comprehensive test around serializing and de-serializing modules.
| * | Cleanup in RefchecksLukas Rytz2015-07-243-17/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For historical reasons, when eliminating ModuleDef trees, RefChecks would check if moduleVar field already exists, and only create it if not. In reality, the lookup would always fail. When initially committed, the moduleVar could be created either by the RefChecks transformer or info transformer, see 256aca6. This was later changed (3f1f0a4), after which RefChecks only creates a moduleVar when eliminating a ModuleDef.
* | | Merge pull request #4673 from puffnfresh/issue/6806Jason Zaugg2015-09-0814-47/+146
|\ \ \ | | | | | | | | SI-6806 Add an @implicitAmbiguous annotation
| * | | SI-6806 Add an @implicitAmbiguous annotationBrian McKenna2015-08-1114-47/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example usage: trait =!=[C, D] implicit def neq[E, F] : E =!= F = null @annotation.implicitAmbiguous("Could not prove ${J} =!= ${J}") implicit def neqAmbig1[G, H, J] : J =!= J = null implicit def neqAmbig2[I] : I =!= I = null implicitly[Int =!= Int] Which gives the following error: implicit-ambiguous.scala:9: error: Could not prove Int =!= Int implicitly[Int =!= Int] ^ Better than what was previously given: implicit-ambiguous.scala:9: error: ambiguous implicit values: both method neqAmbig1 in object Test of type [G, H, J]=> Main.$anon.Test.=!=[J,J] and method neqAmbig2 in object Test of type [I]=> Main.$anon.Test.=!=[I,I] match expected type Main.$anon.Test.=!=[Int,Int] implicitly[Int =!= Int] ^
* | | | Merge pull request #4718 from Ichoran/issue/9379Seth Tisue2015-09-023-0/+20
|\ \ \ \ | |_|_|/ |/| | | SI-9379 Added toString to .zipped to allow Stream etc to short-circuit
| * | | SI-9379 Added toString to .zipped to allow Stream etc to short-circuitRex Kerr2015-08-303-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | Tuple2Zipped and Tuple3Zipped would try to compute a hash code when .toString was called on them. This overrides toString to print (collection1, collection2).zipped instead, using the collection's own toString method. This allows collections that have a toString but not a hashCode (such as Iterator.from(0) and s = 1 #:: s) to print out as they usually do. JUnit test to verify the deferral to collections' .toString.
* | | | Merge pull request #4691 from ↵Adriaan Moors2015-08-312-4/+59
|\ \ \ \ | |/ / / |/| | | | | | | | | | | nicolasstucki/2.12.x-ScalaRunntime-fix-for-Scala.js Remove unnecessary dependency on parallel collections in ScalaRunTime.
| * | | Remove unnecessary dependency on parallel collections in ScalaRunTime.Nicolas Stucki2015-08-202-4/+59
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In method `ScalaRuntime.stringOf(arg: Any, maxElements: Int)` there are `case x: Iterable[_]` and `case x: ParIterable[_]` which have the excat same code that only uses the `GenIterable[_]` API on `x`. Therfore they can be replaced by a single `case x: GenIterable[_]`. The `case x: ParIterable[_]` was added because prevoiusly parallel colections would only match `case x = x.toSting()` which ignores the `maxElements` parameter. This was still the case for other `GenIterable[_]`. Using `case x: GenIterable[_]` will cover those cases as well. This change is required for Scala.js compatibility as it does not support parallel collections.
* | | Merge pull request #4712 from SethTisue/so-long-sun-misc-unsafeSeth Tisue2015-08-281-38/+0
|\ \ \ | | | | | | | | SI-9381 remove last vestiges of sun.misc.Unsafe
| * | | SI-9381 remove last vestiges of sun.misc.UnsafeSeth Tisue2015-08-271-38/+0
|/ / / | | | | | | | | | now that Akka 2.4 doesn't need it anymore
* | | Merge pull request #4708 from adriaanm/defaults-uncurry-constmethAdriaan Moors2015-08-242-100/+96
|\ \ \ | | | | | | | | Uncurry handles Literal RHS for ConstantType def, not Constructors
| * | | Uncurry does Literal RHS for ConstantType def, not ConstructorsAdriaan Moors2015-08-242-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Uncurry seems more logical to me. Ideally, Erasure would erase ConstantTypes, since they do not exist in bytecode. In any case, doing this earlier, when we're rewriting method anyway, simplifies constructors, which should be focussing on, well, constructors (& fields).
| * | | Clean up Constructors a bit.Adriaan Moors2015-08-241-96/+90
|/ / / | | | | | | | | | | | | | | | | | | Shouldn't change behavior, sets stage for moving the transform of ConstantType methods to Uncurry. Constructors still needs a much more thorough overhaul...
* | | Merge pull request #4590 from som-snytt/issue/6810Lukas Rytz2015-08-245-27/+89
|\ \ \ | | | | | | | | SI-6810 Disallow EOL in char literal
| * | | SI-6810 Spec reflects literal parsing literallySom Snytt2015-06-292-24/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Emphasize that literal parsing accepts Unicode escapes as if they were escaped. In particular, a newline represented by its Unicode escape does not terminate the line in the middle of a literal.
| * | | SI-6810 Test for CRSom Snytt2015-06-292-3/+13
| | | |
| * | | SI-6810 Disallow EOL in char literalSom Snytt2015-06-293-3/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's clear that char literals are one-lined like normal string literals. By the same token, pun intended, char literals accept unicode escapes the same as string literals, including `\u000A`. This commit adds the usual exclusions (CR, NL, SU). The spec is outdated in outlawing chars that are not "printable", in particular, the ASCII control codes. The original intention may have been that the ordinary string escapes are required, such as "\b\n". Note that some common escapes are absent, such as "\a".
* | | | Merge pull request #4700 from SethTisue/merge-2.11.x-aug-20Lukas Rytz2015-08-2446-176/+198
|\ \ \ \ | | | | | | | | | | Merge 2.11.x aug 20 [ci: last-only]
| * | | | Merge remote-tracking branch 'origin/2.11.x' into 2.12.xSeth Tisue2015-08-2046-176/+198
|/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | all conflicts were because the changes changed code that doesn't exist anymore in 2.12; they were resolved with `git checkout --ours` c201eac changed bincompat-forward.whitelist.conf but I dropped the change in this merge because it refers to AbstractPromise which no longer exists in 2.12
| * | | | Merge pull request #4693 from scala/revert-3791-ticket/8346Seth Tisue2015-08-205-64/+6
| |\ \ \ \ | | | | | | | | | | | | Revert "SI-8346 Rebuild invariant sets in #toSet, avoiding CCE"
| | * | | | Revert "SI-8346 Rebuild invariant sets in #toSet, avoiding CCE"Adriaan Moors2015-08-185-64/+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
| | |/ / / /
| * | | | | Merge pull request #4695 from janekdb/2.11.x-scaladoc-PredefSeth Tisue2015-08-191-1/+1
| |\ \ \ \ \ | | |/ / / / | |/| | | | Fix method name reference in Predef documentation
| | * | | | 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-063-30/+25
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-8362: AbstractPromise extends AtomicReference, avoids sun.misc.Unsafe
| | * | | | | | | SI-8362: AbstractPromise extends AtomicReferenceMariot Chauvin2015-07-293-30/+25
| | | |_|/ / / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0624-84/+139
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-1931 Hide Predef.any2stringadd in REPL
| | * | | | | | | SI-1931 Hide Predef.any2stringadd in REPLSom Snytt2015-07-0624-84/+139
| | | |/ / / / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-062-1/+10
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-9425 Leave Companion.apply if constructor is less accessible
| | * | | | | | | SI-9425 Leave Companion.apply if constructor is less accessibleJason Zaugg2015-07-312-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | | | Stop mapping to Unit when executing finally code.Janek Bogucki2015-08-051-1/+1
| | | |_|_|/ / / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | Finally.invoke has result type Unit so foreach is sufficient here.
| * | | | | | | | Merge pull request #4685 from janekdb/2.11.x-length-not-sizeSeth Tisue2015-08-061-2/+2
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Avoid unnecessary implicit view on String
| | * | | | | | | | Avoid unnecessary implicit view on StringJanek Bogucki2015-08-051-2/+2
| | |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using length instead of size on String to avoid a conversion call. This dump confirms there is a conversion to StringOps when using size. object StringSize { val s = "hi" println(s.size) } $ scalac -Xprint:typer StringSize.scala [[syntax trees at end of typer]] // StringSize.scala package <empty> { object StringSize extends scala.AnyRef { def <init>(): StringSize.type = { StringSize.super.<init>(); () }; private[this] val s: String = "hi"; <stable> <accessor> def s: String = StringSize.this.s; scala.this.Predef.println(scala.this.Predef.augmentString(StringSize.this.s).size) } }
* | | | | | | | | Merge pull request #4690 from retronym/topic/defaultpromiseJason Zaugg2015-08-181-6/+8
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Unfinalize the class DefaultPromise