summaryrefslogtreecommitdiff
path: root/src/compiler/scala
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | Merge pull request #5662 from teldosas/SI-9675Adriaan Moors2017-02-161-1/+1
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-9675 warn about non-sensible equals in anonymous functions
| | * | | | | | Add warning about non-sensible equals in anonymous functionsteldosas2017-02-011-1/+1
| | | |/ / / / | | |/| | | |
| * | | | | | Merge pull request #5587 from lrytz/t10072Adriaan Moors2017-02-161-4/+0
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-10072 cast Function nodes to environment in specialization
| | * | | | | | SI-10072 cast Function nodes to environment in specializationLukas Rytz2016-12-071-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit basically make sure the fix for SI-5284 works correctly when a Function node reaches specialization (`-Ydealmbdafy:method` and IndyLambda are default in 2.12.x). To understand it, best read the excellent description in b29c01b. The code that's removed in this commit was added in 13ea590. It prevented `castType` from being invoked on the `Function` node, which is exactly what is needed here. It's also what happens under `-Ydelambdafy:inline`, the `new anonfun()` tree is being casted from `(Int, Int) => Int` to `(Int, A) => Int`.
| * | | | | | | Merge pull request #5542 from retronym/ticket/10066Adriaan Moors2017-02-161-5/+18
| |\ \ \ \ \ \ \ | | |_|_|_|_|_|/ | |/| | | | | | SI-10066 Fix crash in erroneous code with implicits, dynamic
| | * | | | | | SI-10066 Fix crash in erroneous code with implicits, dynamicJason Zaugg2016-11-181-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The compiler support in the typechecker for `scala.Dynamic` is very particular about the `Context` in which it is typechecked. It looks at the `tree` in the enclosing context to find the expression immediately enclosing the dynamic selection. See the logic in `dyna::mkInvoke` for the details. This commit substitutes the result of `resetAttrs` into the tree of the typer context before continuing with typechecking.
* | | | | | | | Merge commit '0965028809' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-162-18/+22
|\ \ \ \ \ \ \ \
| * | | | | | | | SI-1459 two bridges for impl of java generic vararg methodAdriaan Moors2017-01-242-18/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A Scala method that implements a generic, Java-defined varargs method, needs two bridges: - to convert the collections for the repeated parameters (VBRIDGE) - to bridge the generics gap (BRIDGE) Refchecks emits the varargs "bridges", and erasure takes care of the other gap. Because a VBRIDGE was also an ARTIFACT, it was wrongly considered inert with respect to erasure, because `OverridingPairs` by default excluded artifacts. Removed the artifact flag from those VBRIDGES, so that they qualify for a real bridge. It would also work to include VBRIDGE methods that are artifacts in BridgesCursor.
| * | | | | | | | Merge pull request #5630 from adriaanm/rebase-5557Adriaan Moors2017-01-102-62/+62
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | [backport] SI-10071 SI-8786 varargs methods
| | * | | | | | | | SI-10071 Separate compilation for varargs methodsIulian Dragos2017-01-092-64/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure that methods annotated with varargs are properly mixed-in. This commit splits the transformation into an info transformer (that works on all symbols, whether they come from source or binary) and a tree transformer. The gist of this is that the symbol-creation part of the code was moved to the UnCurry info transformer, while tree operations remained in the tree transformer. The newly created symbol is attached to the original method so that the tree transformer can still retrieve the symbol. A few fall outs: - I removed a local map that was identical to TypeParamsVarargsAttachment - moved the said attachment to StdAttachments so it’s visible between reflect.internal and nsc.transform - a couple more comments in UnCurry to honour the boy-scout rule
| | * | | | | | | | SI-8786 fix generic signature for @varargs forwarder methodsLukas Rytz2017-01-092-52/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When generating a varargs forwarder for def foo[T](a: T*) the parameter type of the forwarder needs to be Array[Object]. If we generate Array[T] in UnCurry, that would be erased to plain Object, and the method would not be a valid varargs. Unfortunately, setting the parameter type to Array[Object] lead to an invalid generic signature - the generic signature should reflect the real signature. This change adds an attachment to the parameter symbol in the varargs forwarder method and special-cases signature generation. Also cleans up the code to produce the varargs forwarder. For example, type parameter and parameter symbols in the forwarder's method type were not clones, but the same symbols from the original method were re-used. Backported from 0d2760dce189cdcb363e54868381175af4b2646f, with a small tweak (checkVarargs) to make the test work on Java 6, as well as later versions.
* | | | | | | | | | Merge commit '36967321c7' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-162-5/+5
|\| | | | | | | | |
| * | | | | | | | | SI-9331 Fix canEqual for case classes with HK type paramsJason Zaugg2017-01-092-5/+5
| |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Time for the courage of our convictions: follow the advice of my TODO comment from SI-8244 / f62e280825 and fix `classExistentialType` once and for all. This is the change in the generated `canEquals` method in the test case; we no longer get a kind conformance error. ``` --- sandbox/old.log 2015-05-27 14:31:27.000000000 +1000 +++ sandbox/new.log 2015-05-27 14:31:29.000000000 +1000 @@ -15,7 +15,7 @@ case _ => throw new IndexOutOfBoundsException(x$1.toString()) }; override <synthetic> def productIterator: Iterator[Any] = runtime.this.ScalaRunTime.typedProductIterator[Any](Stuff.this); - <synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[Proxy[PP]]](); + <synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[_ <: [PP]Proxy[PP]]](); override <synthetic> def hashCode(): Int = ScalaRunTime.this._hashCode(Stuff.this); override <synthetic> def toString(): String = ScalaRunTime.this._toString(Stuff.this); override <synthetic> def equals(x$1: Any): Boolean = x$1 match { @@ -38,9 +38,3 @@ } } ``` I also heeded my own advice to pass in a prefix to this method.
| * | | | | | | | SI-9630 Fix spurious warning related to same-named case accessors [backport]Jason Zaugg2016-12-212-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hash consing of trees within pattern match analysis was broken, and considered `x1.foo#1` to be the same tree as `x1.foo#2`, even though the two `foo`-s referred to different symbols. The hash consing was based on `Tree#correspondsStructure`, but the predicate in that function cannot veto correspondance, it can only supplement the default structural comparison. I've instead created a custom tree comparison method for use in the pattern matcher that handles the tree shapes that we use. (cherry picked from commit 79a52e6807d2797dee12bab1730765441a0e222d)
| * | | | | | | | More robust outer test for patmatAdriaan Moors2016-12-211-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While investigating https://github.com/scala/scala-dev/issues/251
* | | | | | | | | Merge commit '014ebc4' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-162-15/+19
|\| | | | | | | | | |/ / / / / / / |/| | | | | | |
| * | | | | | | Small cleanups to pattern matcherAdriaan Moors2016-12-212-15/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While investigating https://github.com/scala/scala-dev/issues/251
* | | | | | | | Merge pull request #5654 from retronym/ticket/10154Adriaan Moors2017-02-141-1/+2
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-10154 Fix implicit search regression for term-owned objects
| * | | | | | | | SI-10154 Fix implicit search regression for term-owned objectsJason Zaugg2017-01-201-1/+2
| | |_|_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A recent change to fix lookup of companion implicits of term-owned classes (#5550) caused a regression in the enclosed test case. The previous approach of calling `Scope#lookup(companionName)` was replaced by a lookup of the scope entry of the original name followed by a narrower search lookup for the companion name, to ensure that it was a true companion, and not just a same-named module from defined at a different nested scope. However, module class symbols are not themselves entered into scopes, so the first part of the new scheme fails. We need to add a special case modules here. I've chosen to just call `.sourceModule` on module classes. For module classes in the current run (all term owned symbols will fall into this category), this amounts to using the value of the field `ModuleClassSymbol#module`.
* | | | | | | | Merge pull request #5686 from ↵Seth Tisue2017-02-141-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | propensive/make-abstractvar-context-error-more-precise Correct the AbstractVar error message to be more correct
| * | | | | | | | Correct the AbstractVar error messageJon Pretty2017-02-091-1/+1
| | |_|_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The error currently reads "only classes can have declared but undefined members", which isn't true on two counts: traits can have them, and concrete classes cannot. This corrects the error message to read "only traits and abstract classes can have declared but undefined members".
* | | | | | | | Merge pull request #5691 from som-snytt/issue/eolLukas Rytz2017-02-131-39/+30
|\ \ \ \ \ \ \ \ | |_|_|_|_|_|_|/ |/| | | | | | | EOL is System.lineSeparator
| * | | | | | | EOL is System.lineSeparatorSom Snytt2017-02-131-39/+30
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old EOL is EOL. Use `println()` when feasible and obvious. Minor cleanup of surrounding code.
* | | | | | | Merge pull request #5676 from som-snytt/issue/10173Lukas Rytz2017-02-131-3/+4
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | SI-10173 Crash output shows true line number
| * | | | | | SI-10173 Crash output shows true line numberSom Snytt2017-02-051-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Where true means 1-based, for whatever tree was last to typer.
* | | | | | | Merge pull request #5245 from dwijnand/trailing-commasAdriaan Moors2017-02-081-0/+11
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-4986 The glorious return of Comma McTraily
| * | | | | | | SIP-27 Tweak and test wildstar in REPLDale Wijnand2017-01-081-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From https://github.com/scala/scala/pull/5245#issuecomment-266658070
| * | | | | | | SI-4986 SIP-27 Trailing Comma (multi-line only) supportDale Wijnand2016-12-111-0/+8
| | | | | | | |
* | | | | | | | Merge pull request #5646 from som-snytt/issue/8685Adriaan Moors2017-02-071-0/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-8685 Warn on deprecated case ctor
| * | | | | | | | SI-8685 Warn on deprecated case ctorSom Snytt2017-01-161-0/+1
| | |_|/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The narrow use case in the ticket was just to warn on `C.apply` when the constructor has been deprecated. Someone added code to warn after the apply is rewritten, but it wasn't checking the constructor (and the tree was checked before but not after transform).
* | | | | | | | Merge pull request #5642 from janekdb/topic/MB-calculation-correctionAdriaan Moors2017-02-071-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Calculate MB instead of MiB
| * | | | | | | | Calculate MB instead of MiBJanek Bogucki2017-01-151-1/+1
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | This is consistent with same calculation in Compilers.freeMemoryString.
* | | | | | | | Merge pull request #5585 from som-snytt/issue/10097Adriaan Moors2017-02-072-17/+45
|\ \ \ \ \ \ \ \ | |_|_|/ / / / / |/| | | | | | | SI-10097 Error if no non-implicit case class param
| * | | | | | | SI-10097 Adapt unless -Xsource:2.13Som Snytt2016-12-142-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For 2.12 migration, insert missing case class param section, strip caseaccessor from implicit paramsection, and deprecate the adaptation.
| * | | | | | | SI-8704 Also warn if effectively multiple implicitSom Snytt2016-12-142-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current semantics are that leading implicit param turns the parameter section into an implicit section (though without making other params implicitly implicit). Warn if more than one head of a param section is implicit, since that results in multiple implicit param sections.
| * | | | | | | SI-8704 Error on bad implicit sectionsSom Snytt2016-12-141-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of aborting when a class def has extra parameter section, take all parameter sections and sanity check the use of leading implicit to indicate an implicit parameter section.
| * | | | | | | SI-10097 Error if no non-implicit case class paramSom Snytt2016-12-141-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Case class must have a non-implicit param list. Error early, error often. Also update spec to say that class implicitly gets a non-implicit parameter section if it doesn't have one, and that a case class must have one.
* | | | | | | | Merge pull request #5666 from Philippus/issue/10030Lukas Rytz2017-02-031-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-10030 - added quotes in case the path contains a space and an 8.3-…
| * | | | | | | | SI-10030 - added quotes in case the path contains a space and an ↵Philippus Baalman2017-01-301-1/+1
| | |/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | 8.3-compliant path is not available
* / | | | | | | SI-9729 -Xmaxerrs to limit messagesSom Snytt2017-01-313-8/+15
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2.7.2, console reporter has limited error messages to a fixed 100. Use `-Xmaxerrs -Xmaxwarns` as from `javac` to configure.
* | | | | | | Merge pull request #5583 from lrytz/t10093Adriaan Moors2016-12-211-5/+5
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-10093 don't move member traits to constructor body in constructors
| * | | | | | | SI-10093 don't move member traits to constructor body in constructorsLukas Rytz2016-12-061-5/+5
| | |_|_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a regression introduced in c8e6050. Member traits with only abstract definitions (`isInterface`) were moved into the primary constructor by mistake. (Flatten moved the classes back.) The member trait was duplicated into the constructor of specialized subclasses, causing it to be generated multiple times. Also removes some unnecessary `isMixinConstructor` checks: the mixin constructor is always the primary constructor. This commit also clarifies (and tests) what `isInterface` means: for scala-defined traits, it means there are only abstract members. For java-defined interfaces, it is always true.
* | | | | | | Fix how "sbt" is writtenDale Wijnand2016-12-212-4/+4
| |_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "sbt" is not an acronym (it used to be, but it isn't any longer). It's a proper name, like "iPhone" or "eBay". So, just like you wouldn't write "Get Started With EBay" or "How To Reset Your IPhone", we don't write "Using the Sbt Build".
* | | | | | Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2016-12-203-19/+104
|\ \ \ \ \ \ | | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20161220 Conflicts: bincompat-backward.whitelist.conf build.xml src/compiler/scala/tools/nsc/typechecker/Typers.scala src/library/scala/collection/immutable/NumericRange.scala
| * | | | | Merge pull request #5487 from lrytz/java-constantsAdriaan Moors2016-12-152-2/+61
| |\ \ \ \ \ | | | | | | | | | | | | | | SI-3236 constant types for literal final static java fields
| | * | | | | Support implicit converstions from java literalsLukas Rytz2016-11-021-38/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, public static final byte b = 127 is allowed, but 128 is not. Also factor out a method that parses a literal. It could be used to parse annotations (and their literal arguments) in Java sources.
| | * | | | | SI-3236 constant types for literal final static java fieldsJohannes Rudolph2016-10-282-2/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we don't parse Java expressions, fields of Java classes coming from source files never have constant types. This prevents using static java fields in annotation arguments in mixed compilation This PR assigns constant types to final static java fields if the initializer is a simple literal.
| * | | | | | SI-9834 Show expansion of update on errorSom Snytt2016-11-251-3/+4
| | | | | | |
| * | | | | | SI-9834 Improve error on failed op=Som Snytt2016-11-251-16/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If rewriting `x += y` fails to typecheck, emit error messages for both the original tree and the assignment. If rewrite is not attempted because `x` is a val, then say so. The error message at `tree.pos` is updated with the additional advice. SI-8763 Crash in update conversion When there are already errors, don't attempt mechanical rewrites.
| * | | | | | [nomerge] SI-10037 ASR/LSR switched in ICodeReaderSom Snytt2016-11-102-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Noticed when inlining from a class file. The test doesn't work because inlining fails with bytecode unavailable due to: ``` scala.reflect.internal.MissingRequirementError: object X in compiler mirror not found. ```