Browse Source

cranelift-isle: if-let patterns aren't root terms (#5233)

The `is_root` flag to `translate_pattern` just determines whether the
`rule_term` argument is used, which begs a larger cleanup. But that
cleanup is less clear if `is_root` is set anywhere aside from the call
in `collect_rules`. So I wanted to get confirmation that this particular
use of that flag is incorrect first.

These two arguments (`is_root` and `rule_term`) are used to prevent
expansion of a term as an internal extractor ("macro") if:
- that term is also an internal constructor
- and it's the root term on the left-hand side of the current rule
- and the pattern we're currently translating has no parents.

I'm not sure what it should mean to use the term you're currently
defining as the root pattern on the left-hand side of an if-let in the
same rule, but I don't think it should have this particular special
treatment.
pull/5244/head
Jamey Sharp 2 years ago
committed by GitHub
parent
commit
86679489ef
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cranelift/isle/isle/src/sema.rs

2
cranelift/isle/isle/src/sema.rs

@ -2397,7 +2397,7 @@ impl TermEnv {
&iflet.pattern,
Some(ty),
bindings,
/* is_root = */ true,
/* is_root = */ false,
)?;
Some(IfLet { lhs, rhs })

Loading…
Cancel
Save