From 32fd97df41bb2e99018f024f41b06490e41bd7ad Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sun, 11 Mar 2012 00:14:16 -0500 Subject: Fix for SI-5385. Nodes which hit EOF with no whitespace afterward had wrong position. --- test/files/neg/t4069.check | 2 +- test/files/neg/t4584.check | 7 +++++-- test/files/neg/unicode-unterminated-quote.check | 5 ++++- test/files/run/t5385.check | 8 ++++++++ test/files/run/t5385.scala | 16 ++++++++++++++++ 5 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 test/files/run/t5385.check create mode 100644 test/files/run/t5385.scala (limited to 'test/files') diff --git a/test/files/neg/t4069.check b/test/files/neg/t4069.check index 91bf882cec..08e937bdfe 100644 --- a/test/files/neg/t4069.check +++ b/test/files/neg/t4069.check @@ -12,5 +12,5 @@ t4069.scala:4: error: I encountered a '}' where I didn't expect one, maybe this ^ t4069.scala:10: error: '}' expected but eof found. } -^ + ^ 5 errors found diff --git a/test/files/neg/t4584.check b/test/files/neg/t4584.check index 060160d76a..419f5704b1 100644 --- a/test/files/neg/t4584.check +++ b/test/files/neg/t4584.check @@ -1,4 +1,7 @@ -t4584.scala:1: error: incomplete unicode escape +t4584.scala:1: error: error in unicode escape +class A { val /u2 + ^ +t4584.scala:1: error: illegal character '/uffff' class A { val /u2 ^ -one error found +two errors found diff --git a/test/files/neg/unicode-unterminated-quote.check b/test/files/neg/unicode-unterminated-quote.check index fc5caa6d7e..5085505fb4 100644 --- a/test/files/neg/unicode-unterminated-quote.check +++ b/test/files/neg/unicode-unterminated-quote.check @@ -1,4 +1,7 @@ unicode-unterminated-quote.scala:2: error: unclosed string literal val x = /u0022 ^ -one error found +unicode-unterminated-quote.scala:2: error: '}' expected but eof found. + val x = /u0022 + ^ +two errors found diff --git a/test/files/run/t5385.check b/test/files/run/t5385.check new file mode 100644 index 0000000000..1df74fcfb5 --- /dev/null +++ b/test/files/run/t5385.check @@ -0,0 +1,8 @@ +[0:9] class Azz +[0:9] class Bzz +[0:9] class Czz +[0:9] class Dzz +[0:11] class Ezz +[0:11] class Fzz +[0:13] class Gzz +[0:13] class Hzz diff --git a/test/files/run/t5385.scala b/test/files/run/t5385.scala new file mode 100644 index 0000000000..b803897e71 --- /dev/null +++ b/test/files/run/t5385.scala @@ -0,0 +1,16 @@ +import scala.tools.partest._ + +object Test extends CompilerTest { + import global._ + override def extraSettings = super.extraSettings + " -Yrangepos" + override def sources = List( + "class Azz", "class Bzz ", "class Czz ", "class Dzz\n", + "class Ezz{}", "class Fzz{} ", "class Gzz { }", "class Hzz { } " + ) + def check(source: String, unit: CompilationUnit) { + unit.body foreach { + case cdef: ClassDef => println("%-15s class %s".format(cdef.pos.show, cdef.name)) + case _ => + } + } +} -- cgit v1.2.3