Closed
Description
From gitter a few days back:
Welcome to Scala 2.13.0-M3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_121).
Type in expressions for evaluation. Or try :help.
scala> def nom(foods: List["food"]): Unit = println("yum!")
nom: (foods: List["food"])Unit
scala> nom("food" :: Nil)
^
error: type mismatch;
found : rassoc$1.type (with underlying type String)
required: "food"
scala> nom(Nil.::("food"))
yum!
The temporary ValDef
that "food"
is put in during desugaring gets typed with the widened String
, rather than "food"
.