summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-03-16 06:32:46 -0700
committerPaul Phillips <paulp@improving.org>2012-03-16 08:04:46 -0700
commitbc7bf663f2df564805fa5121de7b0006cf2149f2 (patch)
tree73edb30907fb326494f4576b53bd4d45e0201916
parentf987afe55e6d4f71c7e9ad10d1ca9f6120dc1132 (diff)
downloadscala-bc7bf663f2df564805fa5121de7b0006cf2149f2.tar.gz
scala-bc7bf663f2df564805fa5121de7b0006cf2149f2.tar.bz2
scala-bc7bf663f2df564805fa5121de7b0006cf2149f2.zip
Finish fixing range positions.
At least, I think so.
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rw-r--r--test/files/pos/anyval-rangepos.scala1
-rw-r--r--test/files/pos/rangepos.flags (renamed from test/files/pos/anyval-rangepos.flags)0
-rw-r--r--test/files/pos/rangepos.scala5
5 files changed, 7 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 87251b4cc9..4b7c03b72a 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -216,7 +216,7 @@ abstract class TreeBuilder {
def makeNew(parents: List[Tree], self: ValDef, stats: List[Tree], argss: List[List[Tree]],
npos: Position, cpos: Position): Tree =
if (parents.isEmpty)
- makeNew(List(atPos(npos union cpos)(scalaAnyRefConstr)), self, stats, argss, npos, cpos)
+ makeNew(List(scalaAnyRefConstr), self, stats, argss, npos, cpos)
else if (parents.tail.isEmpty && stats.isEmpty)
atPos(npos union cpos) { New(parents.head, argss) }
else {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 973e26af41..c4880dd6d7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1295,7 +1295,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
}
def parentTypes(templ: Template): List[Tree] =
- if (templ.parents.isEmpty) List(atPos(templ.pos.focus)(TypeTree(AnyRefClass.tpe)))
+ if (templ.parents.isEmpty) List(atPos(templ.pos)(TypeTree(AnyRefClass.tpe)))
else try {
val clazz = context.owner
// Normalize supertype and mixins so that supertype is always a class, not a trait.
diff --git a/test/files/pos/anyval-rangepos.scala b/test/files/pos/anyval-rangepos.scala
deleted file mode 100644
index 8d79793c0d..0000000000
--- a/test/files/pos/anyval-rangepos.scala
+++ /dev/null
@@ -1 +0,0 @@
-class Foo(val x: Double) extends AnyVal { }
diff --git a/test/files/pos/anyval-rangepos.flags b/test/files/pos/rangepos.flags
index fcf951d907..fcf951d907 100644
--- a/test/files/pos/anyval-rangepos.flags
+++ b/test/files/pos/rangepos.flags
diff --git a/test/files/pos/rangepos.scala b/test/files/pos/rangepos.scala
new file mode 100644
index 0000000000..623b096acb
--- /dev/null
+++ b/test/files/pos/rangepos.scala
@@ -0,0 +1,5 @@
+class Foo(val x: Double) extends AnyVal { }
+
+object Pretty {
+ def f(s1: String) = new { def bar = 5 }
+}