summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #4374 from retronym/ticket/9200Lukas Rytz2015-03-261-2/+2
|\ | | | | SI-9200 Fix Java generic signatures for refined types
| * SI-9200 Fix Java generic signatures for refined typesJason Zaugg2015-03-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The erasure of a refined type `T1 with T2 ... Tn` is the erasure of the intersection dominator of the elements. In addition to erased method signatures, the compiler also emits Java generic signatures, included information about generic types, up to the point that it is possible to express in the language of Java 5 generics. Java generic signatures must be consistent with erasued signatures, that is, the Java compiler must erase that generic signature to the same erased signature. If this does not hold, linkage errors will occur. The compiler implements erasure in `ErasureMap` and java generic signatures in `Erasure#javaSig`. Regrettably, these don't share any implementation; e.g `javaSig` only takes the first parent of a refinement type, rather than using `intersectionDominator`. This commit fixes that discrepency.
* | Merge pull request #4396 from retronym/ticket/9074-2.12Lukas Rytz2015-03-245-23/+9
|\ \ | | | | | | SI-9074 Fix generic substitution with package objects, overloading
| * | SI-9074 Fix generic substitution with package objects, overloadingJason Zaugg2015-03-245-23/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Takes a leaf out of dotty's book [1] and makes `asSeenFrom` transparently change the prefix from the package class to the package object when needed. This fixes generic subsitution during overload resolution, as reported in SI-9074. This subsumes the former fix for SI-6225, which is removed here. [1] https://github.com/lampepfl/dotty/pull/282
* | | Merge pull request #4352 from som-snytt/issue/9167-2.12Jason Zaugg2015-03-241-28/+22
|\ \ \ | |/ / |/| | SI-9167 Clarify ScalaVersion parsing
| * | SI-9167 Clarify ScalaVersion parsingSom Snytt2015-02-201-28/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Probably it was unintended to accept "2.." and "2.-11.7". This commit makes it a bit more regular and also accepts arbitrary text after the dash in the build string, including newlines. Since the number parts must be numbers, accept only digits. That also disallows "2.+11.7", which could be misconstrued as some sort of range. As before, the special build string prefixes "rc" and "m" are case-insensitive, but "FINAL" is not.
* | | Merge pull request #4302 from som-snytt/issue/deprecate-named-paramLukas Rytz2015-03-234-50/+62
|\ \ \ | | | | | | | | SI-9140 Allow deprecating current parameter name
| * | | SI-9140 Minor refactor for readabilitySom Snytt2015-02-091-58/+56
| | | | | | | | | | | | | | | | Make a couple of functions and use cases for if-else if-else etc.
| * | | SI-9140 Allow omitting pleonastic parameter nameSom Snytt2015-02-093-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable simply: ``` scala> def f(@deprecatedName foo: String) = foo.reverse f: (foo: String)String scala> f(foo = "bar") <console>:9: warning: naming parameter foo has been deprecated. f(foo = "bar") ^ res0: String = rab ``` `Symbol.deprecatedParamName` conventionally returns `NO_NAME` when the name is omitted.
| * | | SI-9140 Allow deprecating current parameter nameSom Snytt2015-02-082-9/+17
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow deprecatedName to specify the name of the parameter it qualifies. This tells the user, That's my name, don't wear it out. I.e., don't use my name when calling me. Use cases include: the name will change; normally a name should be provided for a boolean, but not in this case (perhaps because there is only one argument). ``` scala> def f(@deprecatedName('foo) bar: String) = bar.reverse f: (bar: String)String scala> f(foo = "hello") <console>:9: warning: the parameter name foo has been deprecated. Use bar instead. f(foo = "hello") ^ res0: String = olleh scala> def g(@deprecatedName('foo) foo: String) = foo.reverse g: (foo: String)String scala> g(foo = "hello") <console>:9: warning: naming parameter foo has been deprecated. g(foo = "hello") ^ res1: String = olleh ```
* | | Merge pull request #4301 from som-snytt/issue/8918-deferredLukas Rytz2015-03-231-5/+17
|\ \ \ | | | | | | | | SI-8918 Unary ids are plain ids
| * | | SI-8918 Unary ids are plain idsSom Snytt2015-02-081-5/+17
| |/ / | | | | | | | | | | | | | | | | | | | | | Allow +,-,!,~ to be used as unprefixed identifiers. As prefix operators, they must be followed by a simple expression, so otherwise, consume the id itself as the start of a simple expression.
* | | Merge pull request #4300 from CodeMettle/FiniteDuration.toCoarsestLukas Rytz2015-03-231-1/+1
|\ \ \ | | | | | | | | Declare FiniteDuration.toCoarsest to return a FiniteDuration
| * | | Declare FiniteDuration.toCoarsest to return a FiniteDurationSteven Scott2015-02-061-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | FiniteDuration.toCoarsest is declared with a return type of Duration even though it can only ever return a FiniteDuration. Change the declaration to return a FiniteDuration so that using this method doesn't require a cast or pattern match on the result in cases where a FiniteDuration is required.
* | | Merge pull request #4372 from som-snytt/issue/7775-tweakLukas Rytz2015-03-234-6/+15
|\ \ \ | | | | | | | | SI-7775 Exclude nulls when iterating sys props
| * | | SI-7775 Exclude nulls when iterating sys propsSom Snytt2015-03-024-6/+15
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous fix to deal with concurrent modification of system properties doesn't handle null results introduced when a property is removed. This commit filters nulls for safety, and also adds a `names` method to `sys.SystemProperties`. The test is upgraded.
* | | Merge pull request #4241 from kanielc/SI-6778Lukas Rytz2015-03-231-1/+1
|\ \ \ | | | | | | | | SI-6778 scala.math.random should have parenthesis
| * | | SI-6778 scala.math.random should have parenthesisDenton Cockburn2015-01-101-1/+1
| | | |
* | | | SI-7784 Allow a singleton type over a constant value defn.Jason Zaugg2015-02-281-1/+1
| |_|/ |/| | | | | | | | | | | | | | When typechecking a `SingletonTypeTree`, we must `deconst` the type of the typechecked reference tree to avoid collapsing `a.type` into a constant type if `a` is a constant value definition.
* | | Merge pull request #4284 from ms-tg/SI-8990-rebase-on-2.12-squashedAdriaan Moors2015-02-231-52/+27
|\ \ \ | | | | | | | | SI-8990 Fix lazy evaluation of StreamWithFilter#foreach
| * | | SI-8990 Allow GC during lazy evaluation of Stream#withFilterMarc Siegel2015-02-201-52/+27
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The fact that StreamWithFilter was an inner class prevented collection of the head during processing after #withFilter, due to the reference to the outer class instance held in self. - By implementing StreamWithFilter outside of the Stream class, we gain control of the reference to the original Stream. - We clarify explicit "filter after first use" semantics for the reference to the original stream, which allows it to be GC'd during the processing of foreach, map, and flatMap. - Code is more DRY by implementing in terms of Stream#filter, which is already correctly lazy, and then Stream's #map, #flatMap, and #foreach, which already correctly allow GC. - Unfortunately, the type returned by Stream#withFilter *must* change, as it had previously inherited from the inner class TraversableLike#WithFilter, which is where the problematic reference to the outer class instance was held. Therefore, this change is targetted to 2.12.x. There doesn't appear to be any way to fix this without changing the type, sadly. - Special thanks to @paulp who suggested the likely cause of the issue at nescala 2015, and got me setup to build and run tests. Also thanks to @Ichoran and @retronym, who suggested that filter-after-first-use would preserve the reusable nature of the return value from #withFilter, rather than a single-shot null-after-first-use solution. Review by @Ichoran and @retronym Fixes #8990
* | | Merge pull request #4343 from adriaanm/reword-4267Adriaan Moors2015-02-232-36/+55
|\ \ \ | | | | | | | | SI-9113 Converting `null` collection Java<->Scala yields `null`
| * | | SI-9113 Converting `null` collection Java<->Scala yields `null`Roman Hargrave2015-02-182-36/+55
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `scala.collection.{JavaConversions, JavaConverters}` no longer wrap a `null` collection, but return `null` instead. Before, a wrapper would hold the original `null` collections, delaying the NPE until the first operation on the collection was called, with no way of knowing whether we were holding such a time bomb wrapper until the NPE was thrown. For example, this now holds: `(null : java.util.Iterator[_]).asScala == null`. Before, a wrapper would silently be created that would NPE on any further interaction. An example of this issue in the wild can be seen at https://github.com/scalafx/scalafx/issues/178, and an example of code that generates such a wrapper [before the issue was fixed](https://github.com/scalafx/scalafx/blob/ad60d5faee687b71d3c0474510d 3f3dd081ea351/scalafx/src/main/scala/scalafx/stage/FileChooser.scala#L138).
* | | Merge pull request #4323 from axel22/t-concurrent-map-get-2.12.xAdriaan Moors2015-02-231-0/+11
|\ \ \ | | | | | | | | Fix SI-9147 Override `getOrElseUpdate` in `concurrent.Map`.
| * | | Fix SI-9147 Override `getOrElseUpdate` in `concurrent.Map`.Aleksandar Prokopec2015-02-121-0/+11
| |/ / | | | | | | | | | Also, add a ScalaCheck test.
* / / SI-9131 Fix use of apply syntactic sugar with by-name paramJason Zaugg2015-02-032-18/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After typechecking a tree, the typer adapts it to the current mode and expected type. If we are in FUNmode (typechecking the qualifier of a value- or type-application), and the tree does not already have a MethodType or PolyType, it is reinterepreted as `qual.apply`. In doing so, `insertApply` stabilizes the type of `qual`, e.g. replacing `Ident(foo).setType(typeOf[Int])` with `Ident(foo).setType(typeOf[foo.type])`. However, this does not check for by-name parameters, which cannot form the basis for a singleton type, as we can see by trying that directly: ``` scala> def foo(a: => String) { type T = a.type } <console>:7: error: stable identifier required, but a.type found. def foo(a: => String) { type T = a.type } ^ ``` When I last touched this code in SI-6206 / 267650cf9, I noted: // TODO reconcile the overlap between Typers#stablize and TreeGen.stabilize I didn't get around to that, but Adriaan gave that code a thorough cleanup in fada1ef6b. It appears that on the back of his work, we can now remove the local stabilization logic in `insertApply` in favour of `TreeGen.stabilize`. We then avoid the ill-formed singleton type, and the spurious "apply is not a member" type error. I did have to modify `isStableIdent` to check the symbol's info in addition to the tree's type for by-name-ness.
* | Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2015-01-29134-503/+943
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20150129 Conflicts: build.number src/library/scala/concurrent/Future.scala versions.properties
| * | Add an IntelliJ module for the Pax Exam based OSGi testsJason Zaugg2015-01-282-0/+24
| | | | | | | | | | | | We can now edit these in IntelliJ, as per the regular JUnit tests.
| * | Merge pull request #4214 from som-snytt/issue/5154Jason Zaugg2015-01-221-4/+3
| |\ \ | | | | | | | | SI-5154 Parse leading literal brace in XML pattern
| | * | SI-5154 Parse leading literal brace in XML patternSom Snytt2014-12-161-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't consume literal brace as Scala pattern. Previously, leading space would let the text parser `xText` handle it correctly instead.
| * | | Merge pull request #4190 from kanielc/SI-5817Jason Zaugg2015-01-222-0/+20
| |\ \ \ | | | | | | | | | | SI-5817: Add header to language.scala and languageFeature.scala
| | * | | SI-5817: Add header to language.scala and languageFeature.scalaDenton Cockburn2014-12-052-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These two files were missing headers. There is other work on-going to automate updating of the headers, but that likely won't crossover with this.
| * | | | Merge pull request #4253 from retronym/ticket/9087Grzegorz Kossakowski2015-01-201-0/+5
| |\ \ \ \ | | | | | | | | | | | | SI-9087 Fix min/max of reversed Double/Float orderings
| | * | | | SI-9087 Fix min/max of reversed Double/Float orderingsJason Zaugg2015-01-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As diagnosed by the reporter, we needed additional overrides due to the way these orderings are implemented. I've added tests to show other methods and other orderings are working correctly. After writing that, I found a scalacheck test related to NaN handling that also covers `Ordering`. I had to correct the assertion in the tests of `reverse.{min,max}`.
| * | | | | Address review feedbackLukas Rytz2015-01-164-19/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Rename CodeRepository to ByteCodeRepository - Scaladoc on OptimizerReporting - Scaladoc on ByteCodeRepository
| * | | | | Construct ClassBTypes from parsed classfilesLukas Rytz2015-01-168-80/+306
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This infrastructure is required for the inliner: when inlining code from a classfile, the corresponding ClassBType is needed for various things (eg access checks, InnerClass attribute). The test creates two ClassBTypes for the same class: once using the (unpickled) Symbol, once using the parsed ASM ClassNode, and verifies that the two are the same. There's a cleanup to the InnerClass attribute: object T { class Member; def foo = { class Local } } class T For Java compatibility the InnerClass entry for Member says the class is nested in T (not in the module class T$). We now make sure to add that entry only to T, not to T$ (unless Member is actually referenced in the classfile T$, in that case it will be added, as required).
| * | | | | Cleanup asm-to-string debug helpersLukas Rytz2015-01-161-14/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces methods for textifying classes, methods, InsnLists and individual AbstractInsnNodes.
| * | | | | Remove an unnecessary hash map in BTypesFromSymbolsLukas Rytz2015-01-161-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's already the map classBTypeFromInternalNameMap in BTypes which stores all ClassBTypes.
| * | | | | Type alias for InternalNameLukas Rytz2015-01-162-5/+17
| | | | | |
| * | | | | Make ClassBType independent of the name tableLukas Rytz2015-01-163-60/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each ClassBType is identified by its internalName, the fully qualified JVM class name. Before this change, the name was stored in the `chrs` array of the compiler name table (hash consed), with the idea to avoid materializing the string. However, we materialize the string anyway, because each ClassBType is stored in the classBTypeFromInternalNameMap, indexed by the string. If string equality turns out to be too slow we can use interning. For the inliner, we read classes from bytecode and create ClassBTypes for them. The names of these classes would not yet exist in the name table, so the backend would need to be able to create new names. Using Strings removes this dependency.
| * | | | | Merge pull request #4249 from retronym/ticket/9089Vlad Ureche2015-01-161-1/+0
| |\ \ \ \ \ | | |/ / / / | |/| | | | SI-9089 Another REPL/FSC + specialization bug fix
| | * | | | SI-9089 Another REPL/FSC + specialization bug fixJason Zaugg2015-01-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The enclosed test case stopped working in 2.11.5 on the back of https://github.com/scala/scala/pull/4040. The key change was that we ran all post-typer info transformers on each run of the compiler, rather than trying to reuse the results of the previous run. In that patch, I noticed one place [1] in specialization that aggressively entered specialized members into the owning scope, rather than relying on `transformInfo` to place the new members in the scope of the newly created element of the info history. I made that change after noticing that this code could actually mutated scopes of specializaed types at the parser phase, which led to fairly obscure failures. This bug is another one of these obscure failures, and has the same root cause. We effectively "double specialiaze" Function0, which trips an assertion when `method apply$mcI$sp` is found twice in a scope. I have found another spot that was directly manipulating the scope, and removed the offending code. [1] https://github.com/scala/scala/pull/4040#commitcomment-8531516
| * | | | | Merge pull request #4201 from mpociecha/fix-typos-in-docs-and-commentsGrzegorz Kossakowski2015-01-14112-196/+196
| |\ \ \ \ \ | | | | | | | | | | | | | | Fix many typos in docs and comments
| | * | | | | Fix many typos in docs and commentsmpociecha2014-12-14113-197/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit corrects many typos found in scaladocs, comments and documentation. It should reduce a bit number of PRs which fix one typo. There are no changes in the 'real' code except one corrected name of a JUnit test method and some error messages in exceptions. In the case of typos in other method or field names etc., I just skipped them. Obviously this commit doesn't fix all existing typos. I just generated in IntelliJ the list of potential typos and looked through it quickly.
| * | | | | | Merge pull request #4234 from JanBessai/ShowCodeEscapeFixGrzegorz Kossakowski2015-01-141-1/+2
| |\ \ \ \ \ \ | | |_|/ / / / | |/| | | | | SI-9057 - fix `showCode` to put backticks around names including dots
| | * | | | | SI-9057 - fix `showCode` to put backticks around names including dotsJan Bessai2015-01-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Missing backticks cause the parser to treat names as paths, which is obviously invalid. A unit test is included.
| * | | | | | Merge pull request #4200 from er1c/typoJason Zaugg2015-01-091-1/+1
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix scaladoc OutpuStream typo
| | * | | | | | Fix scaladoc OutpuStream typoEric Peters2014-12-121-1/+1
| | | |/ / / / | | |/| | | |
| * | | | | | Merge pull request #4229 from ↵Grzegorz Kossakowski2015-01-081-1/+2
| |\ \ \ \ \ \ | | |_|/ / / / | |/| | | | | | | | | | | | | | | | | | | Kornel/feature/SI-9067-enumeration-with-name-improvement SI-9067: Enumeration withName improvement
| | * | | | | SI-9067: Enumeration withName improvementKornel Kielczewski2015-01-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Enumeration#withName in case of a failed approach to resolve the Enumeration value fails with a meaningless NoSuchElementException. Would be nice to know what exactly is not found