Closed
Description
Compiler version
Minimized code
//> using scala 3.nightly
import scala.language.experimental.namedTuples
case class City(name: String, population: Int)
def getCityInfo(city: City) =
city match
case City(iam = n, confused = p) => s"[City] $n has a population of $p !!!!!!!!!!"
@main
def main =
val city = City(name = "New York", population = 8_000_000)
println(getCityInfo(city))
Output
[City] New York has a population of 8000000 !!!!!!!!!!
Expectation
Compilation error, that iam
and confused
aren't fields of the class City