mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +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
|
@ -676,6 +676,22 @@ impl Constraints {
|
|||
roc_error_macros::assert_sizeof_default!(Constraint, 3 * 8);
|
||||
roc_error_macros::assert_sizeof_aarch64!(Constraint, 3 * 8);
|
||||
|
||||
impl std::ops::Index<ExpectedTypeIndex> for Constraints {
|
||||
type Output = Expected<TypeOrVar>;
|
||||
|
||||
fn index(&self, index: ExpectedTypeIndex) -> &Self::Output {
|
||||
&self.expectations[index.index()]
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Index<PExpectedTypeIndex> for Constraints {
|
||||
type Output = PExpected<TypeOrVar>;
|
||||
|
||||
fn index(&self, index: PExpectedTypeIndex) -> &Self::Output {
|
||||
&self.pattern_expectations[index.index()]
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Eq(
|
||||
pub TypeOrVar,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue