Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Regression in parsing XML syntax #16458

Closed
WojciechMazur opened this issue Dec 2, 2022 · 0 comments · Fixed by #19522
Closed

Regression in parsing XML syntax #16458

WojciechMazur opened this issue Dec 2, 2022 · 0 comments · Fixed by #19522

Comments

@WojciechMazur
Copy link
Contributor

Compiler version

3.2.1

Minimized code

//> using lib "org.scala-lang.modules::scala-xml:2.1.0"

@main def Test() =
  val x = <div>FooBar</div><!-- /.modal-content -->
  println(x)

Output

[error] ./test.sc:5:29: in XML literal: name expected, but char '!' cannot start a name
[error]   val x = <div>FooBar</div><!-- /.modal-content -->
[error]                             ^
[error] ./test.sc:5:30: in XML literal: '>' expected instead of '-'
[error]   val x = <div>FooBar</div><!-- /.modal-content -->
[error]                              ^
[error] ./test.sc:7:11: in XML literal: expected closing tag of 
[error] ./test.sc:7:14: expression expected but end of statement found

Expectation

Should compile, Scala 2 output:

NodeBuffer(<div>FooBar</div>, <!-- /.modal-content -->)
@WojciechMazur WojciechMazur added itype:bug area:parser stat:needs triage Every issue needs to have an "area" and "itype" label and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Dec 2, 2022
i10416 added a commit to i10416/dotty that referenced this issue Jan 23, 2024
xLiteral mistakenly assumed that the element just after `<` is always
non-special element, but it is not true. It could be xCharData, comment,
xProcInstr.
odersky added a commit that referenced this issue Feb 15, 2024
close #16458
xLiteral mistakenly assumed that the element just after `<` is always
non-special element, but it is not true. It could be xCharData, comment,
xProcInstr.
@Kordyjan Kordyjan added this to the 3.4.2 milestone Mar 28, 2024
@Kordyjan Kordyjan modified the milestones: 3.4.2, 3.5.0 May 10, 2024
WojciechMazur pushed a commit that referenced this issue Jul 1, 2024
xLiteral mistakenly assumed that the element just after `<` is always
non-special element, but it is not true. It could be xCharData, comment,
xProcInstr.

[Cherry-picked 77aa363]
WojciechMazur pushed a commit that referenced this issue Jul 2, 2024
xLiteral mistakenly assumed that the element just after `<` is always
non-special element, but it is not true. It could be xCharData, comment,
xProcInstr.

[Cherry-picked 77aa363]
WojciechMazur added a commit that referenced this issue Jul 2, 2024
Backports #19522 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants