summaryrefslogtreecommitdiff
path: root/src/continuations/plugin
Commit message (Collapse)AuthorAgeFilesLines
* Modularize continuations plugin.Adriaan Moors2013-12-136-1646/+0
| | | | | The continuations plugin and library will still ship with 2.11 (albeit unsupported). They now reside at https://github.com/scala/scala-continuations.
* Merge pull request #2859 from som-snytt/issue/7622-phaserGrzegorz Kossakowski2013-09-122-21/+24
|\ | | | | SI-7622 Clean Up Phase Assembly
| * SI-7622 Clean Up Phase AssemblySom Snytt2013-08-212-21/+24
| | | | | | | | | | | | | | | | Let optimiser components and continuations plugin opt-out when required flags are not set. Wasted time on a whitespace error in check file, so let --debug dump the processed check file and its diff.
* | Revert a tiny recent refactoring in SelectiveCPSTransformJason Zaugg2013-09-111-3/+7
| | | | | | | | | | | | | | | | The refactoring in 7e6c723df means that we can't build the CPS plugin if we skip locker in development mode. This commit backs out the refactoring and leaves a TODO comment to perform it at a later date.
* | refine block and applied/typeapplied splicing/matching semanticsDen Shabalin2013-09-051-5/+3
|/ | | | | | | | | | | | | | | | | | | 1. blocks now match single term-level expressions to account for automatic block elimination. E.g. val q"{ ..$stats }" = q"foo" will match into stats = List(q"foo"). This is useful to uniformly deal with blocks on term level. 2. blocks in quasiquotes collapse into single expressions 3. Applied and TypeApplied now have constructors too which helps to unify matching and extraction in quasiquote reifier 4. TypeApplied now matches AppliedTypeTree too 5. Add Syntactic prefix to Applied and TypeApplied
* SI-7624 Fix a few remaining -Xlint warnings ...Simon Ochsenreither2013-08-151-1/+0
| | | | | in various places. This includes actors, compiler (mostly some new macro parts) continuations, partest, scaladoc, scalap.
* SI-7174 Fix initialization issuesSimon Ochsenreither2013-07-061-7/+3
| | | | | | | | | | | | | 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.
* Concision contribution.Paul Phillips2013-05-232-6/+6
| | | | | | | | | | | | | | | | | | | | | We have lots of core classes for which we need not go through the symbol to get the type: ObjectClass.tpe -> ObjectTpe AnyClass.tpe -> AnyTpe I updated everything to use the concise/direct version, and eliminated a bunch of noise where places were calling typeConstructor, erasedTypeRef, and other different-seeming methods only to always wind up with the same type they would have received from sym.tpe. There's only one Object type, before or after erasure, with or without type arguments. Calls to typeConstructor were especially damaging because (see previous commit) it had a tendency to cache a different type than the type one would find via other means. The two types would compare =:=, but possibly not == and definitely not eq. (I still don't understand what == is expected to do with types.)
* Eliminated RETmode.Paul Phillips2013-05-111-2/+2
| | | | It becomes context mode "ReturnExpr".
* Corralling Modes into a smaller pen.Paul Phillips2013-05-111-15/+11
| | | | | | | | | | | | | | | | | | | | Attempting to reduce the frequency of low-level operations with modes. I mean stuff like this: if ((mode & (EXPRmode | LHSmode)) == EXPRmode) THey don't make those ten line boolean guards any easier to understand. Hopefully this will lead us toward eliminating some of the modes entirely, or at least better isolating their logic rather than having it interspersed at arbitrary points throughout the typer. Modes are in their entirety a leaked implementation detail. Typing a tree requires a tree and optionally an expected type. It shouldn't require a bucket of state bits. In subsequent commits I will start eliminating them. This commit also breaks adapt down into more digestible chunks.
* Doc -> C-style comments for local symbols to avoid "discardingEugene Vigdorchik2013-03-211-3/+3
| | | | | unmoored doc comment" warning when building distribution for scala itself.
* Merge commit 'f3cdf146709e0dd98533ee77e8ca2566380cb932'Lukas Rytz2013-02-042-12/+20
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/compiler/scala/tools/nsc/typechecker/Namers.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala src/reflect/scala/reflect/internal/AnnotationCheckers.scala src/reflect/scala/reflect/internal/Symbols.scala
| * Analyzer PluginsLukas Rytz2013-02-032-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* | Changes many calls to normalize to dealiasWiden.Paul Phillips2013-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Calling normalize is very aggressive and is usually the wrong thing. It is one of the leading contributors to non-determinism in compiler outcomes (often of the form "I gave a debugging or logging compiler option and it started/stopped working") and should be used only in very specific circumstances. Almost without exception, dealiasWiden is what you want; not widen, not normalize. If possible I will remove normalize from Type entirely, making it private to those areas of the compiler which actually require it.
* | Made "mode" into a value class.Paul Phillips2013-01-091-19/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an obvious place to apply value class goodness and collect some safety/sanity in typing modes. It does show off a challenge in introducing value classes without disruption: there's no way to deprecate the old signature of 'typed', 'adapt', etc. because they erase the same. class Bippy(val x: Int) extends AnyVal class A { @deprecated("Use a bippy") def f(x: Int): Int = 5 def f(x: Bippy): Int = x.x } ./a.scala:5: error: double definition: method f:(x: Bippy)Int and method f:(x: Int)Int at line 4 have same type after erasure: (x: Int)Int An Int => Mode implicit handles most uses, but nothing can be done to avoid breaking anything which e.g. extends Typer and overrides typed.
* | Eliminate allocations in CPSAnnotationChecker.Paul Phillips2012-12-271-3/+5
| |
* | Merge pull request #1506 from som-snytt/issue/6446-plugin-descPaul Phillips2012-12-222-1/+4
|\ \ | | | | | | PluginComponent contributes description to -Xshow-phases. (Fixes SI-6446)
| * | PluginComponent contributes description to -Xshow-phases.Som Snytt2012-12-182-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Global, SubComponent is called a phase descriptor, but it doesn't actually have a description. (Phase itself does.) This fix adds a description to PluginComponent so that plugins can describe what they do in -Xshow-phases. Elliptical descriptions Exploded archives Plugged-in partest Roundup at the Little h!
* | | Eliminating var-like setter tpe_= on Tree.Paul Phillips2012-12-192-4/+4
|/ / | | | | | | | | | | | | | | | | Deprecated tpe_= on Tree, which is redundant with and less useful than setType. To provide a small layer of insulation from the direct nulling out of mutable fields used to signal the typer, added def clearType() which is merely tree.tpe = null but is shamefaced about the null and var-settings parts like a respectable method should be.
* | Remove TermName -> String implicit.Paul Phillips2012-12-021-1/+1
| | | | | | | | | | | | | | | | | | These implicits were crutches going back to a much Stringier time. Of course "with great type safety comes great verbosity" and no doubt this could be cleaned up significantly further. At least the underpinnings are consistent now - the only implicits involving name should be String -> TypeName and String -> TermName.
* | Remove Name -> TermName implicit.Paul Phillips2012-12-011-1/+1
| | | | | | | | And simplify the name implicits.
* | Remove unused imports in continuations.Paul Phillips2012-11-194-14/+0
| |
* | Merge branch 'merge-2.10.0-wip' into merge-2.10.xPaul Phillips2012-10-311-11/+11
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * merge-2.10.0-wip: Use Typed rather than .setType Wider use and a new variant of typedPos. SI-6575 Plug inference leak of AbstractPartialFun Remove compiler phases that don't influence scaladoc generation. Disabled generation of _1, _2, etc. methods. SI-6526 Additional test case. Fix SI-6552, regression with self types. avoid single-art assert where harmful in duration-tck Fix for SI-6537, inaccurate unchecked warning. Crash on missing accessor (internal bug in the lazy vals implementation) instead of trying to recover from the bug Incorporated changes suggested in code review Added one more test for SI-6358 Closes SI-6358. Move accessor generation for lazy vals to typers. SI-6526 Tail call elimination should descend deeper. Remove unneeded calls to substring() Changes Tree and Type members from vals to defs. Scaladoc knows the package structure of the libraries, so don't include them in external documentation setting. Fixes SI-6170: issue with dragging scaladoc splitter over central iframe Added a Swing ColorChooser wrapper Added a Swing PopupMenu wrapper Conflicts: src/compiler/scala/reflect/reify/phases/Reshape.scala src/compiler/scala/tools/nsc/typechecker/Duplicators.scala src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala src/reflect/scala/reflect/internal/Types.scala test/files/neg/unchecked-knowable.check
| * Merge remote-tracking branch 'origin/2.10.0-wip' into merge-2.10.0-wipPaul Phillips2012-10-311-11/+11
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # By Jason Zaugg (5) and others # Via Josh Suereth (5) and others * origin/2.10.0-wip: Use Typed rather than .setType Wider use and a new variant of typedPos. SI-6575 Plug inference leak of AbstractPartialFun Disabled generation of _1, _2, etc. methods. SI-6526 Additional test case. Fix SI-6552, regression with self types. avoid single-art assert where harmful in duration-tck Fix for SI-6537, inaccurate unchecked warning. SI-6526 Tail call elimination should descend deeper. Changes Tree and Type members from vals to defs. Fixes SI-6170: issue with dragging scaladoc splitter over central iframe
| | * Wider use and a new variant of typedPos.Jason Zaugg2012-10-281-11/+11
| | | | | | | | | | | | | | | | | | It's safe to replace `localTyper.typed(atPos(pos)(tree))` with `localTyper.typedPos(pos)(tree)` given that we're all in the same cake and we'll get to the same `atPos`.
| * | Closes SI-6358. Move accessor generation for lazy vals to typers.Hubert Plociniczak2012-10-182-4/+11
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Until now lazy accessors were handled somehow special because their symbol was created in typers but the corresponding tree was only added in Refchecks. This irregularity caused serious problems for value classes. Also it now looks just better when lazy value is treated in a similar way as other fields. I needed to adapt reifier so that it handles the new implementation correctly. Previously it had to recreate lazy val only by removing defdef and renaming. Now we basically need to recreate lazy val from scratch. There is one minor change to cps plugin but that is still fine because lazy vals were never really part of the transformation. Some range positions needed to be fixed manually. We could do it at the creation time but that would require a lot more "if (symbol.isLazy)" conditions for MethodSyntheis and Symbol/Tree creation and would just unnecessary complicate api. If someone has a better idea, please speak up. Range positions changes were necessary because previously accessors were created at refchecks and they weren't checked by validator (even though they were wrong). This commit removes lazy val implementation restriction introduced for 2.10.0. (cherry-picked from 981424b)
* | Closes SI-6358. Move accessor generation for lazy vals to typers.Hubert Plociniczak2012-10-092-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | Until now lazy accessors were handled somehow special because their symbol was created in typers but the corresponding tree was only added in Refchecks. This irregularity caused serious problems for value classes. Also it now looks just better when lazy value is treated in a similar way as other fields. I needed to adapt reifier so that it handles the new implementation correctly. Previously it had to recreate lazy val only by removing defdef and renaming. Now we basically need to recreate lazy val from scratch. There is one minor change to cps plugin but that is still fine because lazy vals were never really part of the transformation. Some range positions needed to be fixed manually. We could do it at the creation time but that would require a lot more "if (symbol.isLazy)" conditions for MethodSyntheis and Symbol/Tree creation and would just unnecessary complicate api. If someone has a better idea, please speak up. Range positions changes were necessary because previously accessors were created at refchecks and they weren't checked by validator (even though they were wrong). This commit removes lazy val implementation restriction introduced for 2.10.0.
* | All the actual changes of tpe to tpe_* or tpeHK.Paul Phillips2012-10-024-11/+9
|/ | | | | | | These are the call sites which formerly could be seen to call .tpe on a symbol with unapplied type parameters. Now each such call site makes an explicit choice about what is intended for the result type.
* Improve doc comment on adaptTypeOfReturn in CPSAnnotationCheckerphaller2012-08-201-3/+7
|
* Simplify the adaptation of types of return expressionsphaller2012-08-122-10/+25
| | | | | | | | | | Add `adaptTypeOfReturn` hook to `AnnotationCheckers`. Move adaptation of types of return expressions from `addAnnotations` to `typedReturn` via `adaptTypeOfReturn` hook. This resolves an inconsistency where previously types could have a plus marker without additional CPS annotations. This also adds additional test cases.
* Revert "Add missing cases in tail return transform"phaller2012-08-092-11/+8
| | | | This reverts commit 8d020fab9758ced93eb18fa51c906b95ec104aed.
* Add missing cases in tail return transformphaller2012-08-092-8/+11
| | | | | Disabled warnings that no longer apply because of tail returns. Add several test cases.
* Replace CheckCPSMethodTraverser with additional parameter on transformer methodsphaller2012-08-083-66/+28
| | | | | | | Other fixes: - remove CPSUtils.allCPSMethods - add clarifying comment about adding a plus marker to a return expression
* SI-5314 - CPS transform of return statement failsphaller2012-08-083-13/+128
| | | | | | | | | | | | | | | | | | | | | | | | | Enable return expressions in CPS code if they are in tail position. Note that tail returns are only removed in methods that do not call `shift` or `reset` (otherwise, an error is reported). Addresses the issues pointed out in a previous pull request: https://github.com/scala/scala/pull/720 - Addresses all issues mentioned here: https://github.com/scala/scala/pull/720#issuecomment-6429705 - Move transformation methods to SelectiveANFTransform.scala: https://github.com/scala/scala/pull/720#commitcomment-1477497 - Do not keep a list of tail returns. Tests: - continuations-neg/t5314-missing-result-type.scala - continuations-neg/t5314-type-error.scala - continuations-neg/t5314-npe.scala - continuations-neg/t5314-return-reset.scala - continuations-run/t5314.scala - continuations-run/t5314-2.scala - continuations-run/t5314-3.scala
* Merge pull request #982 from adriaanm/ticket-wolfcryJosh Suereth2012-08-031-5/+5
|\ | | | | SI-5930 SI-5897 reduce redundant warnings in matches, fix flags usage
| * move synthetic case symbol detection to treeInfoAdriaan Moors2012-07-241-5/+5
| | | | | | | | encapsulate creating synthetic case labels while we're at it
* | Eliminated all the current feature warnings.Paul Phillips2012-07-271-1/+1
|/ | | | This pretty much takes us down to deprecation and inliner warnings.
* SI-5999 a real fix to the packageless problemEugene Burmako2012-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After a discussion on a reflection meeting on Jul 17 we concluded that we should split staticModule into staticModule and staticPackage to remove the ambiguity between packageless objects and packageless packages (more in the comments in the body of the commit). The motivation is verbosely outlined in the comments, but the bottom line is that Scala allows packages and packageless objects to have the same name within the same program. Therefore at times we need to disambiguate, hence the introduction of the staticPackage method. As of such staticModule no longer works for packages. In the same fashion staticPackage doesn't work for modules. This is done to ensure robustness of reification. I would like to do the same for getModule in Definitions, but we have to maintain backward compatibility. That's why I retained the old behavior, but replaced getModule invocations with getPackage where appropriate to be in line with staticModule and staticPackage. Another important thing that follows from the discussion is that both staticClass and staticModule prefer parent packages over parent objects in cases of ambiguity. Say, if we have the following snippet of code: object B { class C } next to package B { class C } then staticClass("B.C") will never even consider a C inside the object B. This is how scalac operates, so we decided to be consistent here. Finally reification logic got changed to distinguish between staticModule and staticPackage, and to allow for the fact that staticClass and staticModule prefer parent packages to parent objects.
* Revert pull request #720 (CPS: enable return expressions in CPS code if they ↵phaller2012-06-273-68/+2
| | | | | | | | | are in tail position) Reverts commit 0ada0706746c9c603bf5bc8a0e6780e5783297cf. Reverts commit 51c92f02229098d0b402a65a72267f7a17984022. Reverts commit cdfbe8e39fbbec00c969cd74f117ae410b98b40b. Reverts commit 796024c7429a03e974a7d8e1dc5c80b84f82467d.
* Merge pull request #711 from dragos/issue/no-crash-missing-cpsParamAdriaan Moors2012-06-211-1/+3
|\ | | | | Don't crash if cpsParam is not on the classpath.
| * Don't crash if cpsParam is not on the classpath.Iulian Dragos2012-06-131-1/+3
| | | | | | When checking if a piece of code needs the continuations plugin, the cpsParam classes may not be on the class path. Assume it does not need it in that case.
* | Remove unneeded use of Tree#idphaller2012-06-152-16/+16
| |
* | Replace context stack of AnnotationChecker with new mode for typing returnsphaller2012-06-152-15/+7
| |
* | CPS: enable return expressions in CPS code if they are in tail positionphaller2012-06-143-2/+76
|/ | | | | | | | | | | Adds a stack of context trees to AnnotationChecker(s). Here, it is used to enforce that adaptAnnotations will only adapt the annotation of a return expression if the expected type is a CPS type. The remove-tail-return transform is reasonably general, covering cases such as try-catch-finally. Moreover, an error is thrown if, in a CPS method, a return is encountered which is not in a tail position such that it will be removed subsequently.
* The new reflectionEugene Burmako2012-06-082-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A must read: "SIP: Scala Reflection": https://docs.google.com/document/d/1Z1VhhNPplbUpaZPIYdc0_EUv5RiGQ2X4oqp0i-vz1qw/edit Highlights: * Architecture has undergone a dramatic rehash. * Universes and mirrors are now separate entities: universes host reflection artifacts (trees, symbols, types, etc), mirrors abstract loading of those artifacts (e.g. JavaMirror loads stuff using a classloader and annotation unpickler, while GlobalMirror uses internal compiler classreader to achieve the same goal). * No static reflection mirror is imposed on the user. One is free to choose between lightweight mirrors and full-blown classloader-based mirror (read below). * Public reflection API is split into scala.reflect.base and scala.reflect.api. The former represents a minimalistic snapshot that is exactly enough to build reified trees and types. To build, but not to analyze - everything smart (for example, getting a type signature) is implemented in scala.reflect.api. * Both reflection domains have their own universe: scala.reflect.basis and scala.reflect.runtime.universe. The former is super lightweight and doesn't involve any classloaders, while the latter represents a stripped down compiler. * Classloader problems from 2.10.0-M3 are solved. * Exprs and type tags are now bound to a mirror upon creation. * However there is an easy way to migrate exprs and type tags between mirrors and even between universes. * This means that no classloader is imposed on the user of type tags and exprs. If one doesn't like a classloader that's there (associated with tag's mirror), one can create a custom mirror and migrate the tag or the expr to it. * There is a shortcut that works in most cases. Requesting a type tag from a full-blown universe will create that tag in a mirror that corresponds to the callsite classloader aka `getClass.getClassLoader`. This imposes no obligations on the programmer, since Type construction is lazy, so one can always migrate a tag into a different mirror. Migration notes for 2.10.0-M3 users: * Incantations in Predef are gone, some of them have moved to scala.reflect. * Everything path-dependent requires implicit prefix (for example, to refer to a type tag, you need to explicitly specify the universe it belongs to, e.g. reflect.basis.TypeTag or reflect.runtime.universe.TypeTag). * ArrayTags have been removed, ConcreteTypeTag have been renamed to TypeTags, TypeTags have been renamed to AbsTypeTags. Look for the reasoning in the nearby children of this commit. Why not in this commit? Scroll this message to the very bottom to find out the reason. * Some of the functions have been renamed or moved around. The rule of thumb is to look for anything non-trivial in scala.reflect.api. Some of tree build utils have been moved to Universe.build. * staticModule and staticClass have been moved from universes to mirrors * ClassTag.erasure => ClassTag.runtimeClass * For the sake of purity, type tags no longer have erasures. Use multiple context bounds (e.g. def foo[T: ru.TypeTag : ClassTag](...) = ...) if you're interested in having both erasures and types for type parameters. * reify now rolls back macro applications. * Runtime evaluation is now explicit, requires import scala.tools.reflect.Eval and scala-compiler.jar on the classpath. * Macro context now has separate universe and mirror fields. * Most of the useful stuff is declared in c.universe, so be sure to change your "import c.universe._" to "import c.mirror._". * Due to the changes in expressions and type tags, their regular factories are now really difficult to use. We acknowledge that macro users need to frequently create exprs and tags, so we added old-style factories to context. Bottom line: almost always prepend Expr(...)/TypeTag(...) with "c.". * Expr.eval has been renamed to Expr.splice. * Expr.value no longer splices (it can still be used to express cross-stage path-dependent types as specified in SIP-16). * c.reifyTree now has a mirror parameter that lets one customize the initial mirror the resulting Expr will be bound to. If you provide EmptyTree, then the reifier will automatically pick a reasonable mirror (callsite classloader mirror for a full-blown universe and rootMirror for a basis universe). Bottom line: this parameter should be EmptyTree in 99% of cases. * c.reifyErasure => c.reifyRuntimeClass. Known issues: * API is really raw, need your feedback. * All reflection artifacts are now represented by abstract types. This means that pattern matching against them will emit unchecked warnings. Adriaan is working on a patch that will fix that. WARNING, FELLOW CODE EXPLORER! You have entered a turbulence zone. For this commit and its nearby parents and children tests are not guaranteed to work. Things get back to normal only after the "repairs the tests after the refactoring spree" commit. Why so weird? These twentish changesets were once parts of a humongous blob, which spanned 1200 files and 15 kLOC. I did my best to split up the blob, so that the individual parts of the code compile and make sense in isolation. However doing the same for tests would be too much work.
* Fix for SI-3718.Paul Phillips2012-05-031-4/+15
| | | | | | | And for a bunch of other tickets where we unleash a stack trace rather than printing a sensible error message. But SI-3718 is a continuations plugin crash, now a reasonable if somewhat vague error.
* moving patmat to its own phaseAdriaan Moors2012-05-023-55/+38
| | | | | | | | | | | | | | | | | | | | sort field accessors, necessary after typers -- apparently... don't throw TypeError, use issueTypeError don't run patmat phase when -Xoldpatmat only virtualize matches when -Xexperimental recycle cps type of match for re-typechecking: when one of the internal cps-type-state annotations is present, strip all CPS annotations a cps-type-state-annotated type makes no sense as an expected type (matchX.tpe is used as pt in translateMatch) don't synth FunctionN impls during typer, only do this for PartialFunction updated check now function synth for match is deferred until uncurry patmat-transform try/catch with match in cps cleanup in selective anf remove TODO: can there be cases that are not CaseDefs -- nope
* restore typedMatchAnonFun in all its gloryAdriaan Moors2012-04-143-30/+28
| | | | | | | | | detect partialfunction in cpsannotationchecker emit apply/isDefinedAt if PF has @cps targs (applyOrElse can't be typed) further hacky improvements to selective anf better try/catch support in selective cps using freshly minted anonfun match make virtpatmat resilient to scaladoc (after uncurry, don't translate matches TODO: factor out translation all together so presentation compiler/scaladoc can skip it)
* virtpatmat: initial CPS supportAdriaan Moors2012-04-142-69/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | typers&patmatvirtualizer have ad-hoc support for dropping annotations in a way that makes the CPS plugins happy... this is not ideal, but unless virtpatmat runs after the plugin phases, I don't see how to solve it running virtpatmat after the CPS plugin would mean the pattern matching evaluation cannot be captured by CPS, so it's not even desirable to move it to a later phase - typedIf must lub annotated types - drop selector.tpe's annotations - drop annots in matchEnd's argument type - deal with annots in casts synth by in virtpatmat (drop them from type arg to asInstanceof, recover them using type ascription) - workaround skolemize existential dropping annots CPS is the main reason why typedMatchAnonFun is not used anymore, and PartialFunction synthesis is moved back to uncurry (which is quite painful due to labeldefs being so broken) we can't synth partialfunction during typer since T @cps[U] does not conform to Any, so we can't pass it as a type arg to PartialFunction, so we can't type a cps-transformed PF after the CPS plugin, T @cps[U] becomes ControlContext[...], which is a type we can pass to PartialFunction virtpatmat is now also run until right before uncurry (so, can't use isPastTyper, although it means more or less the same thing -- we don't run after uncurry) the main functional improvements are in the selective ANF transform its treatment of labeldefs was broken: for example, LabelDef L1; LabelDef L2 --> DefDef L1; L1(); DefDef L2; L2() but this does not take into account L1 may jump over L2 to another label since methods always return (or fail), and the ANF transform generates ValDefs to store the result of those method calls, both L1 and L2 would always be executed (so you would run a match with N cases N times, with each partial run starting at a later case) also fixed a couple of weird bugs in selective anf that caused matches to be duplicated (with the duplicate being nested in the original) since label defs are turned into method defs, and later defs will be nested in the flatMap calls on the controlcontext yielded by earlier statements, we reverse the list of method definitions, so that earlier (in the control flow sense) methods are visible in later ones selective CPS now generates a catch that's directly digestible by backend
* Revert "Enabled continuations plugin by default."Paul Phillips2012-04-122-9/+12
| | | | This reverts commit da35106f81a5c24e78ff51c95e10052ad4f23b18.