-
Notifications
You must be signed in to change notification settings - Fork 92
NodeSeq ++ results in List[Node] in 2.13 #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
++
results in List[Node]
vs NodeSeq
in 2.12
Yeah, the code base for 2.13 is new as a result of the changes to the collections library updates, so the code for If we're going to fix this and make a release, we should make the change to 1.x branch. It will be easy to cherry-pick to master for a 2.0.0-M2 release. |
Here's a first attempt at writing a unit test: package scala.xml
import org.junit.Test
import org.junit.Assert.assertEquals
import org.junit.Assert.fail
class NodeSeqTest {
@Test
def testAppend: Unit = {
val a: NodeSeq = <a>Hello</a>
val b = <b>Hi</b>
val res: NodeSeq = a ++ b
assertEquals(NodeSeq.fromSeq(Seq(<a>Hello</a>, <b>Hi</b>)), res)
a ++ <b>Hi</b> match {
case _: NodeSeq => assertEquals(2, res.size) // 2.12 and earlier
case _: List[Node] => fail("Should be NodeSeq") // 2.13
}
}
} |
Since there were a lot of changes to the build during 2.13 milestones, it's difficult to bisect this. My first pass at it suggests switching to 2.13.0-M4 in 4c7a945 is the issue. That raises different questions than I epxected, though. I'd need to dig further in to this to confirm. |
I think NodeSeq needs to override
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Good catch! I've tried to cargo cult that example code in #396. It seemed to fix the specific issue raised here. |
I see the following change in behavior between scala 2.12 and 2.13:
Scala 2.12:
Scala 2.13:
That change has a very deep reach for us, because Liftweb doesn't interpret both type in the same way: it applies template transformation one time for a
NodeSeq
(it's only one template), and N times forList[Node]
(it's a list of template). Our web application is totally broken, and it's almost impossible to find all places which would need a type ascription (and it would bloat a lot the resulting code.Is there a way to get back the old behavior? Perhaps we are missing a new implicit? Perhaps the implicit precedence in
NodeSeq
changed and it could be adpated?Any insight would be appreciated.
The text was updated successfully, but these errors were encountered: