From 0ca3728c6c4eb77288958c5e69b73e9bc6ea7c8c Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 4 Jan 2017 08:57:48 +0700 Subject: [PATCH] Fix #1867: Set position of empty refined types --- compiler/src/dotty/tools/dotc/typer/Typer.scala | 2 +- tests/pos/i1867.scala | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 tests/pos/i1867.scala diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index fe158dfe2005..63f3a59d6d37 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -1030,7 +1030,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typedRefinedTypeTree(tree: untpd.RefinedTypeTree)(implicit ctx: Context): RefinedTypeTree = track("typedRefinedTypeTree") { val tpt1 = if (tree.tpt.isEmpty) TypeTree(defn.ObjectType) else typedAheadType(tree.tpt) - val refineClsDef = desugar.refinedTypeToClass(tpt1, tree.refinements) + val refineClsDef = desugar.refinedTypeToClass(tpt1, tree.refinements).withPos(tree.pos) val refineCls = createSymbol(refineClsDef).asClass val TypeDef(_, impl: Template) = typed(refineClsDef) val refinements1 = impl.body diff --git a/tests/pos/i1867.scala b/tests/pos/i1867.scala new file mode 100644 index 000000000000..b6377c4f0c83 --- /dev/null +++ b/tests/pos/i1867.scala @@ -0,0 +1,3 @@ +trait B { + def f1: {} +}