summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Sabin <miles@milessabin.com>2010-01-18 12:20:57 +0000
committerMiles Sabin <miles@milessabin.com>2010-01-18 12:20:57 +0000
commit0d5d440a68342296eed0474cf697f0c2cb085387 (patch)
treed4a1a20f81c220c7870b95b9d8d6882375821bd2
parent853b1817beb5f8b55ecbd1ffdf0e226fc699acae (diff)
downloadscala-0d5d440a68342296eed0474cf697f0c2cb085387.tar.gz
scala-0d5d440a68342296eed0474cf697f0c2cb085387.tar.bz2
scala-0d5d440a68342296eed0474cf697f0c2cb085387.zip
Fix and test case for #2891. No review necessary.
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala2
-rw-r--r--test/files/positions/New1.scala3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index b86356ba94..70d8c5d23f 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -1237,7 +1237,7 @@ self =>
val npos = r2p(nstart, nstart, in.lastOffset)
val tstart = in.offset
val (parents, argss, self, stats) = template(false)
- val cpos = r2p(tstart, tstart, in.lastOffset)
+ val cpos = r2p(tstart, tstart, in.lastOffset max tstart)
makeNew(parents, self, stats, argss, npos, cpos)
case _ =>
syntaxErrorOrIncomplete("illegal start of simple expression", true)
diff --git a/test/files/positions/New1.scala b/test/files/positions/New1.scala
new file mode 100644
index 0000000000..bd17c0d523
--- /dev/null
+++ b/test/files/positions/New1.scala
@@ -0,0 +1,3 @@
+class New1 {
+ val a = new
+}