E4176#
Compiler diagnostic name: invalid_lexmatch_target.
この診断コードは不正な lexmatch の対象に使われていましたが、現在のコンパイラでは発生しません。現在の診断は E4222 です。
lexmatch works on textual views. The target expression must have a type that
can be matched by regex patterns, such as String or StringView, instead of a
numeric, boolean, or other unrelated type.
Erroneous example#
///|
pub fn match_number(n : Int) -> Unit {
lexmatch n with longest {
_ => ()
}
}
The target is an Int, which cannot be consumed by lexmatch.
Suggestion#
String または StringView を対象にするか、マッチの前に入力を変換してください。
///|
pub fn match_text(text : String) -> Unit {
lexmatch text with longest {
_ => ()
}
}