Merge pull request #4843 from roc-lang/pattern-as-can

Pattern as can
This commit is contained in:
Ayaz 2023-01-08 19:36:40 -06:00 committed by GitHub
commit 7c61d0d278
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 273 additions and 47 deletions

View file

@ -2869,6 +2869,8 @@ fn pattern_to_when<'a>(
(*new_symbol, Loc::at_zero(RuntimeError(error)))
}
As(_, _) => todo!("as bindings are not supported yet"),
UnsupportedPattern(region) => {
// create the runtime error here, instead of delegating to When.
// UnsupportedPattern should then never occur in When
@ -9390,6 +9392,7 @@ fn from_can_pattern_help<'a>(
match can_pattern {
Underscore => Ok(Pattern::Underscore),
Identifier(symbol) => Ok(Pattern::Identifier(*symbol)),
As(_, _) => todo!(),
AbilityMemberSpecialization { ident, .. } => Ok(Pattern::Identifier(*ident)),
IntLiteral(var, _, int_str, int, _bound) => Ok(make_num_literal_pattern(
env,