Skip to content

Commit

Permalink
Accept ProjExpr in filters.
Browse files Browse the repository at this point in the history
This is required to extract members of structs in a filter.
As an absolute baseline, the lhs is checked to be a legal element in a
filter, but there are potential problems, for instance with mutable
pointers, that might break in the future. If something like this comes
up we will fix it.
  • Loading branch information
m-kurtenacker committed Aug 13, 2024
1 parent 5d1e2b6 commit e24df60
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,13 @@ bool TypeChecker::check_filter(const ast::Expr& expr) {
is_mutable = true;
else
return true;
} else if (expr.isa<ast::LiteralExpr>())
} else if (expr.isa<ast::LiteralExpr>()) {
return true;
} else if (auto proj = expr.isa<ast::ProjExpr>()) {
//This needs to be supported to inspect struct and tuple members.
//TODO: Not sure if this check coveres all possible problematic cases.
return check_filter(*proj->expr);
}

error(expr.loc, "unsupported expression in filter");
if (is_logic_or)
Expand Down

0 comments on commit e24df60

Please sign in to comment.