mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Index into constraining via trait
This commit is contained in:
parent
24b6d4a3a9
commit
51d813dae2
3 changed files with 25 additions and 9 deletions
|
@ -198,7 +198,7 @@ pub fn constrain_pattern(
|
|||
// A -> ""
|
||||
// _ -> ""
|
||||
// so, we know that "x" (in this case, a tag union) must be open.
|
||||
let expected_type = *constraints.pattern_expectations[expected.index()].get_type_ref();
|
||||
let expected_type = *constraints[expected].get_type_ref();
|
||||
if could_be_a_tag_union(constraints, expected_type) {
|
||||
state
|
||||
.delayed_is_open_constraints
|
||||
|
@ -210,7 +210,7 @@ pub fn constrain_pattern(
|
|||
}
|
||||
|
||||
Identifier(symbol) | Shadowed(_, _, symbol) => {
|
||||
let expected = &constraints.pattern_expectations[expected.index()];
|
||||
let expected = &constraints[expected];
|
||||
let type_index = *expected.get_type_ref();
|
||||
|
||||
if could_be_a_tag_union(constraints, type_index) {
|
||||
|
@ -232,7 +232,7 @@ pub fn constrain_pattern(
|
|||
ident: symbol,
|
||||
specializes: _,
|
||||
} => {
|
||||
let expected = &constraints.pattern_expectations[expected.index()];
|
||||
let expected = &constraints[expected];
|
||||
let type_index = *expected.get_type_ref();
|
||||
|
||||
if could_be_a_tag_union(constraints, type_index) {
|
||||
|
@ -598,7 +598,7 @@ pub fn constrain_pattern(
|
|||
}
|
||||
|
||||
let pat_category = PatternCategory::Ctor(tag_name.clone());
|
||||
let expected_type = *constraints.pattern_expectations[expected.index()].get_type_ref();
|
||||
let expected_type = *constraints[expected].get_type_ref();
|
||||
|
||||
let whole_con = constraints.includes_tag(
|
||||
expected_type,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue