summaryrefslogtreecommitdiff
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | Merge pull request #5622 from edmundnoble/extra-errsAdriaan Moors2017-03-023-24/+46
|\ \ \ \ \ | |_|/ / / |/| | | | Improved error messages for identically named, differently prefixed types
| * | | | Match error lengthsEdmund Noble2017-02-071-2/+5
| | | | |
| * | | | Improved error messages for identically named, differently prefixed typesEdmund Noble2016-12-313-24/+43
| | | | |
* | | | | SI-10207 Error before update conversionSom Snytt2017-02-261-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gaze deeper for errors before committing to conversion of assignment to update. The error buried in the transformed tree escapes notice of retypechecking and leaks to backend.
* | | | | Merge pull request #5723 from dragos/issue/regression-assert-ideLukas Rytz2017-02-241-5/+10
|\ \ \ \ \ | | | | | | | | | | | | Fix regression introduced by 5751763
| * | | | | Fix regression in 5751763Iulian Dragos2017-02-221-5/+10
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | enterClass/Module may return an existing symbol, but in 5751763 the return value was dropped leading to assertion failures. This may show up only in the presentation compiler, which explains why it went unnoticed. Here's what needs to happen: - a class with a companion is loaded by the IDE, but the class name is different than the file name. This is from source - the same class and companion object exist as binary, and are loaded from classfiles when the package is completed (since they have different names than the source file, the classpath abstraction will only "know" that there is a classfile, and no corresponding source file) It seems that companionClass always prefers to return the companion defined in a source file, but if this assertion is called from the code path that tries to load the binary version, the newly created module will not match.
* | | | | Revert "Fix erasure of the qualifier of ##"Adriaan Moors2017-02-221-7/+6
| | | | |
* | | | | Revert "SI-10133 Require escaped single quote char lit"Adriaan Moors2017-02-211-18/+6
| | | | |
* | | | | Merge pull request #5658 from retronym/topic/hashhashLukas Rytz2017-02-211-6/+7
|\ \ \ \ \ | | | | | | | | | | | | Fix erasure of the qualifier of ##
| * | | | | Fix erasure of the qualifier of ##Jason Zaugg2017-01-241-6/+7
| | |/ / / | |/| | |
* | | | | Merge pull request #5708 from szeiger/issue/si10194Lukas Rytz2017-02-211-7/+7
|\ \ \ \ \ | | | | | | | | | | | | SI-10194: Fix abstract type resolution for overloaded HOFs
| * | | | | SI-10194: Fix abstract type resolution for overloaded HOFsStefan Zeiger2017-02-211-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Types in the applicable overload alternatives need to be seen from the respective owners of the individual alternative, not from the target’s owner (which can be a subtype of the types that define the methods).
* | | | | | Merge pull request #5700 from retronym/ticket/10154-refactorLukas Rytz2017-02-212-20/+29
|\ \ \ \ \ \ | | | | | | | | | | | | | | Refactor lookupCompanion
| * | | | | | Refactor implementation of lookupCompanionJason Zaugg2017-02-192-20/+29
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | - Check for module class up front to use sourceModule - Consolidate most of the logic in Contexts
* | | | | | Merge pull request #5704 from som-snytt/issue/10190-elide-stringLukas Rytz2017-02-211-2/+6
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-10190 Elide string to empty instead of null
| * | | | | | SI-10190 Elide string to empty instead of nullSom Snytt2017-02-151-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid NPE when eliding string-valued functions. For example, `log(s"$cheap$expensive")` needn't print null. This is a natural and inexpensive way to elide strings.
* | | | | | | Merge pull request #5640 from optimizely/repl-import-handlerAdriaan Moors2017-02-201-2/+5
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-9881 Fix ImportHandler's reporting of importedNames and importedSymbols
| * | | | | | | Fix ImportHandler's reporting of importedNames and importedSymbolsHao Xia2017-01-111-2/+5
| | |_|_|/ / / | |/| | | | |
* | | | | | | Merge pull request #5629 from som-snytt/issue/10120-quote-errAdriaan Moors2017-02-201-6/+18
|\ \ \ \ \ \ \ | |_|_|_|_|/ / |/| | | | | | SI-10133 Require escaped single quote char lit
| * | | | | | SI-10120 Extra advice on unclosed char literalSom Snytt2017-01-081-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Folks from other languages might mistakenly enclose a string in single quotes. Since this presents as a symbol literal followed by the unpaired single quote, we can add a syntax reminder. Also polish the wording for bad string interpolation.
| * | | | | | SI-10133 Require escaped single quote char litSom Snytt2017-01-081-0/+5
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The spec specifically requires `'\''` and not `'''`. The error consumes all consecutive single quotes.
* | | | | | Merge pull request #5711 from retronym/ticket/jrtLukas Rytz2017-02-202-30/+58
|\ \ \ \ \ \ | | | | | | | | | | | | | | Faster and simpler Java 9 classpath implementation
| * | | | | | Faster and simpler Java 9 classpath implementationJason Zaugg2017-02-172-30/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Take advantage of the `/packages` index provided by the jrt file system to avoid (expensive) Files.exist for non-existent entries across the full list of modules. - Extends ClassPath directly which leads to a simpler implemnentation that using the base class. - Add a unit test that shows we can read classes and packages from the Java standard library. Fixes scala/scala-dev#306 With this change bootstrap time under Java 9 was comparable to Java 8. Before, it was about 40% slower.
* | | | | | | Merge pull request #5714 from dragos/issue/usage-sterr-SI-10178Lukas Rytz2017-02-201-2/+10
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-10178 Route reporter.echo to stdout
| * | | | | | | SI-10178 Route reporter.echo to stdoutIulian Dragos2017-02-181-2/+10
| | |_|_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | `echo` is currently used only for usage information, and that makes a lot more sense to go to stdout instead of stderr. This allows grepping through the extensive list of compiler options.
* | | | | | | SI-10148 Accept verbose zeroSom Snytt2017-02-181-4/+4
| |_|_|_|/ / |/| | | | | | | | | | | | | | | | | The test for non-zero must recognize `-0e+00f` and variants.
* | | | | | Merge branch '2.12.x' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-1736-98/+122
|\| | | | |
| * | | | | Merge pull request #5694 from ↵Seth Tisue2017-02-1630-48/+49
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | janekdb/topic/2.12.x-scaladoc-spelling-corrections-2 Fix typos in compiler and reflect
| | * | | | | Fix typos in compiler and reflectJanek Bogucki2017-02-1330-48/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Miscellania: Miscellania is a small island off the northernmost part of the Fremennik Isles - RunScape Wiki Miscellanea: A collection of miscellaneous objects or writings - Merriam-Webster
| * | | | | | Merge pull request #5648 from som-snytt/issue/10148Seth Tisue2017-02-162-8/+30
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-10148 Follow Java for float literals
| | * | | | | | SI-10148 Follow Java for float literalsSom Snytt2017-01-182-8/+30
| | | |_|/ / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | Use `Float.parseFloat` instead of converting from Double. Error when a value rounds to zero.
| * | | | | | Merge pull request #5546 from som-snytt/issue/9636Adriaan Moors2017-02-161-32/+24
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-9636 More precise error pos on apply inference
| | * | | | | | SI-9636 More precise error pos on apply inferenceSom Snytt2016-12-201-32/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a method type arg is inferred Any, warn about the function and not the innocent arg.
| * | | | | | | 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