diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-10-21 23:34:35 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-10-22 08:14:14 +0200 |
commit | cbad218dba47d49a39897b86d467c384538fdd53 (patch) | |
tree | 8acf0bb1698429754dd0ad97ad40170bfc6c200f /test/files/neg | |
parent | 2bd2a7c9506790d25d01c6e79e50a233b16c31ff (diff) | |
download | scala-cbad218dba47d49a39897b86d467c384538fdd53.tar.gz scala-cbad218dba47d49a39897b86d467c384538fdd53.tar.bz2 scala-cbad218dba47d49a39897b86d467c384538fdd53.zip |
SI-2968 Fix brace healing for `^case (class|object) {`
The scanner coalesces the pair of tokens into CASEOBJECT or
CASECLASS, but fails to set `offset` back to the start of `case`.
Brace healing is then unable to correctly guess the location of
the missing brace.
This commit resets `offset` and `lastOffset`, as though
caseobject were a single keyword. Only the former was neccessary
to fix this bug; I haven't found a test that shows the need for
the latter.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t2968.check | 10 | ||||
-rw-r--r-- | test/files/neg/t2968.scala | 26 | ||||
-rw-r--r-- | test/files/neg/t2968b.check | 4 | ||||
-rw-r--r-- | test/files/neg/t2968b.scala | 7 |
4 files changed, 47 insertions, 0 deletions
diff --git a/test/files/neg/t2968.check b/test/files/neg/t2968.check new file mode 100644 index 0000000000..5d2387f98c --- /dev/null +++ b/test/files/neg/t2968.check @@ -0,0 +1,10 @@ +t2968.scala:8: error: Missing closing brace `}' assumed here +} // missing brace +^ +t2968.scala:17: error: Missing closing brace `}' assumed here +} // missing brace +^ +t2968.scala:26: error: Missing closing brace `}' assumed here +} // missing brace +^ +three errors found diff --git a/test/files/neg/t2968.scala b/test/files/neg/t2968.scala new file mode 100644 index 0000000000..41c3a798a5 --- /dev/null +++ b/test/files/neg/t2968.scala @@ -0,0 +1,26 @@ +object t1 { + case object Const { + } + + class Var + { + +} // missing brace + +object t2 { + case class Const() { + } + + class Var + { + +} // missing brace + +object t3 { + final case class Const() { + } + + class Var + { + +} // missing brace diff --git a/test/files/neg/t2968b.check b/test/files/neg/t2968b.check new file mode 100644 index 0000000000..36d25a2d12 --- /dev/null +++ b/test/files/neg/t2968b.check @@ -0,0 +1,4 @@ +t2968b.scala:7: error: '}' expected but eof found. +// missing brace + ^ +one error found diff --git a/test/files/neg/t2968b.scala b/test/files/neg/t2968b.scala new file mode 100644 index 0000000000..422b618aba --- /dev/null +++ b/test/files/neg/t2968b.scala @@ -0,0 +1,7 @@ +case class Const() +{ +} + +class Var +{ +// missing brace |