A/a case, not case
case.
Apparently case a
matches anything and binds it to the name a
, while case A
looks for an A
variable and matches anything ==
considers equal to A
. This came as quite a surprise to me; while I know Scala is case sensitive, I never expected identifier case to affect the parsing rules.
Is it common for Scala's syntax to care about the case of identifiers, or is there only a small number of contexts in which this happens? If there's only a small number of such contexts, what are they? I couldn't find anything on Google; all I got were results about pattern matching.