diff options
author | Martin Odersky <odersky@gmail.com> | 2013-07-27 19:48:30 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-07-27 19:48:30 +0200 |
commit | 60b3469ac70052b762cc7bf0d36bf2ec37e8e6dc (patch) | |
tree | 2aaf9fff135e0ac94a3a44457d3523eee02c01f7 /src/dotty/tools/dotc/ast/CheckTrees.scala | |
parent | cf65e84a6da2a151286a36297c057b72545960c8 (diff) | |
download | dotty-60b3469ac70052b762cc7bf0d36bf2ec37e8e6dc.tar.gz dotty-60b3469ac70052b762cc7bf0d36bf2ec37e8e6dc.tar.bz2 dotty-60b3469ac70052b762cc7bf0d36bf2ec37e8e6dc.zip |
Redesign of trees.
1) Trees are now contravariant.
2) All creation ops, transformers, copiers are pushed into Instance.
3) Still to do: integrate TreeMappers and tpd.TreeTransformers.
Diffstat (limited to 'src/dotty/tools/dotc/ast/CheckTrees.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/CheckTrees.scala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/ast/CheckTrees.scala b/src/dotty/tools/dotc/ast/CheckTrees.scala index 502b2eea3..a004789e6 100644 --- a/src/dotty/tools/dotc/ast/CheckTrees.scala +++ b/src/dotty/tools/dotc/ast/CheckTrees.scala @@ -8,16 +8,16 @@ import SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._ object CheckTrees { - import tpd.{TreeMapper, localSyms, TreeOps} + import tpd._ def check(p: Boolean, msg: => String = "")(implicit ctx: Context): Unit = assert(p, msg) - def checkTypeArg(arg: tpd.Tree, bounds: TypeBounds)(implicit ctx: Context): Unit = { + def checkTypeArg(arg: Tree, bounds: TypeBounds)(implicit ctx: Context): Unit = { check(arg.isValueType) check(bounds contains arg.tpe) } - def checkType(tree: tpd.Tree)(implicit ctx: Context): Unit = tree match { + def checkType(tree: Tree)(implicit ctx: Context): Unit = tree match { case Ident(name) => case Select(qualifier, name) => check(qualifier.isValue) @@ -31,7 +31,7 @@ object CheckTrees { val cls = qual.tpe.typeSymbol check(cls.isClass) case Apply(fn, args) => - def checkArg(arg: tpd.Tree, name: Name, formal: Type): Unit = { + def checkArg(arg: Tree, name: Name, formal: Type): Unit = { arg match { case NamedArg(argName, _) => check(argName == name) @@ -147,7 +147,7 @@ object CheckTrees { check(left.isValueType); check(right.isValueType) case RefinedTypeTree(tpt, refinements) => check(tpt.isValueType) - def checkRefinements(forbidden: Set[Symbol], rs: List[tpd.Tree]): Unit = rs match { + def checkRefinements(forbidden: Set[Symbol], rs: List[Tree]): Unit = rs match { case r :: rs1 => val rsym = r.symbol check(rsym.isTerm || rsym.isAbstractOrAliasType) @@ -185,7 +185,7 @@ object CheckTrees { case nme.unapplySeq => // args need to be wrapped in (...: _*) check(args.length == 1) - check(args.head.isInstanceOf[tpd.SeqLiteral]) + check(args.head.isInstanceOf[SeqLiteral]) case nme.unapply => val rtp = funtpe.resultType val rsym = rtp.dealias.typeSymbol @@ -221,7 +221,7 @@ object CheckTrees { check(rhs.tpe <:< tpt.tpe) } case TypeDef(mods, name, tpt) => - check(tpt.isInstanceOf[Template[_]] || tpt.tpe.isInstanceOf[TypeBounds]) + check(tpt.isInstanceOf[Template] || tpt.tpe.isInstanceOf[TypeBounds]) case Template(constr, parents, selfType, body) => case Import(expr, selectors) => check(expr.isValue) |