diff options
author | Paul Phillips <paulp@improving.org> | 2010-12-12 19:26:54 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-12-12 19:26:54 +0000 |
commit | 1e6c122c44af3d29f8c0f55e7bc3318a9d1b87a6 (patch) | |
tree | cf30b89b54676693b102d83a90f61cade407a721 | |
parent | 5d6b870ea8b7b62670d616b055b85b03f061ba2b (diff) | |
download | scala-1e6c122c44af3d29f8c0f55e7bc3318a9d1b87a6.tar.gz scala-1e6c122c44af3d29f8c0f55e7bc3318a9d1b87a6.tar.bz2 scala-1e6c122c44af3d29f8c0f55e7bc3318a9d1b87a6.zip |
Told the boy trying to plug the dike holes that...
Told the boy trying to plug the dike holes that he can go home. Instead
of trying to catch unpositioned EmptyTrees from the XML parser, don't
generate them. It's the kind of commit you would tell your grandkids
about if your grandkids could sit still for five seconds: fixes bugs
by deleting code and eliminates extraneous error messages to boot (see
.check diffs.) No review.
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala | 7 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 7 | ||||
-rw-r--r-- | test/files/neg/bug2275b.check | 5 | ||||
-rw-r--r-- | test/files/neg/t3769.check | 5 | ||||
-rw-r--r-- | test/files/neg/xmltruncated7.check | 7 | ||||
-rw-r--r-- | test/files/neg/xmltruncated7.scala | 3 |
6 files changed, 15 insertions, 19 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala index 49c6b2ffba..d0265ac95c 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala @@ -30,8 +30,7 @@ import util.Chars.{ SU, LF } * @author Burak Emir * @version 1.0 */ -trait MarkupParsers -{ +trait MarkupParsers { self: Parsers => case object MissingEndTagControl extends ControlThrowable { @@ -294,7 +293,7 @@ trait MarkupParsers while (ch != SU) { if (ch == '}') { if (charComingAfter(nextch) == '}') nextch - else errorBraces + else errorBraces() } buf append ch @@ -318,7 +317,7 @@ trait MarkupParsers } finally parser.in resume Tokens.XMLSTART - EmptyTree + parser.errorTermTree } /** Use a lookahead parser to run speculative body, and return the first char afterward. */ diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 622c4054e8..071926e7c6 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1309,10 +1309,6 @@ self => def postfixExpr(): Tree = { val base = opstack var top = prefixExpr() - // Various errors in XML literals can cause xmlLiteral to propagate - // EmptyTree's. Watch out for them here. - if (top == EmptyTree) - return EmptyTree while (isIdent) { top = reduceStack(true, base, top, precedence(in.name), treeInfo.isLeftAssoc(in.name)) @@ -1400,9 +1396,6 @@ self => } def simpleExprRest(t: Tree, canApply: Boolean): Tree = { - // Various errors in XML literals can cause xmlLiteral to propagate - // EmptyTree's. Watch out for them here (see also postfixExpr). - if (EmptyTree == t) return EmptyTree // #3604 (mics) if (canApply) newLineOptWhenFollowedBy(LBRACE) in.token match { case DOT => diff --git a/test/files/neg/bug2275b.check b/test/files/neg/bug2275b.check index 4b61f242d0..0db3eb8ff1 100644 --- a/test/files/neg/bug2275b.check +++ b/test/files/neg/bug2275b.check @@ -4,10 +4,7 @@ bug2275b.scala:2: error: in XML literal: in XML content, please use '}}' to expr bug2275b.scala:2: error: I encountered a '}' where I didn't expect one, maybe this tag isn't closed <br> {<br>}xx ^ -bug2275b.scala:2: error: ';' expected but identifier found. - {<br>}xx - ^ bug2275b.scala:3: error: '}' expected but eof found. } ^ -four errors found +three errors found diff --git a/test/files/neg/t3769.check b/test/files/neg/t3769.check index 7537ed2ddf..40ccf05ff3 100644 --- a/test/files/neg/t3769.check +++ b/test/files/neg/t3769.check @@ -4,7 +4,4 @@ t3769.scala:2: error: in XML literal: expected closing tag of a t3769.scala:2: error: start tag was here: a> val x = <b> <c><a></c> {"text"} </b> ^ -t3769.scala:2: error: ';' expected but '{' found. - val x = <b> <c><a></c> {"text"} </b> - ^ -three errors found +two errors found diff --git a/test/files/neg/xmltruncated7.check b/test/files/neg/xmltruncated7.check new file mode 100644 index 0000000000..67e7bd4b18 --- /dev/null +++ b/test/files/neg/xmltruncated7.check @@ -0,0 +1,7 @@ +xmltruncated7.scala:2: error: in XML literal: in XML content, please use '}}' to express '}' + <p>foo}: </p> + ^ +xmltruncated7.scala:2: error: I encountered a '}' where I didn't expect one, maybe this tag isn't closed <p> + <p>foo}: </p> + ^ +two errors found diff --git a/test/files/neg/xmltruncated7.scala b/test/files/neg/xmltruncated7.scala new file mode 100644 index 0000000000..7e296a910d --- /dev/null +++ b/test/files/neg/xmltruncated7.scala @@ -0,0 +1,3 @@ +object Test { + <p>foo}: </p> +}
\ No newline at end of file |