- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
powertyper
Tue, 2011-11-29, 11:27
for those experimenting with the type checker in power mode, here's a small snippet that I hope might help
scala> :power** Power User mode enabled - BEEP BOOP SPIZ **** :phase has been set to 'typer'. ** ** scala.tools.nsc._ has been imported **** global._ and definitions._ also imported **** Try :help, vals.<tab>, power.<tab> **
scala> object dsl extends ast.TreeDSL { val global: intp.global.type = intp.global } defined module dsl
scala> import dsl.CODE._import dsl.CODE._
scala> val typer = analyzer.newTyper(analyzer.rootContext(power.unit("").asInstanceOf[analyzer.global.CompilationUnit])) typer: $r.intp.global.analyzer.Typer = scala.tools.nsc.typechecker.Typers$NormalTyper@6085968b
scala> typer.typed((REF(ListModule) DOT List_apply) APPLY (NULL, NULL))res0: $r.intp.global.analyzer.global.Tree = immutable.this.List.apply[Null](null, null)
scala> :power** Power User mode enabled - BEEP BOOP SPIZ **** :phase has been set to 'typer'. ** ** scala.tools.nsc._ has been imported **** global._ and definitions._ also imported **** Try :help, vals.<tab>, power.<tab> **
scala> object dsl extends ast.TreeDSL { val global: intp.global.type = intp.global } defined module dsl
scala> import dsl.CODE._import dsl.CODE._
scala> val typer = analyzer.newTyper(analyzer.rootContext(power.unit("").asInstanceOf[analyzer.global.CompilationUnit])) typer: $r.intp.global.analyzer.Typer = scala.tools.nsc.typechecker.Typers$NormalTyper@6085968b
scala> typer.typed((REF(ListModule) DOT List_apply) APPLY (NULL, NULL))res0: $r.intp.global.analyzer.global.Tree = immutable.this.List.apply[Null](null, null)