summaryrefslogtreecommitdiff
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* SI-7933 REPL javax.script eval is cached resultRaphael Jolly2014-01-311-1/+12
| | | | | | | The problem is that the repl underneath the script engine evaluates input to val res0..resN, so it is a one shot operation. To allow repetition, compile(script) now returns a CompiledScript object whose eval method can be called any number of times.
* Merge 2.10.x into masterAdriaan Moors2014-01-181-5/+7
|\
| * Merge pull request #3356 from retronym/ticket/8138Jason Zaugg2014-01-181-5/+7
| |\ | | | | | | Fix bug with super-accessors / dependent types
| | * SI-8143 Fix bug with super-accessors / dependent typesJason Zaugg2014-01-121-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Super-accessors are generated as `DefDef`'s with `EmptyTree` as a placeholder for the RHS. This is filled in later in `Mixin` in `completeSuperAccessor`. A change in `Uncurry` (SI-6443 / 493197f), however, converted this to a `{ EmptyTree }`, which evaded the pattern match in mixin. This commit adds a special case to the dependent method treatment in Uncurry to avoid generating redundant blocks.
| * | Merge pull request #3364 from retronym/ticket/8152Jason Zaugg2014-01-151-3/+5
| |\ \ | | | | | | | | [nomaster] Backport variance validator performance fix
| | * | [nomaster] SI-8152 Backport variance validator performance fixJason Zaugg2014-01-141-3/+5
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | % time qbin/scalac test/files/pos/t8146-performance.scala real 0m2.015s user 0m2.892s sys 0m0.215s % time scalac-hash v2.10.3 test/files/pos/t8146-performance.scala real 1m13.652s user 1m14.245s sys 0m0.508s Cherry-picks one hunk from 882f8e64.
* | | Merge pull request #3383 from adriaanm/merge-2.10.xAdriaan Moors2014-01-188-15/+47
|\ \ \ | | | | | | | | Merge 2.10.x
| * | | Merge commit 'd5801b9eee' from 2.10.x into masterAdriaan Moors2014-01-171-0/+23
| |\| | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala
| | * | Merge pull request #3328 from retronym/ticket/8111v2.10.4-RC2Jason Zaugg2014-01-121-0/+23
| | |\ \ | | | |/ | | |/| Repair symbol owners after abandoned named-/default-args
| | | * SI-8111 Expand the comment with a more detailed TODOJason Zaugg2014-01-081-3/+8
| | | | | | | | | | | | | | | | | | | | As everone knows, undo/reset/retype/rollback are bandaids; we should try to treat the disease more directly.
| | | * SI-8111 Repair symbol owners after abandoned named-/default-argsJason Zaugg2014-01-061-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Names/Defaults eagerly transforms an application with temporaries to maintain evaluation order, and dutifully changes owners of symbols along the way. However, if this approach doesn't work out, we throw away this and try a auto-tupling. However, we an still witness symbols owned by the temporaries. This commit records which symbols are owned by the context.owner before `transformNamedApplication`, and rolls back the changes before `tryTupleApply`. Perhaps a better approach would be to separate the names/defaults applicability checks from the evaluation-order-preserving transform, and only call the latter after we have decided to go that way.
| | * | [nomaster] SI-8114 Binary compat. workaround for erasure bug SI-7120Jason Zaugg2014-01-091-1/+26
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't backport SI-7120 to 2.10.x as it changes erased signatures, which can lead to interop problems between 2.10.3 and 2.10.4. But, we can detect one of the nasty symptoms -- a bridge method with the same signature as its target -- and treat that. This commit detects duplicate bridges in the ASM (only) backend and removes them.
| * | Merge commit '97b9b2c06a' from 2.10.x into masterAdriaan Moors2014-01-177-15/+24
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Check files updated: test/files/presentation/t8085*.check Conflicts: build.xml src/compiler/scala/tools/nsc/ast/parser/Parsers.scala src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
| | * SI-8085 Fix BrowserTraverser for package objectsJason Zaugg2013-12-181-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A source file like: import foo.bar package object baz Is parsed into: package <empty> { import foo.bar package baz { object `package` } } A special case in Namers compensates by adjusting the owner of `baz` to be `<root>`, rather than `<empty>`. This wasn't being accounted for in `BrowserTraverser`, which underpins `-sourcepath`, and allows the presentation compiler to load top level symbols from sources outside those passes as the list of sources to compile. This bug did not appear in sources like: package p1 package object p2 { ... } ... because the parser does not wrap this in the `package <empty> {}` This goes some way to explaining why it has gone unnoticed for so long.
| | * Report error on code size overflow, log method name.Adriaan Moors2013-12-121-5/+4
| | | | | | | | | | | | | | | | | | | | | We used to silently skip class files that would exceed the JVM's size limits. While rare, this should still be an error. While I was at it, also included the name of the offending method.
| | * Merge pull request #3261 from adriaanm/ticket-6426Adriaan Moors2013-12-112-6/+6
| | |\ | | | | | | | | Revert ", importable _."
| | | * Revert "SI-6426, importable _."Adriaan Moors2013-12-102-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit d2316df920ffa4804fe51e8f8780240c46efa982. We can't make `_` an illegal identifier -- it's legal in Java, so we must be able to name these Java underscores.
| | * | Merge pull request #3253 from retronym/ticket/8062Adriaan Moors2013-12-113-5/+11
| | |\ \ | | | |/ | | |/| Fix inliner cycle with recursion, separate compilation
| | | * SI-8062 Fix inliner cycle with recursion, separate compilationJason Zaugg2013-12-103-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ICodeReaders, which decompiles JVM bytecode to ICode, was not setting the `recursive` attribute of `IMethod`. This meant that the inliner got into a cycle, repeatedly inlining the recursive call. The method name `filter` was needed to trigger this as the inliner heuristically treats that as a more attractive inlining candidate, based on `isMonadicMethod`. This commit: - refactors the checking / setting of `virtual` - adds this to ICodeReaders - tests the case involving `invokevirtual` I'm not sure how to setup a test that fails without the other changes to `ICodeReader` (for invokestatic and invokespecial).
* | | | Merge pull request #3381 from retronym/topic/debug-friendlinessEugene Burmako2014-01-181-1/+3
|\ \ \ \ | |/ / / |/| | | Fix compilation under -Ydebug
| * | | Don't trace the low-level details of ResetAttrs under -YdebugJason Zaugg2014-01-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | This need for this output is highly situational and since we've starting using this resettter in case classes and names/defaults, it is polluting our consoles.
* | | | Merge pull request #3373 from densh/topic/std-liftable-refinementAdriaan Moors2014-01-171-8/+9
|\ \ \ \ | | | | | | | | | | A few minor changes to standard liftable instances and liftable support
| * | | | Give better names to UnliftHelper1 and UnliftHelper2Denys Shabalin2014-01-161-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Previous ones were inscrutable but thankfully @xeno_by helped me out to find better alternatives.;
| * | | | Remove redundant asInstanceOf for liftableDen Shabalin2014-01-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previous encoding of Liftables which had universe passed in as a parameter required a cast to solve path-dependant madness problems: trait OldLiftable[T] { def apply(u: Universe, v: T): u.Tree } In this case compiler wasn't smart enough to find out that liftFoo(universe, foo) returns the same type of tree we were working with (universe.Tree) and we had to cast to make it work: liftFoo(universe, foo).asInstanceOf[universe.Tree] Now this cast is redundant as universe is not a parameter of Liftable's apply.
* | | | | Merge pull request #3380 from retronym/ticket/8157Adriaan Moors2014-01-171-5/+1
|\ \ \ \ \ | | | | | | | | | | | | Make overloading, defaults restriction PolyType aware
| * | | | | SI-8157 Make overloading, defaults restriction PolyType awareJason Zaugg2014-01-171-5/+1
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Named/Default args levies an implementation restriction that only one overloaded alternative may declare defaults. But, this restriction failed to consider polymorphic methods. Rather than matching on MethodType, this commit uses `Type#paramms`, which handles PolyTypes and curried MethodTypes in one fell swoop.
* | | | | Merge pull request #3283 from paulp/pr/dotless-targsAdriaan Moors2014-01-172-11/+23
|\ \ \ \ \ | |/ / / / |/| | | | Dotless type application for infix operators.
| * | | | Dotless type application for infix operators.Paul Phillips2013-12-172-11/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you have an aesthetic expresion like def f(xs: Iterator[Int]) = ( xs takeWhile (_ < 1000) map (_ * -1) filter (_ % 2 == 0) flatMap (x => List(x, x)) reduceOption (_ + _) maxBy (_.toString) ) And then for whatever reason you have to perform explicit type application in the midst of that expression, it's aggravating in the extreme that it has (had) to be rewritten in its entirety to accommodate that change. So now you can perform type application in the middle of it. For reasons not entirely clear to me postfix operators are excluded. The discussion as well as the approval for the infix variation of it can be found at: https://groups.google.com/forum/#!msg/scala-language/eJl1wnkEz9M/hR984-lqC5EJ
* | | | | Merge pull request #3278 from magarciaEPFL/backendish48Adriaan Moors2014-01-167-19/+50
|\ \ \ \ \ | | | | | | | | | | | | improvements to GenBCode
| * | | | | overzealous assert in BCodeBodyBuilder rejected throw nullMiguel Garcia2013-12-161-1/+3
| | | | | |
| * | | | | removing defensive code made obsolete by existing fix to SI-5604Miguel Garcia2013-12-162-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | SI-5604 was fixed in commit e6f10b07d44f0ddde26246b4a41527a84eede81c
| * | | | | overzealous assert in GenBCodeMiguel Garcia2013-12-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The assert in question was aimed at ruling out gotos (ie "jumping-applys") in actual argument position of a jumping-apply. But the assert in question went overboard to also rule out a LabelDef in actual argument position. This commit removes the assert in question altogether. The unwanted behaviors, and only those, are rule out by the test added in this commit and the existing tests for SI-6089. See also https://issues.scala-lang.org/browse/SI-7749
| * | | | | removing dead code in BCodeSyncAndTryMiguel Garcia2013-12-151-4/+0
| | | | | |
| * | | | | there's a reason for this code in GenBCodeMiguel Garcia2013-12-154-4/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | aced32d05c97651534f468bc9a475ea5f6ae75b8 removed unused code, along with code that populates a cache with entries needed in some program runs. I'm re-adding the latter.
| * | | | | GenBCode version of "not eliminate loadmodule on static methods."Miguel Garcia2013-12-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f27f2d80d759130597b652d6cc9d789f8c472e5a modifies GenASM, we follow suite here, making test/files/run/static-module-method.scala pass under GenBCode.
| * | | | | GenBCode version of "Updating Position call sites" commitMiguel Garcia2013-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 7d62df035cd4393c73e7530e1cad1130e79d90c6 modifies GenASM, we follow suite here.
* | | | | | Merge pull request #3340 from huitseeker/issues/sourceFlagAdriaan Moors2014-01-163-38/+45
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8126 adds a -source option to let (parts of) the compiler run on older code
| * | | | | | SI-8126 Puts SI-7335 fix behind a source level flagFrançois Garillot2014-01-161-1/+1
| | | | | | |
| * | | | | | SI-8126 Puts SI-6899 fix under a source level flagFrançois Garillot2014-01-161-1/+1
| | | | | | |
| * | | | | | SI-8126 Add a '-Xsource' flag allowing compilation in e.g. 2.10 modeFrançois Garillot2014-01-161-36/+43
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | This is aimed at letting the 2.11+ compiler operate, at least until phase:typer, on a 2.10 codebase.
* / | | | | SI-8148 fix anonymous functions with placeholdersDenys Shabalin2014-01-161-2/+2
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Quasiquotes used to fail to generate proper fresh identifiers for anonymous functions like: q"_ + _" Due to improper initialization of FreshNameCreator in quasiquote parser which was erroneously not preserved throughout parsing of the code snippet but re-created on every invocation.
* | | | | Merge pull request #3285 from som-snytt/issue/8015-FF-NLsAdriaan Moors2014-01-152-12/+20
|\ \ \ \ \ | | | | | | | | | | | | Count lines by EOLs
| * | | | | SI-8015 Count lines by EOLsSom Snytt2014-01-082-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Source lines were counted by "line break chars", including FF. Clients of `pos.line` seem to all expect the ordinary line num, so that is what they get. Unicode processing now precedes line ending processing.
* | | | | | Merge pull request #3260 from soc/SI-8035Adriaan Moors2014-01-151-13/+16
|\ \ \ \ \ \ | | | | | | | | | | | | | | Deprecate automatic () insertion in argument lists
| * | | | | | SI-8035 Deprecate automatic () insertion in argument listsSimon Ochsenreither2014-01-091-13/+16
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This promotes the () insertion warning from -Ywarn-adapted-args to a deprecation warning. -Xfuture tunrs it into a compiler error. Auto tupling remains unchanged for now. The tests have been fixed the following way: - Warnings caused by general sloppiness (Try(), Future(), ...) have been fixed. - Warnings which raise interesting questions (x == (), ...) received an updated checkfile for now.
* | | | | | Merge pull request #3369 from retronym/ticket/8132Grzegorz Kossakowski2014-01-151-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-8132 Fix false "overrides nothing" for case class protected param
| * | | | | | SI-8132 Fix false "overrides nothing" for case class protected paramJason Zaugg2014-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Case class parameters that are less-than-public have an accessor method created. In the enclosed test, we saw: case class G extends AnyRef with T with Product with Serializable { override <synthetic> <stable> <caseaccessor> def s$1: String = G.this.s; <caseaccessor> <paramaccessor> private[this] val s: String = _; override <stable> <accessor> <paramaccessor> protected def s: String = G.this.s; ... } This commit removes the OVERRIDE flag from the accessor method, which avoids the spurious "overrides nothing" error.
* | | | | | | Merge pull request #3355 from xeno-by/topic/saturday-nightJason Zaugg2014-01-1410-108/+40
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | reshuffles names for blackbox/whitebox contexts, changes bundle notation
| * | | | | | | removes Scala reflection-based macro runtimeEugene Burmako2014-01-122-35/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code is currently unused, so I’m removing it in order to avoid bitrot. Once we’re sure that we can trust Scala reflection with our macros, the removed file can be easily reinstated.
| * | | | | | | prohibits constructor overloading for macro bundlesEugene Burmako2014-01-122-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per Jason’s feedback, this commit handles overloaded constructors in macro bundles. The backend now checks that we have a constructor of a correct type. The frontend now prohibits multiple constructors altogether.