resolver->push_new_type_rib (resolver->get_type_scope ().peek ());
resolver->push_new_label_rib (resolver->get_type_scope ().peek ());
- // FIXME: this declaration should be removed after refactoring
- // parse_match_arm_patterns output into an AltPattern
+ // We know expr.get_patterns () has one pattern at most
+ // so there's no reason to handle it like an AltPattern.
std::vector<PatternBinding> bindings
- = {PatternBinding (PatternBoundCtx::Or, std::set<Identifier> ())};
+ = {PatternBinding (PatternBoundCtx::Product, std::set<Identifier> ())};
for (auto &pattern : expr.get_patterns ())
{
ResolveExpr::go (arm.get_guard_expr ().get (), prefix,
canonical_prefix);
- // FIXME: this declaration should be removed after refactoring
- // parse_match_arms_patterns output into a single AltPattern
+ // We know expr.get_patterns () has one pattern at most
+ // so there's no reason to handle it like an AltPattern.
std::vector<PatternBinding> bindings
- = {PatternBinding (PatternBoundCtx::Or, std::set<Identifier> ())};
+ = {PatternBinding (PatternBoundCtx::Product, std::set<Identifier> ())};
// insert any possible new patterns
for (auto &pattern : arm.get_patterns ())
--- /dev/null
+fn main()
+{
+ match (1, 2) {
+ (a, a) => {},
+ }
+ // { dg-error "identifier .a. is bound more than once in the same pattern .E0416." "" { target *-*-* } .-2 }
+
+ if let (a, a) = (1, 2) {}
+ // { dg-error "identifier .a. is bound more than once in the same pattern .E0416." "" { target *-*-* } .-1 }
+
+ let (a, a) = (1, 2);
+ // { dg-error "identifier .a. is bound more than once in the same pattern .E0416." "" { target *-*-* } .-1 }
+
+}