summaryrefslogtreecommitdiff
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2075 from vigdorchik/tocakeAdriaan Moors2013-02-076-133/+154
|\ | | | | Add a request to presentation compiler to fetch doc comment information.
| * Add a request to presentation compiler to fetch doc comment information.Eugene Vigdorchik2013-02-066-133/+154
| | | | | | | | Refactor scaladoc base functionality to allow it to be mixed in with Global in the IDE.
* | Merge pull request #2068 from scalamacros/ticket/7064Adriaan Moors2013-02-0717-364/+203
|\ \ | | | | | | [nomaster] SI-7064 Reflection: forward compat for 2.10.1
| * | [nomaster] Revert "refactors handling of parent types"Eugene Burmako2013-02-0511-362/+186
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 40063b0009d55ed527bf1625d99a168a8faa4124. Conflicts: src/compiler/scala/tools/nsc/ast/parser/Parsers.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala
| * | [nomaster] Revert "introduces global.pendingSuperCall"Eugene Burmako2013-02-056-51/+66
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 0ebf72b9498108e67c2133c6522c436af50a18e8. Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala src/reflect/scala/reflect/internal/Trees.scala
| * | [nomaster] Revert "DummyTree => CannotHaveAttrs"Eugene Burmako2013-02-055-7/+7
| | | | | | | | | | | | | | | | | | | | | This reverts commit 838cbe623c142b7005446793948097f679219fe3. Conflicts: src/reflect/scala/reflect/api/Trees.scala
| * | [nomaster] Revert "more ListOfNil => Nil"Eugene Burmako2013-02-054-4/+4
| | | | | | | | | | | | This reverts commit bb9adfbd76af0a0281912fcef4bcaca409a7c9a3.
| * | [nomaster] Revert "s/SuperCallArgs/SuperArgs/"Eugene Burmako2013-02-052-9/+9
| | | | | | | | | | | | This reverts commit 2621918870e531b7a9bcccdf14bddea9b89804b2.
* | | Merge pull request #2059 from VladUreche/issue/7060James Iry2013-02-061-31/+67
|\ \ \ | | | | | | | | SI-7060 More conservative dead code elim marking
| * | | SI-7060 More conservative dead code elim markingVlad Ureche2013-02-051-31/+67
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In dead code elimination, a DROP instruction that gets marked as useful and can be reached via several paths needs to also mark all the reaching definitions as useful, else we'll get unbalanced stacks on the two paths. A simplistic example: ``` BB1: CALL X // useful, leaves a LONG on the stack JUMP BB3 BB2: LOAD_FIELD Y // not useful JUMP BB3 BB3: DROP LONG // useful because "CALL X" is useful // but unless we mark "LOAD_FIELD Y" as useful too // we'll get unbalanced stacks when reaching BB3 ``` This patch addresses the unbalanced stack problem by adding all the reaching definitions of a useful DROP as useful instructions too.
* | | Merge pull request #2051 from adriaanm/ticket-7039Adriaan Moors2013-02-042-29/+43
|\ \ \ | | | | | | | | SI-7039 unapplySeq result type independent of subpattern count
| * | | SI-7039 unapplySeq result type independent of subpattern countAdriaan Moors2013-02-012-29/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a bug in the implementation of the `unapplySeq` part of the spec below. An `unapply` method with result type `R` in an object `x` matches the pattern `x(p_1, ..., p_n)` if it takes exactly one argument and, either: - `n = 0` and `R =:= Boolean`, or - `n = 1` and `R <:< Option[T]`, for some type `T`. The argument pattern `p1` is typed in turn with expected type `T`. - Or, `n > 1` and `R <:< Option[Product_n[T_1, ..., T_n]]`, for some types `T_1, ..., T_n`. The argument patterns `p_1, ..., p_n` are typed with expected types `T_1, ..., T_n`. An `unapplySeq` method in an object `x` matches the pattern `x(p_1, ..., p_n)` if it takes exactly one argument and its result type is of the form `Option[S]`, where either: - `S` is a subtype of `Seq[U]` for some element type `U`, (set `m = 0`) - or `S` is a `ProductX[T_1, ..., T_m]` and `T_m <: Seq[U]` (`m <= n`). The argument patterns `p_1, ..., p_n` are typed with expected types `T_1, ..., T_m, U, ..., U`. Here, `U` is repeated `n-m` times.
* | | | Merge pull request #2063 from retronym/ticket/6667-2.10.x-revertAdriaan Moors2013-02-041-1/+6
|\ \ \ \ | | | | | | | | | | [nomerge] SI-6667 Demote a new ambiguity error to a lint warning.
| * | | | [nomerge] SI-6667 Demote a new ambiguity error to a lint warning.Jason Zaugg2013-02-041-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the interests of not breaking source compability. A few projects are relying on this bug. Should not be merged to master.
* | | | | Merge pull request #2050 from kzys/jira-6017-v2Adriaan Moors2013-02-043-20/+25
|\ \ \ \ \ | | | | | | | | | | | | SI-6017 Scaladoc: Fix dangling links on index.html
| * | | | | SI-6017 Scaladoc: Show all letters without dangling linksKato Kazuyoshi2013-02-032-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | Use <span> instead of <a href="..."> if there is no page on the letter.
| * | | | | SI-6017 Generate Scaladoc's index links in Scala sideKato Kazuyoshi2013-02-032-19/+14
| | | | | | | | | | | | | | | | | | | | | | | | There is no reason to do it in JavaScript.
* | | | | | Merge pull request #2048 from dragos/issue/fix-SI-6578Adriaan Moors2013-02-044-26/+6
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix SI-6578. Deprecated `askType` because of possible race conditions in...
| * | | | | | Fix SI-6578. Deprecated `askType` because of possible race conditions in ↵Iulian Dragos2013-02-014-26/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | type checker. AskType triggers type-checks the given source and returns a typed tree. If that source is already loaded (a precondition), the background compilation loop may actually be compiling that same source. The new type checker run may then get into an inconsistent state and try to add twice the same synthetic members, like `canEqual`. Most of the times, `askLoadedTyped` (that waits for the type checker to finish, and returns the most recent typed tree) *is* the right way to go. Removed occurrences of the deprecated method in tests and interactive.REPL. @reviewby @huitseeker,@odersky
* | | | | | | Merge pull request #2040 from scalamacros/ticket/7008Adriaan Moors2013-02-041-7/+2
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-7008 @throws annotations are now populated in reflect
| * | | | | | | pullrequest feedbackEugene Burmako2013-02-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/scala/scala/pull/2040
| * | | | | | | SI-7008 @throws annotations are now populated in reflectEugene Burmako2013-02-011-7/+1
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Runtime reflection in JavaMirrors previously forgot to fill in @throws when importing Java reflection artifacts. Now this is fixed. Note that generic exception types used in `throws` specifications will be garbled (i.e. erased), because we don't use `getGenericExceptionTypes` in favor of just `getExceptionTypes` to stay compatible with the behavior of ClassfileParser. That's a bug, but a separate one and should be fixed separately. Also note that this commit updated javac-artifacts.jar, because we need to test how reflection works with javac-produced classfiles. The sources that were used to produce those classfiles can be found in the jar next to the classfiles.
* | | | | | | Merge pull request #1992 from retronym/ticket/7033Adriaan Moors2013-02-042-6/+7
|\ \ \ \ \ \ \ | |_|_|_|_|/ / |/| | | | | | SI-7033 Be symful when creating factory methods.
| * | | | | | SI-7033 Be symful when creating factory methods.Jason Zaugg2013-02-022-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicit class factory methods were synthesizing the reference to the class as `Ident(classDef.name)`, which was unhygienic in case of `implicit class X[X]`. To use symbols without causing a cycle, I switched from `REF(symbol)` to `Ident(symbol)`. The former calls into: at scala.reflect.internal.TreeGen.mkAttributedSelect(TreeGen.scala:184) at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:124) at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:130) at scala.tools.nsc.ast.TreeDSL$CODE$.REF(TreeDSL.scala:307) which forces the info of enclosing module and forms a cycle.
* | | | | | | Merge pull request #2001 from JamesIry/2.10.x_SI-5313Grzegorz Kossakowski2013-02-041-13/+109
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | | | SI-5313 Do not eliminate stores that potentially wipe referenes
| * | | | | | SI-5313 Minor code cleanup for store clobberingJames Iry2013-02-021-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Used withDefault on the localStores map to simplify the code. Added a type alias for the (BasicBlock, Int) tuple type that was used throughout the code to represent the location of an instruction.
| * | | | | | SI-5313 Eliminate more stores by replacing clobbers with null storesJames Iry2013-01-301-50/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an unused store clobbers a previous store, replace it with storing a null. Don't mark clobbers as "used" so that the original clobber and all following clobbers can still be eliminated.
| * | | | | | SI-5313 Do not eliminate stores that potentially wipe referenesJames Iry2013-01-281-7/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Storing to local variables of reference or array type is indirectly observable because it potentially allows gc to collect an object. So this commit makes DeadCodeElimination mark a store necessary if it assigns to a local that potentially stored by a previous necessary store.
* | | | | | | Merge pull request #2022 from lrytz/analyzerPlugins210Lukas Rytz2013-02-039-241/+613
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Analyzer Plugins
| * | | | | | | Fix context for type checking early initializersLukas Rytz2013-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: scala> class A { class C extends { val x: A = this } with AnyRef } <console>:7: error: type mismatch; found : A.this.C required: A class A { class C extends { val x: A = this } with AnyRef } ^ Note that the same thing is necessary and already done in Namers (see def createNamer). The whole logic of when and how to create contexts should be factored out and reused in Namer and Typer. ( My Hobby [1]: detecting compiler by just looking at its soruce [1] http://www.explainxkcd.com/wiki/index.php?title=Category:My_Hobby )
| * | | | | | | Analyzer PluginsLukas Rytz2013-02-036-28/+265
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AnnotationCheckers are insufficient because they live outside the compiler cake and it's not possible to pass a Typer into an annotation checker. Analyzer plugins hook into important places of the compiler: - when the namer assigns a type to a symbol (plus a special hook for accessors) - before typing a tree, to modify the expected type - after typing a tree, to modify the type assigned to the tree Analyzer plugins and annotation checker can be activated only during selected phases of the compiler. Refactored the CPS plugin to use an analyzer plugin (since adaptToAnnotations is now part of analyzer plugins, no longer annotation checkers).
| * | | | | | | SI-1803, plus documentation and cleanups in Namers, mainly in typeSigLukas Rytz2013-02-034-211/+338
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - when typing (and naming) a ValDef, tpt and rhs are now type checked in the same context (the inner / ValDef context). this does not change any behavior, but is more uniform (same as for DefDef). martin told me (offline) that this change is desirable if it doesn't break anything. (it doesn't). - typeSig is now more uniform with a separate method for each case (methodSig, valDefSig, etc). methodSig was cleaned up (no more variables) and documented. the type returned by methodSig no longer contains / refers to type skolems, but to the actual type parameters (so we don't need to replace the skolems lateron). - documentation on constructor contexts, type skolems - more tests for SI-5543
| * | | | | | | Allow for Function treess with refined types in UnCurry.Lukas Rytz2013-02-031-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also removes an unnecessary condition in UnCurry, isFunctionType(fun.tpe) is always true.
| * | | | | | | case module toString is syntheticLukas Rytz2013-02-031-1/+1
| | | | | | | |
* | | | | | | | Merge pull request #1976 from retronym/backport/1468James Iry2013-02-032-72/+128
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | [backport] SI-6428 / SI-7022 Value class with bounds
| * | | | | | | | [backport] SI-6482, lost bounds in extension methods.Jason Zaugg2013-02-022-72/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashed commit of the following: commit 5c156185306ba797c0443d9dccae0ae7ce462a1f Author: Paul Phillips <paulp@improving.org> Date: Sat Oct 6 15:42:50 2012 -0700 A little more housecleaning in ExtensionMethods. The only real contribution is readability. (cherry picked from commit 61f12faacaaccf366f9211ba6493fb042a91f1d2) Conflicts: src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala commit 79f443edf584745d614e24fb9ca6644c6b18d439 Author: Paul Phillips <paulp@improving.org> Date: Sat Oct 6 14:22:19 2012 -0700 Incorporated pull request feedback. (cherry picked from commit 153ccb4757718cceb219988f30381f73362e6075) commit 707f580b0cdcb01e27ca4c76991dea427945b5bd Author: Paul Phillips <paulp@improving.org> Date: Sat Oct 6 10:20:45 2012 -0700 Fix for SI-6482, lost bounds in extension methods. That was a good one. How to create a new method with type parameters from multiple sources, herein. (cherry picked from commit ff9f60f420c090b6716c927ab0359b082f2299de) commit 8889c7a13f74bc175e48aa2209549089a974c2af Author: Paul Phillips <paulp@improving.org> Date: Fri Oct 5 22:19:52 2012 -0700 Responded to comment about how many isCoercibles there are. I make the case that there is only one. (cherry picked from commit 883f1ac88dd7cec5882d42d6b48d7f267d1f6e00)
* | | | | | | | | Merge pull request #2033 from adriaanm/patmat-optAdriaan Moors2013-02-031-41/+145
|\ \ \ \ \ \ \ \ \ | |_|_|_|_|_|/ / / |/| | | | | | | | pattern matching efficiency: addresses SI-6686 and SI-6941, affects SI-5739
| * | | | | | | | SI-6686 drop valdef unused in flatMapCond's blockAdriaan Moors2013-01-311-5/+11
| | | | | | | | |
| * | | | | | | | no type test if static type <:< primitive value classAdriaan Moors2013-01-311-18/+26
| | | | | | | | |
| * | | | | | | | don't store subpats bound to underscoreAdriaan Moors2013-01-311-11/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | also, tweak fix in place for SI-5158 to appease SI-6941 don't store mutable fields from scala.* as we can assume these classes are well-behaved and do not mutate their case class fields
| * | | | | | | | no null check for type-tested unapply argAdriaan Moors2013-01-311-6/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pattern matching on case classes where pattern is not known to be a subclass of the unapply's argument type used to result in code like: ``` if (x1.isInstanceOf[Foo]) { val x2 = x1.asInstanceOf[Foo] if (x2 != null) { // redundant ... } } ``` this wastes byte code on the redundant null check with this patch, when previous type tests imply the variable cannot be null, there's no null check
| * | | | | | | | refactor: prepare null check redundancy analysisAdriaan Moors2013-01-311-13/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this commit doesn't change any behavior
* | | | | | | | | Merge pull request #1911 from kzys/jira-4976Adriaan Moors2013-02-021-6/+9
|\ \ \ \ \ \ \ \ \ | |_|_|/ / / / / / |/| | | | | | | | SI-4976 Scaladoc: Add a source link to package objects
| * | | | | | | | SI-4976 Scaladoc: Add a source link to package objectsKato Kazuyoshi2013-01-171-6/+9
| | | | | | | | |
* | | | | | | | | Merge pull request #2024 from scalamacros/ticket/6812Eugene Burmako2013-02-013-3/+9
|\ \ \ \ \ \ \ \ \ | |_|_|/ / / / / / |/| | | | | | | | SI-6812 scaladoc can opt out of expanding macros
| * | | | | | | | SI-6812 scaladoc can opt out of expanding macrosEugene Burmako2013-01-313-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a temporary change, possible only because macros currently can't affect the global symbol table (except for the case when they will steer inference of a method's return type). Later on, e.g. with the addition of c.introduceTopLevel in master, we will have to upgrade Scaladoc to allow for separate generation of documentation, because then we'll be forced to expand macros in order to get the whole picture of the code.
* | | | | | | | | Merge pull request #1979 from retronym/backport/1499James Iry2013-02-011-9/+15
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | [backport] Fix for SI-6206, inconsistency with apply.
| * | | | | | | | | [backport] Fix for SI-6206, inconsistency with apply.Jason Zaugg2013-01-261-9/+15
| |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashed commit of the following: commit f6bbf85150cfd7e461989ec1d6765ff4b4aeba51 Author: Paul Phillips <paulp@improving.org> Date: Mon Oct 1 09:10:45 2012 -0700 Fix for SI-6206, inconsistency with apply. The code part of this patch is 100% written by retronym, who apparently has higher standards than I do because I found it just lying around in his repository. I think I'll go pick through his trash and see if he's throwing away any perfectly good muffins. I made the test case more exciting so as to feel useful. (cherry picked from commit 267650cf9c3b07e360a59f3c5b70b37fea9de453)
* | | | | | | | | Merge pull request #1975 from retronym/ticket/6601-revertJames Iry2013-02-012-2/+1
|\ \ \ \ \ \ \ \ \ | |_|_|_|_|_|_|/ / |/| | | | | | | | Revert "SI-6601 Publicise derived value contstructor after pickler"
| * | | | | | | | Revert "SI-6601 Publicise derived value contstructor after pickler"Jason Zaugg2013-01-262-2/+1
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit b07228aebe7aa620af45a681ef60d945ffc65665. The remedy was far worse than the disease: % cat sandbox/test.scala class V private (val a: Any) extends AnyVal % RUNNER=scalac scala-hash b07228aebe sandbox/test.scala [info] b07228aebe => /Users/jason/usr/scala-v2.10.0-256-gb07228a % scala-hash b07228aebe [info] b07228aebe => /Users/jason/usr/scala-v2.10.0-256-gb07228a Welcome to Scala version 2.10.1-20130116-230935-b07228aebe (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_27). Type in expressions to have them evaluated. Type :help for more information. scala> def foo(v: V) = v.a == v.a exception when typing v.a().==(v.a())/class scala.reflect.internal.Trees$Apply constructor V in class V cannot be accessed in object $iw in file <console> scala.reflect.internal.Types$TypeError: constructor V in class V cannot be accessed in object $iw