diff options
author | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-02-07 14:43:01 +0100 |
---|---|---|
committer | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-02-07 14:43:01 +0100 |
commit | a98eee51760c4961a5419747d2828d9765a9754b (patch) | |
tree | 44c060566ff4652db5b25f89ef67022d668b2767 /src | |
parent | 1e5654c8bd10a3649ccc97c42a7949b179480073 (diff) | |
download | scala-a98eee51760c4961a5419747d2828d9765a9754b.tar.gz scala-a98eee51760c4961a5419747d2828d9765a9754b.tar.bz2 scala-a98eee51760c4961a5419747d2828d9765a9754b.zip |
Better comment for SyntacticEmptyTypeTree
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/internal/BuildUtils.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/reflect/scala/reflect/internal/BuildUtils.scala b/src/reflect/scala/reflect/internal/BuildUtils.scala index 4f4d7df793..458c10e69b 100644 --- a/src/reflect/scala/reflect/internal/BuildUtils.scala +++ b/src/reflect/scala/reflect/internal/BuildUtils.scala @@ -537,9 +537,12 @@ trait BuildUtils { self: SymbolTable => def unapply(tree: Tree): Option[Tree] = gen.Filter.unapply(tree) } - // TypeTree without original is used to signal that no type was provided - // by the user and compiler should infer it instead. (Note: EmptyTree is - // not appropriate in such role, it's only used for terms, not types.) + // If a tree in type position isn't provided by the user (e.g. `tpt` fields of + // `ValDef` and `DefDef`, function params etc), then it's going to be parsed as + // TypeTree with empty original and empty tpe. This extractor matches such trees + // so that one can write q"val x = 2" to match typecheck(q"val x = 2"). Note that + // TypeTree() is the only possible representation for empty trees in type positions. + // We used to sometimes receive EmptyTree in such cases, but not anymore. object SyntacticEmptyTypeTree extends SyntacticEmptyTypeTreeExtractor { def apply(): TypeTree = self.TypeTree() def unapply(tt: TypeTree): Boolean = tt.original == null || tt.original.isEmpty |