summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 @@
+//