aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/ast/Desugar.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-08 19:20:23 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-08 19:20:23 +0100
commit6212e472f892a78ab98e7978ad043acbe942d7f2 (patch)
tree8cfe0950fb4c19b69dae723bd6bbfeb22006dae8 /src/dotty/tools/dotc/ast/Desugar.scala
parent2edbc4f04325cb248b34d0b82b9c09dd591f553d (diff)
downloaddotty-6212e472f892a78ab98e7978ad043acbe942d7f2.tar.gz
dotty-6212e472f892a78ab98e7978ad043acbe942d7f2.tar.bz2
dotty-6212e472f892a78ab98e7978ad043acbe942d7f2.zip
Last fixes to desugar.
Diffstat (limited to 'src/dotty/tools/dotc/ast/Desugar.scala')
-rw-r--r--src/dotty/tools/dotc/ast/Desugar.scala11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala
index 0739f08d1..fa664ee08 100644
--- a/src/dotty/tools/dotc/ast/Desugar.scala
+++ b/src/dotty/tools/dotc/ast/Desugar.scala
@@ -421,10 +421,10 @@ object desugar {
/** Main desugaring method */
def apply(tree: Tree)(implicit ctx: Context): Tree = {
- /** { label def lname() = rhs; call }
+ /** { label def lname(): Unit = rhs; call }
*/
def labelDefAndCall(lname: TermName, rhs: Tree, call: Tree) = {
- val ldef = DefDef(Modifiers(Label), lname, Nil, ListOfNil, TypeTree(), rhs)
+ val ldef = DefDef(Modifiers(Label), lname, Nil, ListOfNil, TypeTree(defn.UnitType), rhs)
Block(ldef, call)
}
@@ -686,6 +686,13 @@ object desugar {
}
}.withPos(tree.pos)
+ /** Create a class definition with the same info as this refined type.
+ * parent { refinements }
+ * ==>
+ * class <refinement> extends parent { refinements }
+ *
+ * The result is used for validity checking, is thrown away afterwards.
+ */
def refinedTypeToClass(tree: RefinedTypeTree)(implicit ctx: Context): TypeDef = {
val impl = Template(emptyConstructor, tree.tpt :: Nil, EmptyValDef, tree.refinements)
TypeDef(Modifiers(), tpnme.REFINE_CLASS, impl)