Merge pull request #4825 from roc-lang/i4773

Handle error types in record/tag extensions when printing errors
This commit is contained in:
Folkert de Vries 2022-12-27 23:13:59 +01:00 committed by GitHub
commit 1abc6d68a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3967,6 +3967,8 @@ fn flat_type_to_err_type(
ErrorType::Record(err_fields, TypeExt::RigidOpen(var))
}
ErrorType::Error => ErrorType::Record(err_fields, TypeExt::Closed),
other =>
panic!("Tried to convert a record extension to an error, but the record extension had the ErrorType of {:?}", other)
}
@ -3991,6 +3993,8 @@ fn flat_type_to_err_type(
ErrorType::TagUnion(err_tags, TypeExt::RigidOpen(var), pol)
}
ErrorType::Error => ErrorType::TagUnion(err_tags, TypeExt::Closed, pol),
other =>
panic!("Tried to convert a tag union extension to an error, but the tag union extension had the ErrorType of {:?}", other)
}
@ -4019,6 +4023,8 @@ fn flat_type_to_err_type(
ErrorType::TagUnion(err_tags, TypeExt::RigidOpen(var), pol)
}
ErrorType::Error => ErrorType::TagUnion(err_tags, TypeExt::Closed, pol),
other =>
panic!("Tried to convert a tag union extension to an error, but the tag union extension had the ErrorType of {:?}", other)
}
@ -4049,6 +4055,8 @@ fn flat_type_to_err_type(
ErrorType::RecursiveTagUnion(rec_error_type, err_tags, TypeExt::RigidOpen(var), pol)
}
ErrorType::Error => ErrorType::RecursiveTagUnion(rec_error_type, err_tags, TypeExt::Closed, pol),
other =>
panic!("Tried to convert a recursive tag union extension to an error, but the tag union extension had the ErrorType of {:?}", other)
}