summaryrefslogtreecommitdiff
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2718 from soc/SI-7592-multihashmapAdriaan Moors2013-07-121-9/+0
|\ | | | | SI-7592 Remove scala.tools.nsc.util.MultiHashMap
| * SI-7592 Remove scala.tools.nsc.util.MultiHashMapSimon Ochsenreither2013-07-101-9/+0
| |
* | Merge pull request #2708 from soc/SI-7174Adriaan Moors2013-07-121-4/+7
|\ \ | | | | | | SI-7174 Fix initialization issues
| * | SI-7174 Fix initialization issuesSimon Ochsenreither2013-07-061-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without constant inlining, the compiler would not even bootstrap because it depends on constant inlining hiding initialization issues which would cause a NPE otherwise. In this case, global is null at runtime, but no NPE is happening despite accessing members of global (see SubComponent), because constant inlining has copied the values of those members to the call-sites and eliminated the dereference of global. This commit fixes the initialization order.
* | | Fixes checkinit build failure caused by quasiquotes pull requestDen Shabalin2013-07-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | The failure was caused by recent refactoring that moved fields that are expected by reflection Reifier from early init block to the body of the class. According to checkinit this may cause initialization issues although they do not really happen in real life as most of these fields aren't used during quasiquotes' reification.
* | | SI-7487 Revert "Removed -Ymacro-no-expand."Adriaan Moors2013-07-102-10/+13
| | | | | | | | | | | | This reverts commit 71fb0b83a, which itself reverted the fix for SI-6812.
* | | Merge pull request #2701 from som-snytt/issue/4594-repl-settingsAdriaan Moors2013-07-101-32/+39
|\ \ \ | | | | | | | | SI-4594 Repl settings command
| * | | SI-4594 Enable mutating mutable multi settingsSom Snytt2013-07-041-32/+39
| | | | | | | | | | | | | | | | | | | | | | | | Previously, multi-valued settings (String- and Phase- valued) could be augmented but not cleared. Also, phase settings included lazily cached values that were not recomputed when the setting was changed.
* | | | Merge pull request #2714 from scalamacros/topic/quasiquotesAdriaan Moors2013-07-1023-236/+1036
|\ \ \ \ | | | | | | | | | | Quasiquotes
| * | | | macro impls can now return subtypes of c.TreeEugene Burmako2013-07-102-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 10229316db allowed macro impls to take and return values of type c.Tree in addition to the usual c.Expr. However it didn't take into account that it is often useful to return subtypes of trees (e.g. with quasiquotes that expand into expressions typed as precisely as possible). This patch fixes that oversight.
| * | | | backward compatibility for TreeBuilderDen Shabalin2013-07-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reintroduces treeBuilder at its old location (Global.treeBuilder) by routing it from the new location (Parsers.treeBuilder) for the sake of being friendly to tools that might depend on it.
| * | | | introduces unapply macros for internal useEugene Burmako2013-07-084-48/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a macro hook into the unapply part of `doTypedApply`, provides `macroExpandUnapply` in the macro engine and applies a couple of minor refactorings along the way (renames the ugly `macroExpand1` into oblivion, changes the ctor of `Fingerprint` to be private and upgrades `MacroRole` from a string to a value class). Unapply macros haven't been approved for inclusion in 2.11.0, however they are necessary for pattern-matching quasiquotes. Therefore I'm only allowing them to expand for QuasiquoteClass_api_unapply.
| * | | | implements quasiquotesDen Shabalin2013-07-087-2/+792
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Additions to the reflection API: - The Quasiquotes implicit class that defines `q`, `tq`, `pq` and `cq` interpolators which now become a part of the `scala.reflect.api. Universe`. - Implementations of the interpolators are macro-based and are hardwired through `FastTrack`. - The `Liftable` class and the `StandardLiftables` slice of the cake that provide a type class and a bunch of its instances that allow to easily splice user-defined types into quasiquotes. - Additional methods in `BuildUtils` that are used by the quasiquote macro to generate trees, notably: - `SyntacticClassDef`. An extractor/constructor that allows to construct and deconstruct classes using arguments that mirror syntactic form of ClassDefs (e.g. constructor outside of the body). - `TupleN`, `TupleTypeN`. Extractor/constructor for easy construction of ast that represents a tuple term or type with given amount of elements. - Actual implementation of quasiquotes in the `scala.tools.reflect. quasiquotes` package which is organized into a cake called `Quasiquotes` with slices introducing core abstractions necessary to splice into Scala syntax, routines for interfacing with the parser, and customized reifiers for tree construction and deconstruction.
| * | | | introduces extensibility hooks into the reifierEugene Burmako2013-07-082-11/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Quasiquoting macros are surprisingly similar to reifying macros, since both take something and then produce Scala ASTs for that something. Therefore the upcoming quasiquote patch reuses the vanilla reifier, adjusting it in key points to enable splicing and extraction to support string interpolation syntax. In this commit we prepare the reifier for being reused later on, adding a modest amound of extensibility hooks.
| * | | | moves template creation logic from nsc to reflectDen Shabalin2013-07-085-79/+7
| | | | | | | | | | | | | | | | | | | | | | | | | This routine is going to be necessary in scala-reflect.jar to support ClassDef construction/deconstruction in the upcoming quasiquote patch.
| * | | | adds the lookahead routine to the parserDen Shabalin2013-07-083-20/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces a scoping operator used to temporarily look into the future. Backs up scanner data before evaluating a block and restores it after. Not used anywhere, only necessary for the upcoming quasiquote patch in order to reliably detect and accordingly process holes in quasiquoted Scala syntax.
| * | | | extensibility hooks for parserDen Shabalin2013-07-081-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the second of the two patches to the parser necessary for quasiquotes to function. This one applies just a couple of minor changes to the way parser works, so that quasiquotes will be able to extend it to support some corner cases arising from splicing (see the subsequent quasiquote commit for more details).
| * | | | moves TreeBuilder into the parserDen Shabalin2013-07-085-64/+64
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first of the two patches to the parser necessary for quasiquotes to function. This one moves TreeBuilder from Global to the internals of the Parsers, so that quasiquotes will be able to override it later to support some corner cases arising from splicing (see the subsequent quasiquote commit for more details). Surprisingly enough, almost noone used TreeBuilder outside the parser, and it was necessary to move just a couple of methods to TreeGen to satisfy broken dependencies.
* | | | Merge pull request #2717 from retronym/ticket/6574Adriaan Moors2013-07-101-4/+35
|\ \ \ \ | | | | | | | | | | SI-6574 Support @tailrec for extension methods.
| * | | | SI-6574 Support @tailrec for extension methods.Jason Zaugg2013-07-101-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, when the body of an extension method is transplanted to the companion object, recursive calls point back to the original instance method. That changes during erasure, but this is too late for tail call analysis/elimination. This commit eagerly updates the recursive calls to point to the extension method in the companion. It also removes the @tailrec annotation from the original method.
* | | | | Merge pull request #2713 from VladUreche/issue/7638-masterAdriaan Moors2013-07-101-1/+1
|\ \ \ \ \ | |_|_|_|/ |/| | | | SI-7638 Superaccessor lookup after specialization
| * | | | SI-7638 Superaccessor lookup after specializationVlad Ureche2013-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The crash was caused by a symbol lookup to rewire the super calls, done after pickler, but specialization added new traits and new members, thus making the super rewiring impossible. To avoid such problems, this patch moves symbol lookup after specialization, so the changes done by specialization (and miniboxing) become visible to mixin. Review by @adriaanm or @retronym.
* | | | | Merge pull request #2704 from adriaanm/modularizeAdriaan Moors2013-07-092-16/+7
|\ \ \ \ \ | | | | | | | | | | | | Separate jars for XML, Parser Combinators. Use released JLine.
| * | | | | Unfork jline: use vanilla jline 2.11 as a dependency.Adriaan Moors2013-07-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Notes: - no longer specifying terminal by class name in scripts (using 'unix') - jline doesn't need a separate jansi dependency; it includes its own version according to: http://mvnrepository.com/artifact/jline/jline/2.11
| * | | | | Spin off src/library/scala/xml to src/xml/scala/xml.Adriaan Moors2013-07-051-15/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: - Remove the last vestiges of xml from Predef and Contexts. - Change build to compile scala.xml to scala-xml.jar. - Deploy scala-xml module to maven. - Update partest accordingly. Note: An older compiler cannot use the new standard library to compile projects that use XML. Thus, skipping locker will break the build until we use 2.11.0-M4 for STARR. In the future build process, where we drop locker, we would have to release a milestone that supports the old and the new approach to xml. As soon as we'd be using that new milestone for starr, we could drop support for the old approach.
* | | | | | Merge pull request #2650 from paulp/issue/6221Adriaan Moors2013-07-081-11/+6
|\ \ \ \ \ \ | |_|_|_|/ / |/| | | | | SI-6221 inference with Function1 subtypes.
| * | | | | SI-6221 inference with Function1 subtypes.Paul Phillips2013-06-131-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There appears to be no upper bound on the number of places we have to remove calls to typeSymbol and introduce calls to baseType. This one was type inference for function parameter types: worked when expected type was A => B, but not if there was an implicit conversion from A => B to the expected type.
* | | | | | Merge pull request #2687 from soc/topic/io-to-interactiveAdriaan Moors2013-07-034-791/+0
|\ \ \ \ \ \ | | | | | | | | | | | | | | Move some code from s.t.n.io to s.t.n.interactive
| * | | | | | Move some code from s.t.n.io to s.t.n.interactiveSimon Ochsenreither2013-06-274-791/+0
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only usages of scala.tools.nsc.io.{Lexer,Pickler,PrettyWriter, Replayer} can be found in scala.tools.nsc.interactive. Let's move those files closer to their dependencies.
* | | | | | Merge pull request #2660 from retronym/ticket/7582Adriaan Moors2013-07-032-4/+13
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | SI-7582 Only inline accessible calls to package-private Java code
| * | | | | SI-7582 Only inline accessible calls to package-private Java codeJason Zaugg2013-06-191-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two problems here. The inliner was using `isPrivate` / `isProtected` to determine access. The fallthrough considered things to be (bytecode) public. This is okay in practice for Scala code, which never emits package private code. Secondly, we must check accessibility of the called symbol *and* its owner. This case is tested in `run/t7582b`. This commit tightens the check for Java defined symbols: a) check the owner, and b) don't assume that `! isPrivate` is accessible.
| * | | | | SI-7582 ClassfileParser: populate privateWithin of Java module classJason Zaugg2013-06-161-1/+1
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `privateWithin` attribute of Java companion module classes was correctly set under joint compilation (ie, when using JavaParser), but not under separate compilation. This commit remedies this. The test covers variety of Java symbols.
* | | | | Merge pull request #2663 from soc/SI-7592Adriaan Moors2013-07-013-84/+20
|\ \ \ \ \ | | | | | | | | | | | | SI-7592 Replace s.t.n.u.TreeSet with s.c.m.TreeSet
| * | | | | SI-7592 Replace s.t.n.u.TreeSet with s.c.m.TreeSetSimon Ochsenreither2013-06-193-84/+20
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This means - migrating usages from the compiler-specific implementation to the one in the standard library - removing the now unused compiler-specific implementation
* | | | | Merge pull request #2693 from lexspoon/semmle-lintAdriaan Moors2013-07-019-19/+41
|\ \ \ \ \ | | | | | | | | | | | | Lint-like fixes found by Semmle
| * | | | | Adds equals and hashCode to three classes that implement Ordered.Lex Spoon2013-06-261-0/+8
| | | | | |
| * | | | | Adds a hashCode method to the Settings class for Ant.Lex Spoon2013-06-261-0/+14
| | | | | |
| * | | | | Seals some case class hierarchies.Lex Spoon2013-06-267-19/+19
| | | | | |
* | | | | | Merge pull request #2694 from adriaanm/masterGrzegorz Kossakowski2013-07-015-8/+48
|\ \ \ \ \ \ | | | | | | | | | | | | | | Merge 2.10.x into master
| * \ \ \ \ \ Merge 2.10.x into masterAdriaan Moors2013-06-281-3/+12
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Namers.scala src/partest/scala/tools/partest/PartestTask.scala
| | * \ \ \ \ \ Merge pull request #2680 from retronym/ticket/7603Adriaan Moors2013-06-271-3/+12
| | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-7603 Speculative fix for annotation binding error
| | | * | | | | | SI-7603 Speculative fix for annotation binding errorJason Zaugg2013-06-241-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reports of: error: trait Test is abstract; cannot be instantiated 11:09:50 [ant:scalac] @Test def testClientRequestNum = { 11:09:50 [ant:scalac] ^ Suggest that the deferred processing of a LazyAnnotationInfo is binding the identifier `Test` to the wrong symbol. Inspection of the code shows that the closure also defers capture of the (mutable) field `Namer#typer.context`. This commit captures the context eagerly, and adds logging to let us know if that eagerly captured context ever differs from the its value at the point when the annotation info is forced. I spent a few hours trying to craft a test to back this up, but to no avail. Here's what the log output will look like: [log typer] The var `typer.context` in scala.tools.nsc.typechecker.Namers$NormalNamer@1f5ebb08 was mutated before the annotation new a() was forced. current value = Context(C@Import unit=<console> scope=123861466 errors=false, reportErrors=true, throwErrors=false) original value = Context(C@Import unit=<console> scope=123861466 errors=false, reportErrors=true, throwErrors=false) This confirms the hypothesis for the cause of SI-7603. If you see this message, please comment on that ticket.
| | * | | | | | | Merge pull request #2655 from VladUreche/issue/7344Adriaan Moors2013-06-261-24/+94
| | |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-7344 Specialize methods in private scopes
| | | * | | | | | | SI-7344 Specialize methods in private scopesVlad Ureche2013-06-251-24/+94
| | | |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This performs method specialization inside a scope other than a {class, trait, object}: could be another method or a value. This specialization is much simpler, since there is no need to record the new members in the class signature, their signatures are only visible locally. It works according to the usual logic: - we use normalizeMember to create the specialized symbols - we leave DefDef stubs in the tree that are later filled in by tree duplication and adaptation The solution is limited by SI-7579: since the duplicator loses the sym annotations when duplicating, this expansion and rewiring can only take place in code that has not been subject to duplication. You can see the test case for an example. Review by @dragos, @paulp or @axel22.
| * | | | | | | / Merge 2.10.x into masterAdriaan Moors2013-06-284-5/+36
| |\| | | | | | | | | |_|_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Duplicators.scala src/library/scala/concurrent/Future.scala test/files/jvm/scala-concurrent-tck.scala
| | * | | | | | Merge pull request #2648 from retronym/ticket/7571Grzegorz Kossakowski2013-06-251-2/+2
| | |\ \ \ \ \ \ | | | |/ / / / / | | |/| | | | | SI-7571 Allow nesting of anonymous classes in value classes
| | | * | | | | SI-7571 Allow nesting of anonymous classes in value classesJason Zaugg2013-06-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5d9cde105e added deep prohibition of nested classes within a value class. This has the undesirable side effect of prohibiting partial functions literals in method bodies of a value class. The intention of that prohibition was to avoid problems in code using Type Tests, such as: class C(val inner: A) extends AnyVal { class D } def foo(a: Any, other: C) = a match { case _ : other.D } Here, the pattern usually checks that `a.$outer == other`. But that is incongruent with the way that `other` is erased to `A`. However, not all nested classes could lead us into this trap. This commit slightly relaxes the restriction to allow anonymous classes, which can't appear in a type test. The test shows that the translation generates working code.
| | * | | | | | SI-7343 Fixed phase ordering in specializationVlad Ureche2013-06-122-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specialization rewires class parents during info transformation, and the new info then guides the tree changes. But if a symbol is created during duplication, which runs after specialization, its info is not visited and thus the corresponding tree is not specialized. One manifestation is the following: ``` object Test { class Parent[@specialized(Int) T] def spec_method[@specialized(Int) T](t: T, expectedXSuper: String) = { class X extends Parent[T]() // even in the specialized variant, the local X class // doesn't extend Parent$mcI$sp, since its symbol has // been created after specialization and was not seen // by specialzation's info transformer. ... } } ``` We can fix this by forcing duplication to take place before specialization. Review by @dragos, @paulp or @axel22.
| | * | | | | | Removed redundant `retypedMethod` in `Duplicators`Vlad Ureche2013-06-121-18/+2
| | |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was never used since its introduction in 3ee6b3653 by @dragos. Review by @dragos or @axel22 or @paulp.
* | | | | | | Merge pull request #2692 from soc/SI-7591Adriaan Moors2013-07-013-184/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-7591 Migrate command-line parsing to s.t.cmd