You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val s: String = "Hello World!"
val pair = List(1, 2, 3, 4)
val p01 = pair zip s
val p02 = s zip pair
If i use those expressions
p01 unzip (line1)
p02 unzip (line2)
I get an warning on Line1 (postfix operator unzip should be enabled by making the implicit value scala.language.postfixOps visible.)
and an error on Line2.
if I add "import scala.language.postfixOps" the warning goes away but the error stay.
if I keep the import and add ";" after line1 everything it's fine!
if I keep the import and add a blank line between line1 and line2 it's fine also!
Interesting: If I do not have the import statement but keep a blank line between two lines
I get the warnings but it works.
I've seen this behavior so far only for "unzip".
Here's the code:
"
val s: String = "Hello World!"
val pair = List(1, 2, 3, 4)
val p01 = pair zip s
val p02 = s zip pair
//import scala.language.postfixOps
//if I have a line in between or ";" after the first line no warnings or errors!
p01 unzip
p02 unzip
*/
The text was updated successfully, but these errors were encountered:
@SethTisue said:
The unfortunate interaction of language.postfixOps with semicolon inference is exactly the reason why the postfix syntax was put behind a flag. It's better not to use or enable this feature at all.
You're experiencing this with "unzip" in particular because it takes an implicit parameter list.
I have this piece of code:
val s: String = "Hello World!"
val pair = List(1, 2, 3, 4)
val p01 = pair zip s
val p02 = s zip pair
If i use those expressions
p01 unzip (line1)
p02 unzip (line2)
I get an warning on Line1 (postfix operator unzip should be enabled by making the implicit value scala.language.postfixOps visible.)
and an error on Line2.
if I add "import scala.language.postfixOps" the warning goes away but the error stay.
if I keep the import and add ";" after line1 everything it's fine!
if I keep the import and add a blank line between line1 and line2 it's fine also!
Interesting: If I do not have the import statement but keep a blank line between two lines
I get the warnings but it works.
I've seen this behavior so far only for "unzip".
Here's the code:
"
val s: String = "Hello World!"
val pair = List(1, 2, 3, 4)
val p01 = pair zip s
val p02 = s zip pair
//import scala.language.postfixOps
//if I have a line in between or ";" after the first line no warnings or errors!
p01 unzip
p02 unzip
*/
The text was updated successfully, but these errors were encountered: