Skip to content

Fails to parse XML literal as NodeBuffer #8214

Closed
@ashawley

Description

@ashawley

In 2.13.1, it was possible to specify multiple XML literal elements and have them parsed as NodeBuffer (usually parsing one would be an Elem). I don't think this capability is used very often in Scala code bases, but given how much Scala code is out there, it is worth surfacing this regression.

import scala.xml.NodeBuffer
val nodeBuffer: NodeBuffer = <hello/><world/>
println()

It works fine in a REPL (dotty doesn't have :paste?), but not in a file:

[error] -- [E008] Member Not Found Error: src/main/scala/XMLHelloWorld.scala:9:4 
[error] 8 |    val nodeBuffer: NodeBuffer = <hello/><world/>
[error] 9 |    println()
[error]   |                                  ^
[error]   |                     value println is not a member of scala.xml.NodeBuffer
[error] one error found
[error] (Compile / compileIncremental) Compilation failed

Here's an example repo with a branch with this defect:

https://github.com/ashawley/dotty-scala-xml-example/tree/nodebuffer

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions