docs.scala-lang icon indicating copy to clipboard operation
docs.scala-lang copied to clipboard

String interpolation doc page should cover pattern matching

Open SethTisue opened this issue 2 years ago • 0 comments

I was surprised today to notice that https://docs.scala-lang.org/overviews/core/string-interpolation.html makes no reference to the use of string interpolation in patterns, e.g. with the s interpolator:

scala 2.13.10> "foo bar" match { case s"f${x}r" => x }
               ^
               warning: match may not be exhaustive.
val res1: String = oo ba

there is a bit of material on this https://docs.scala-lang.org/sips/string-interpolation.html but not very much (it only references a theoretical xml interpolator — understandable since the SIP predates any use of the feature in the Scala stdlib)

SethTisue avatar Jan 30 '23 21:01 SethTisue