Are more semicolons required in 2.13 than were needed in 2.12, particularly in for
comprehensions?
The following function works as I expect. Both IntelliJ and the scala compiler are happy.
def main(argv: Array[String]): Unit = {
val adjs = Seq(Map(1 -> Set(2, 3),
2 -> Set(1, 4),
3 -> Set(1, 4),
4 -> Set(2, 3, 5, 6, 7, 8),
5 -> Set(4, 6),
6 -> Set(4, 5),
7 -> Set(4, 8),
8 -> Set(4, 7)),
Map(1 -> Set(2),
2 -> Set(1))
)
for (adj <- adjs ;
_ = println(walk(adj));
(v, _) <- adj
)
{
println(s"$v " + computeWalk(adj, v, List()))
}
}
However, if I remove the semicolons, I get compilation errors.
def main(argv: Array[String]): Unit = {
val adjs = Seq(Map(1 -> Set(2, 3),
2 -> Set(1, 4),
3 -> Set(1, 4),
4 -> Set(2, 3, 5, 6, 7, 8),
5 -> Set(4, 6),
6 -> Set(4, 5),
7 -> Set(4, 8),
8 -> Set(4, 7)),
Map(1 -> Set(2),
2 -> Set(1))
)
for (adj <- adjs // no semicolon
_ = println(walk(adj)) // no semicolon
(v, _) <- adj
)
{
println(s"$v " + computeWalk(adj, v, List()))
}
}
Here are the errors:
/Users/jimka/Repos/algo/tp-theg/scala/theg/src/main/scala/theg/EulerianWalk.scala:106:12
')' expected but '=' found.
_ = println(walk(adj))
/Users/jimka/Repos/algo/tp-theg/scala/theg/src/main/scala/theg/EulerianWalk.scala:107:17
';' expected but '<-' found.
(v, _) <- adj
Also IntelliJ highlights the same errors (apparently) as the compiler identifies.