summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* macro impls can now return subtypes of c.TreeEugene Burmako2013-07-109-10/+62
| | | | | | | | 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.
* precise return type for FlagsAsBits.unapplyDen Shabalin2013-07-101-1/+1
| | | | | This will help the pattern matcher to emit better code for this kind of extractor that does nothing but wrap the extractee.
* 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.
* tests for quasiquotesDen Shabalin2013-07-0811-0/+1280
| | | | | | Introduces an extensive ScalaCheck-based test suite for recently implemented quasiquotes. Provides tools for syntactic tree comparison and verifying compilation error messages.
* 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-0815-2/+1127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-086-79/+83
| | | | | 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 #2688 from yllan/SI-7614Grzegorz Kossakowski2013-07-063-2/+122
|\ | | | | SI-7614 Minimize the times of evaluation f in TraversableOnce.maxBy/minBy
| * SI-7614 Minimize the times of evaluation f in TraversableOnce.maxBy/minBy.yllan2013-07-063-2/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | In the previous implementation, maxBy/minBy will evaluate most of its elements with f twice to get the ordering. That results (2n - 2) evaluations of f. I save both the element and result of evaluation to a tuple so that it doesn't need to re-evaluate f on next comparison. Thus only n evaluations of f, that is the optimal. Note that the original implementation always returns the first matched if more than one element evaluated to same largest/smallest value of f. I document this behavior explicitly in this commit as well.
* | Merge pull request #2707 from jedesah/patch-1Adriaan Moors2013-07-051-1/+1
|\ \ | | | | | | Fix typo in documentation
| * | Fix typo in documentationJean-Remi Desjardins2013-07-051-1/+1
|/ /
* | Merge pull request #2695 from xuwei-k/bigint-bigdecimal-typoAdriaan Moors2013-07-032-2/+2
|\ \ | | | | | | fix typo
| * | fix typoxuwei-k2013-06-302-2/+2
| | |
* | | Merge pull request #2687 from soc/topic/io-to-interactiveAdriaan Moors2013-07-036-7/+7
|\ \ \ | | | | | | | | 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-276-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0313-4/+105
|\ \ \ \ | | | | | | | | | | SI-7582 Only inline accessible calls to package-private Java code
| * | | | SI-7582 Only inline accessible calls to package-private Java codeJason Zaugg2013-06-199-3/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-164-1/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #2699 from adriaanm/fix-2637-windowsJason Zaugg2013-07-021-1/+2
|\ \ \ \ \ | | | | | | | | | | | | Use forward slash in #2637's test on windows
| * | | | | Use forward slash in #2637's test on windowsAdriaan Moors2013-07-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use toString to output file names in tests, its output is platform dependent -- use `testIdent` instead.
* | | | | | 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-0121-29/+90
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Lint-like fixes found by Semmle
| * | | | | | | Adds equals and hashCode to three classes that implement Ordered.Lex Spoon2013-06-262-0/+20
| | | | | | | |
| * | | | | | | Adds a hashCode method to the Settings class for Ant.Lex Spoon2013-06-261-0/+14
| | | | | | | |
| * | | | | | | Seals some case class hierarchies.Lex Spoon2013-06-2611-28/+28
| | | | | | | |
| * | | | | | | Unseal a uselessly sealed case class.Lex Spoon2013-06-261-1/+1
| | | | | | | |
| * | | | | | | Updates .gitignore files.Lex Spoon2013-06-266-0/+27
| | | | | | | |
* | | | | | | | Merge pull request #2694 from adriaanm/masterGrzegorz Kossakowski2013-07-0115-565/+322
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Merge 2.10.x into master
| * \ \ \ \ \ \ \ Merge 2.10.x into masterAdriaan Moors2013-06-282-5/+15
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #2686 from retronym/topic/partest-task-no-stack-traceAdriaan Moors2013-06-271-2/+3
| | |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Less noise on a partest failure.
| | | * | | | | | | | | Less noise on a partest failure.Jason Zaugg2013-06-271-2/+3
| | | |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Throwing a BuildException is the polite way to fail the Ant build. Before: BUILD FAILED /Users/jason/code/scala2/build.xml:1522: java.lang.RuntimeException: Test suite finished with 1 case failing: /Users/jason/code/scala2/test/files/pos/lub-dealias-widen.scala [FAILED] at scala.sys.package$.error(package.scala:27) [20 lines elided] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Total time: 2 minutes 35 seconds After: BUILD FAILED /Users/jason/code/scala2/build.xml:1522: Test suite finished with 1 case failing: /Users/jason/code/scala2/test/files/pos/lub-dealias-widen.scala [FAILED] Total time: 2 minutes 34 seconds
| | * | | | | | | | | Merge pull request #2655 from VladUreche/issue/7344Adriaan Moors2013-06-262-24/+147
| | |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | SI-7344 Specialize methods in private scopes
| | | * | | | | | | | | SI-7344 Specialize methods in private scopesVlad Ureche2013-06-252-24/+147
| | | |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2813-560/+307
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-254-9/+19
| | |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | SI-7571 Allow nesting of anonymous classes in value classes
| | | * | | | | | | | | SI-7571 Allow nesting of anonymous classes in value classesJason Zaugg2013-06-194-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | | | | | Merge pull request #2511 from ↵Adriaan Moors2013-06-242-546/+197
| | |\ \ \ \ \ \ \ \ \ \ | | | |_|/ / / / / / / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | viktorklang/wip-cleaner-Future-method-implementations-2.10-√ General SIP-14 Future method implementation cleanup
| | | * | | | | | | | | Refactoring to the scala-concurrent-tck.scalaViktor Klang2013-06-191-409/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - there were numerous logical issues with the former implementation - failed assertions may not fail the build - there was a lot of ceremony and noise
| | | * | | | | | | | | Cleaning up method implementations in FutureViktor Klang2013-06-191-137/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimizations: 1) Avoiding isDefinedAt + apply and using applyOrElse to allow for optimizations later 2) Reducing method sizes to be more JIT + inliner friendly 3) Reusing core combinators to reuse inliner/JIT optimizations and be more code-cache friendly
| | * | | | | | | | | | Merge pull request #2651 from VladUreche/issue/7343-2Adriaan Moors2013-06-185-21/+92
| | |\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | SI-7343 Fixed phase ordering in specialization
| | | * | | | | | | | | | SI-7343 Fixed phase ordering in specializationVlad Ureche2013-06-125-3/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #2646 from retronym/topic/duration-relax-2.10.xGrzegorz Kossakowski2013-06-181-2/+3
| | |\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | [backport] relax time constraint in duration-tck.scala (for Windows VMs)