NodeSeq vs List[Node] in scala 2.13 breaks CssSel

73 views
Skip to first unread message

Francois

unread,
Jan 19, 2020, 3:48:06 AM1/19/20
to Lift
Hello,

We upgraded to Scala 2.13 and Lift 3.4.1, but it seems that the new collection changed the way `append` in `NodeSeq` works, and it changes the semantic of CssSel, breaking the app in a lot of places in subtle way.


scala 2.12:
scala> import scala.xml._
import scala.xml._

scala> val a: NodeSeq = <a>Hello</a>
a: scala.xml.NodeSeq = <a>Hello</a>

scala> a ++ <b>hi</b>
res0: scala.xml.NodeSeq = NodeSeq(<a>Hello</a>, <b>hi</b>)

Scala 2.13:

scala> a ++ <b>hi</b>
res0: Seq[scala.xml.Node] = List(<a>Hello</a>, <b>hi</b>)


This result in a change in semantic of CssSel, because `"something #> (x: NodeSeq)` is different than `"something #> (x: List[Node]`.

Do you notice that? Do you know of a way to correct that thing? I can't put type ascription everywhere (I don't even know where the problematic places are)


Thanks, any insights would be very much appreciated.


-- 
Francois ARMAND - @fanf42
https://github.com/Normation/rudder
http://www.normation.com

Francois

unread,
Feb 4, 2020, 6:39:15 AM2/4/20
to Lift
If anybody has the problem: it was reported to `scala-xml` project at https://github.com/scala/scala-xml/issues/392

A PR correcting the behaviour was done here: https://github.com/scala/scala-xml/pull/396

It will be part of next scala-xml version 1.3.0 release.
If you can't wait a couple days, we have a compiled version here: : https://www.rudder-project.org/maven-releases/org/scala-lang/modules/scala-xml_2.13/1.2.0.1-rudder/
But you should not rely on it for anything but tests, we will most likely remove it as soon as scala-xml version 1.3.0 is out.

We noticed that with the provided correction, you sometimes get errors like that:

```
Error:(567, 42) overloaded method value flatMap with alternatives:
  (f: scala.xml.Node => scala.collection.IterableOnce[scala.xml.Node])scala.xml.NodeSeq <and>
  [B](f: scala.xml.Node => scala.collection.IterableOnce[B])Seq[B]
 cannot be applied to (scala.xml.Node => net.liftweb.common.Box[(com.normation.rudder.domain.parameters.ParameterName, com.normation.rudder.domain.workflows.GlobalParameterChanges)])
        (paramsNode \ "globalParameter").flatMap{ param =>
```

And in these case, we have to explicitly use: `(paramsNode \ "globalParameter").iterator.flatMap{ param => `


Hope it helps,

Antonio Salazar Cardozo

unread,
Feb 4, 2020, 10:11:04 PM2/4/20
to Lift
I'll do what I can to get us bumped to the 1.3.0 version once we hear it's out.

Thanks for digging in here; I know we've all been a little underwater and unable to help out much.
Antonio

Andreas Joseph Krogh

unread,
Mar 6, 2020, 6:15:56 AM3/6/20
to Francois, Lift
På tirsdag 04. februar 2020 kl. 12:39:10, skrev Francois <fan...@gmail.com>:
If anybody has the problem: it was reported to `scala-xml` project at https://github.com/scala/scala-xml/issues/392

A PR correcting the behaviour was done here: https://github.com/scala/scala-xml/pull/396

It will be part of next scala-xml version 1.3.0 release.
 
Any news on 1.3.0's release?
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963

Matt Farmer

unread,
Mar 12, 2020, 7:10:57 AM3/12/20
to lif...@googlegroups.com
Looks like they are skipping 1.3.0 and going straight to 2.0 😕 

2.0-M1 is out but not sure on the stability. 

On Mar 6, 2020, at 6:15 AM, Andreas Joseph Krogh <and...@visena.com> wrote:



--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/liftweb/VisenaEmail.75.4bdf7e71e76730d0.170af8ee824%40tc7-visena.

Vitaliy L

unread,
Apr 12, 2020, 5:19:27 PM4/12/20
to Lift


On Thursday, 12 March 2020 13:10:57 UTC+2, Matt Farmer wrote:
Looks like they are skipping 1.3.0 and going straight to 2.0 😕 

2.0-M1 is out but not sure on the stability. 

On Mar 6, 2020, at 6:15 AM, Andreas Joseph Krogh <and...@visena.com> wrote:


På tirsdag 04. februar 2020 kl. 12:39:10, skrev Francois <fan...@gmail.com>:
If anybody has the problem: it was reported to `scala-xml` project at https://github.com/scala/scala-xml/issues/392

A PR correcting the behaviour was done here: https://github.com/scala/scala-xml/pull/396

It will be part of next scala-xml version 1.3.0 release.
 
Any news on 1.3.0's release?
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lif...@googlegroups.com.

Antonio Salazar Cardozo

unread,
Apr 14, 2020, 7:32:27 PM4/14/20
to Lift
Opened a PR here: https://github.com/lift/framework/pull/1981 . Haven't had a chance
to test it though, and may not have the chance for a bit, so assuming the Travis build
passes, if someone could poke at that branch and make sure it fixes some of the issues
we've been seeing, we can look at putting out a release.
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages