Handle error types in record/tag extensions when printing errors

This commit is contained in:
Ayaz Hafiz 2022-12-27 13:20:28 -06:00
parent dea114fcc4
commit 5b9e3aa856
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

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)
}