new syntax (indentation) doesn’t allow if statement
Here is my code. The idea is that the grades go from 0-5 and it cannot go higher, thus the if command.
Highlighted in the code is the part that apparently is not allowed anymore (grade > 5)- I get a syntax error that says: “This construct is not allowed under -new-syntax.”
How to force a match type to be fully reduced on compile?
I don’t get why a match type is not always reduced. Match types should help to eliminate illegal arguments on compilation. But as it turns out it does not always reduce in full.
What is the difference between the types Null and Null & T where T <: AnyRef?
Look at the following method
Is there a syntax for varargs splicing compatible with both Scala 2 and Scala 3?
Context One of the differences between Scala 2 and Scala 3 is the syntax for varargs splices. So given def combine(strings: String*): Unit = { println(strings.mkString(“; “)) } val list = List(“a”, “b”) In Scala 2 one can call the function with: combine((list ++ list): _*) In Scala 3 the syntax is: combine((list ++ list)*) […]
How to handle duplicated export of an identical symbol?
Following code imports the same symbol twice, because it imports two different objects which both export it:
How to define a scala.ValueOf for tuples in scala 3?
The ValueOf
type function can be used in the contextual parameters list of a method to pick the single inhabitant of singleton type.