···110110 ConcatPatternVariableLeftHandSide,
111111 /// A variable was assigned as infix between prefix and suffix string
112112 /// patterns using <>
113113- ConcatPatternVariableInInfixPosition,
113113+ ConcatPatternVariableWithSuffix {
114114+ name: EcoString,
115115+ },
114116 ListSpreadWithoutTail, // let x = [1, ..]
115117 ExpectedFunctionBody, // let x = fn()
116118 RedundantInternalAttribute, // for a private definition marked as internal
···557559 extra_labels: vec![],
558560 },
559561560560- ParseErrorType::ConcatPatternVariableInInfixPosition => ParseErrorDetails {
562562+ ParseErrorType::ConcatPatternVariableWithSuffix { name}=> ParseErrorDetails {
561563 text: [
562562- "We can't tell what size this infix should be so we don't know",
563563- "how to handle this pattern.",
564564+ "A string pattern can only match on a literal string prefix.",
564565 "",
565565- "If you want to match one character consider using `pop_grapheme`",
566566- "from the stdlib's `gleam/string` module.",
566566+ &format!("Matching on a literal suffix is not possible, because `{}` would have an unknown size.", name),
567567 ]
568568 .join("\n"),
569569 hint: None,
570570- label_text: "This must be a string literal prefix".into(),
570570+ label_text: "This pattern is not allowed".into(),
571571 extra_labels: vec![],
572572 },
573573
···11+---
22+source: compiler-core/src/parse/tests.rs
33+expression: "case \"\" {\n \"prefix\" <> wibble <> -> wibble\n}"
44+---
55+----- SOURCE CODE
66+case "" {
77+ "prefix" <> wibble <> -> wibble
88+}
99+1010+----- ERROR
1111+error: Syntax error
1212+ ┌─ /src/parse/error.gleam:2:24
1313+ │
1414+2 │ "prefix" <> wibble <> -> wibble
1515+ │ ^^ This pattern is not allowed
1616+1717+A string pattern can only match on a literal string prefix.
1818+1919+Matching on a literal suffix is not possible, because `wibble` would have an unknown size.