aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-01 18:47:27 +0100
committerMartin Odersky <odersky@gmail.com>2014-03-01 18:47:27 +0100
commitcba210d0c362759a710f4d9b5dbf1ecfe0d1f278 (patch)
tree10cfbb2a6eb06beb2120512ea8a190d15f2d526a /src/dotty/tools
parentb9e576ad1ba0ff02c550c821648f23905477e545 (diff)
downloaddotty-cba210d0c362759a710f4d9b5dbf1ecfe0d1f278.tar.gz
dotty-cba210d0c362759a710f4d9b5dbf1ecfe0d1f278.tar.bz2
dotty-cba210d0c362759a710f4d9b5dbf1ecfe0d1f278.zip
Fix problem when handling structural types without a nominal parent type.
We need to use Object as parent then, but this was forgotten.
Diffstat (limited to 'src/dotty/tools')
-rw-r--r--src/dotty/tools/dotc/ast/Desugar.scala4
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala
index 473800cde..027c3238d 100644
--- a/src/dotty/tools/dotc/ast/Desugar.scala
+++ b/src/dotty/tools/dotc/ast/Desugar.scala
@@ -715,10 +715,12 @@ object desugar {
* ==>
* trait <refinement> extends parent { refinements }
*
+ * If the parent is missing, Object is assumed.
* 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)
+ val parent = if (tree.tpt.isEmpty) TypeTree(defn.ObjectType) else tree.tpt
+ val impl = Template(emptyConstructor, parent :: Nil, EmptyValDef, tree.refinements)
TypeDef(Modifiers(Trait), tpnme.REFINE_CLASS, impl)
}
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index ebb648ea5..400a1407a 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -798,7 +798,7 @@ class Typer extends Namer with Applications with Implicits {
}
def typedRefinedTypeTree(tree: untpd.RefinedTypeTree)(implicit ctx: Context): RefinedTypeTree = track("typedRefinedTypeTree") {
- val tpt1 = typedAheadType(tree.tpt)
+ val tpt1 = if (tree.tpt.isEmpty) TypeTree(defn.ObjectType) else typedAheadType(tree.tpt)
val refineClsDef = desugar.refinedTypeToClass(tree)
val refineCls = createSymbol(refineClsDef).asClass
val TypeDef(_, _, Template(_, _, _, refinements1)) = typed(refineClsDef)