summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Sabin <miles@milessabin.com>2009-07-28 14:55:35 +0000
committerMiles Sabin <miles@milessabin.com>2009-07-28 14:55:35 +0000
commit5775f1b8875f12e5fc0403d4e048add6781eb7ff (patch)
treef46819728328e6e6059b329a7e06cd24c72bbfdb
parent01ed33304a01d9917d1e315613a89771389eea1e (diff)
downloadscala-5775f1b8875f12e5fc0403d4e048add6781eb7ff.tar.gz
scala-5775f1b8875f12e5fc0403d4e048add6781eb7ff.tar.bz2
scala-5775f1b8875f12e5fc0403d4e048add6781eb7ff.zip
A couple more positions issues caused by the pa...
A couple more positions issues caused by the packaging changes: fixed with test cases; test.positions target now runs the explicit test cases first.
-rw-r--r--build.xml6
-rwxr-xr-xsrc/compiler/scala/tools/nsc/ast/parser/Parsers.scala4
-rw-r--r--test/files/positions/Empty.scala0
-rw-r--r--test/files/positions/Enclosing4.scala1
4 files changed, 6 insertions, 5 deletions
diff --git a/build.xml b/build.xml
index c79093e0ad..b995bd60d4 100644
--- a/build.xml
+++ b/build.xml
@@ -1743,6 +1743,9 @@ POSITIONS
============================================================================ -->
<target name="test.positions" depends="pack.done">
+ <antcall target="test.positions.tests.sub" inheritRefs="true">
+ <param name="test.tests.srcs" value="${test.dir}/files/positions"/>
+ </antcall>
<antcall target="test.positions.sub" inheritRefs="true">
<param name="test.srcs" value="${src.dir}/compiler"/>
</antcall>
@@ -1765,9 +1768,6 @@ POSITIONS
<param name="test.srcs" value="${src.dir}/scalap"/>
</antcall>
<antcall target="test.positions.tests.sub" inheritRefs="true">
- <param name="test.tests.srcs" value="${test.dir}/files/positions"/>
- </antcall>
- <antcall target="test.positions.tests.sub" inheritRefs="true">
<param name="test.tests.srcs" value="${test.dir}/files/pos"/>
</antcall>
<antcall target="test.positions.tests.sub" inheritRefs="true">
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 129e974e76..0c1198cdcf 100755
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -2341,7 +2341,7 @@ self =>
/** Create a tree representing a packaging */
def makePackaging(start: Int, pkg: Tree, stats: List[Tree]): PackageDef =
- atPos(start, pkg.pos.point) { PackageDef(pkg.asInstanceOf[RefTree], stats) }
+ atPos(start, pkg.pos.point, in.lastOffset max start) { PackageDef(pkg.asInstanceOf[RefTree], stats) }
/*
pkg match {
case id @ Ident(_) =>
@@ -2566,7 +2566,7 @@ self =>
}
ts.toList
}
- val start = in.offset
+ val start = in.offset max 0
atPos(start) {
topstats() match {
case List(stat @ PackageDef(_, _)) => stat
diff --git a/test/files/positions/Empty.scala b/test/files/positions/Empty.scala
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/positions/Empty.scala
diff --git a/test/files/positions/Enclosing4.scala b/test/files/positions/Enclosing4.scala
new file mode 100644
index 0000000000..8337712ea5
--- /dev/null
+++ b/test/files/positions/Enclosing4.scala
@@ -0,0 +1 @@
+//