Skip to content

Commit

Permalink
Add error catching before .expect() in name_resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
alancai98 committed Jul 31, 2023
1 parent 7023a1e commit a94edc0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion partiql-ast-passes/src/name_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,19 @@ impl<'ast> Visitor<'ast> for NameResolver {
self.enter_keyref();
let id = *self.current_node();

if self
.enclosing_clause
.get(&EnclosingClause::FromLet)
.is_none()
{
self.errors.push(AstTransformError::IllegalState(
"group_key expects a FromLet enclosing clause".to_string(),
))
}

self.enclosing_clause
.get(&EnclosingClause::FromLet)
.unwrap()
.expect("EnclosingClause::FromLet")
.iter()
.for_each(|enclosing_clause| {
self.in_scope
Expand Down
2 changes: 1 addition & 1 deletion partiql-conformance-tests/partiql-tests

0 comments on commit a94edc0

Please sign in to comment.