From 6212e472f892a78ab98e7978ad043acbe942d7f2 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 8 Dec 2013 19:20:23 +0100 Subject: Last fixes to desugar. --- src/dotty/tools/dotc/ast/Desugar.scala | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/ast/Desugar.scala') 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 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) -- cgit v1.2.3