From 5277fb4d69714b52a9c43fd6ac439e6d16d7a3e9 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Tue, 27 May 2014 12:55:13 -0700 Subject: SI-8630 lineToString no longer long by one at eof One more EOL crasher, or lack-of-EOL crasher, when the text is at EOF. It was not caught by the last round of excellent and thorough tests because ``` // If non-whitespace tokens run all the way up to EOF, // positions go wrong because the correct end of the last // token cannot be used as an index into the char array. // The least painful way to address this was to add a // newline to the array. ``` --- test/files/neg/t8630.check | 7 +++++++ test/files/neg/t8630.scala | 1 + 2 files changed, 8 insertions(+) create mode 100644 test/files/neg/t8630.check create mode 100644 test/files/neg/t8630.scala (limited to 'test/files') diff --git a/test/files/neg/t8630.check b/test/files/neg/t8630.check new file mode 100644 index 0000000000..98b084b153 --- /dev/null +++ b/test/files/neg/t8630.check @@ -0,0 +1,7 @@ +t8630.scala:1: error: '{' expected but 'abstract' found. +package bobsdelights abstract class Fruit( val name: String, val color: String ) object Fruits { object Apple extends Fruit("apple", "red") object Orange extends Fruit("orange", "orange") object Pear extends Fruit("pear", "yellowish") val menu = List(Apple, Orange, Pear) } + ^ +t8630.scala:1: error: '}' expected but eof found. +package bobsdelights abstract class Fruit( val name: String, val color: String ) object Fruits { object Apple extends Fruit("apple", "red") object Orange extends Fruit("orange", "orange") object Pear extends Fruit("pear", "yellowish") val menu = List(Apple, Orange, Pear) } + ^ +two errors found diff --git a/test/files/neg/t8630.scala b/test/files/neg/t8630.scala new file mode 100644 index 0000000000..ea25227452 --- /dev/null +++ b/test/files/neg/t8630.scala @@ -0,0 +1 @@ +package bobsdelights abstract class Fruit( val name: String, val color: String ) object Fruits { object Apple extends Fruit("apple", "red") object Orange extends Fruit("orange", "orange") object Pear extends Fruit("pear", "yellowish") val menu = List(Apple, Orange, Pear) } \ No newline at end of file -- cgit v1.2.3