Aladdin - Scala Bugtracking
[#768] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Burak fixed 2006-10-06 14:54:50.0
subject [contrib #220] Mismatched brackets in XML compiler crash
code
object Broken {
  def x = <x>{ for (val i <- Nil) yield <x>{Nil}</x>
    </x>
}
what happened
Compiler crash:
> testcase.scala:3 error: in XML literal: name expected, but char '/' cannot start a name
>     def x = { for (val i <- Nil) yield {Nil}
>                                                       ^
> testcase.scala:3 error: missing end tag in XML literal for 
>     def x = { for (val i <- Nil) yield {Nil}
>                   ^
> testcase.scala:3 error: ';' expected but something found.
>     def x = { for (val i <- Nil) yield {Nil}
>                                                      ^
> Exception in thread "main" java.lang.Error: 78 not valid offset in testcase.scala:78
>     at scala.tools.nsc.util.SourceFile$line$.find(SourceFile.scala:79)
>     at scala.tools.nsc.util.SourceFile.offsetToLine(SourceFile.scala:106)
>     at scala.tools.nsc.util.Position.column(Position.scala:55)
>     at scala.tools.nsc.reporters.AbstractReporter.testAndLog(AbstractReporter.scala:48)
>     at scala.tools.nsc.reporters.AbstractReporter.info0(AbstractReporter.scala:36)
>     at scala.tools.nsc.reporters.Reporter.error(Reporter.scala:45)
>     at scala.tools.nsc.CompilationUnits$CompilationUnit.error(CompilationUnits.scala:32)
>     at scala.tools.nsc.ast.parser.Scanners$Scanner.syntaxError(Scanners.scala:798)
>     at scala.tools.nsc.ast.parser.Scanners$Scanner.syntaxError(Scanners.scala:805)
>     at scala.tools.nsc.ast.parser.MarkupParsers$MarkupParser.reportSyntaxError(MarkupParsers.scala:579)
>     at scala.tools.nsc.ast.parser.MarkupParsers$MarkupParser.xEmbeddedExpr(MarkupParsers.scala:546)
>     at scala.tools.nsc.ast.parser.MarkupParsers$MarkupParser.content_BRACE(MarkupParsers.scala:272)
>     at scala.tools.nsc.ast.parser.MarkupParsers$MarkupParser.content(MarkupParsers.scala:317)
>     at scala.tools.nsc.ast.parser.MarkupParsers$MarkupParser.element(MarkupParsers.scala:344)
>     at scala.tools.nsc.ast.parser.MarkupParsers$MarkupParser.content_LT(MarkupParsers.scala:299)
>     at scala.tools.nsc.ast.parser.MarkupParsers$MarkupParser.xLiteral(MarkupParsers.scala:460)
>     at scala.tools.nsc.ast.parser.Parsers$Parser.simpleExpr(Parsers.scala:839)
>     at scala.tools.nsc.ast.parser.Parsers$Parser.prefixExpr(Parsers.scala:816)
what expected Same error messages are probably sufficient, but no crash.
[back to overview]
Changes of this bug report
Nikolay  edited on  2006-10-06 14:55:29.0
Transferred from the contributions and assigned to Burak
Burak  edited on  2006-10-12 11:06:03.0
some formatting for readability
Burak  edited on  2006-10-23 14:33:33.0
fixed, errors are now:
/tmp/bk.scala:3 error: in XML literal: name expected, but char '/' cannot start a name
      </x>
       ^
/tmp/bk.scala:3 error: in XML literal: '=' expected instead of '>'
      </x>
         ^
/tmp/bk.scala:4 error: in XML literal: ' or " delimited attribute value or '{' scala-expr '}' expected
          }
          ^
/tmp/bk.scala:5 error: in XML literal: '>' expected instead of ''

^
/tmp/bk.scala:2 error: missing end tag in XML literal for <x>
  def x = <x>{ for (val i <- Nil) yield <x>{Nil}</x>
            ^
/tmp/bk.scala:2 error: ';' expected but something found.
  def x = <x>{ for (val i <- Nil) yield <x>{Nil}</x>
                                               ^
6 errors found