| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
* all usages of ClassManifest and Manifest are replaced with tags
* all manifest tests are replaced with tag tests
|
|
|
|
|
|
| |
Would prefer to bake a little longer, but, scala days.
More elaboration to come.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implements SIP 16: Self-cleaning macros: http://bit.ly/wjjXTZ
Features:
* Macro defs
* Reification
* Type tags
* Manifests aliased to type tags
* Extended reflection API
* Several hundred tests
* 1111 changed files
Not yet implemented:
* Reification of refined types
* Expr.value splicing
* Named and default macro expansions
* Intricacies of interaction between macros and implicits
* Emission of debug information for macros (compliant with JSR-45)
Dedicated to Yuri Alekseyevich Gagarin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implemented great suggestion from moors. More imports in power mode,
including the contents of treedsl. Also, another swing at overcoming
the mismatched global singletons problem, this time taking advantage of
dependent method types. Amazingly, it seems to work.
Continuing in the quest to create a useful compiler hacking environment,
there is now an implicit from Symbol which allows you to pretend a
Symbol takes type parameters, and the result is the applied type based
on the manifests of the type arguments and the type constructor of the
symbol. Examples:
// magic with manifests
scala> val tp = ArrayClass[scala.util.Random]
tp: $r.global.Type = Array[scala.util.Random]
// evidence
scala> tp.memberType(Array_apply)
res0: $r.global.Type = (i: Int)scala.util.Random
// treedsl
scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE)
m: $r.treedsl.global.Match =
10 match {
case 5 => false
case _ => true
}
// typed is in scope
scala> typed(m).tpe
res1: $r.treedsl.global.Type = Boolean
|
|
|
|
|
| |
Making power mode startup a little less glacial, no review.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
type mismatches, for real this time. :power mode goes to phase typer
automatically.
You can get the symbols for repl-defined names more directly:
scala> case class Bippy(x: Int)
defined class Bippy
scala> intp.terms("Bippy")
res1: intp.global.Symbol = object Bippy
scala> intp.types("Bippy")
res2: intp.global.Symbol = class Bippy
scala> intp("Bippy") // tries type first
res3: intp.global.Symbol = class Bippy
scala> intp("scala.collection.Map") // falls back to fully qualified
res4: intp.global.Symbol = trait Map
I changed the implicit which used to install "tpe" and "symbol" to
install "tpe_" and "symbol_" because it was too easy to do something you
didn't mean to, like calling x.tpe where x is a Manifest.
Said implicit now handles manifest type arguments, so you can get the
full translation from a manifest representation to a compiler type, at
least for simple types and only as much as manifests work, which is not
that much. Fortunately that situation is all changing soon.
scala> List(List(1, 2, 3)).tpe_
res5: power.Type = List[List[Int]]
scala> res5.typeArgs
res6: List[power.global.Type] = List(List[Int])
Review by moors.
|
| |
|
|
Cleaning up power mode import issues (and the amazing first power mode
test) no review.
|