Fix data-type reification from Void

This commit is contained in:
KtorZ 2024-10-19 10:50:44 +02:00
parent 523b270a8f
commit 4b95db4f88
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
3 changed files with 31 additions and 2 deletions

View File

@ -1,6 +1,20 @@
# Changelog # Changelog
## v1.1.4 -2024-10-01 ## v1.1.5 - UNRELEASED
### Added
- N/A
### Changed
- **aiken-lang**: Fix data-type reification from `Void`; somehow missing from known definition :facepalm:. @KtorZ
### Removed
- N/A
## v1.1.4 - 2024-10-01
### Added ### Added

View File

@ -1486,6 +1486,16 @@ pub fn prelude_data_types(id_gen: &IdGenerator) -> IndexMap<DataTypeKey, TypedDa
data_data_type, data_data_type,
); );
// Void
let void_data_type = TypedDataType::void();
data_types.insert(
DataTypeKey {
module_name: "".to_string(),
defined_type: well_known::VOID.to_string(),
},
void_data_type,
);
// Ordering // Ordering
let ordering_data_type = TypedDataType::ordering(); let ordering_data_type = TypedDataType::ordering();
data_types.insert( data_types.insert(
@ -1569,6 +1579,10 @@ impl TypedDataType {
DataType::known_enum(well_known::DATA, &[]) DataType::known_enum(well_known::DATA, &[])
} }
pub fn void() -> Self {
DataType::known_enum(well_known::VOID, well_known::VOID_CONSTRUCTORS)
}
pub fn bool() -> Self { pub fn bool() -> Self {
DataType::known_enum(well_known::BOOL, well_known::BOOL_CONSTRUCTORS) DataType::known_enum(well_known::BOOL, well_known::BOOL_CONSTRUCTORS)
} }

View File

@ -1233,7 +1233,8 @@ impl UntypedExpr {
} }
Err(format!( Err(format!(
"invalid type annotation {tipo:?} for {ix}{} constructor with fields: {fields:?}", "invalid type annotation {tipo:?} for {}{} constructor with fields: {fields:?}",
ix + 1,
ordinal::Ordinal::<usize>(ix + 1).suffix(), ordinal::Ordinal::<usize>(ix + 1).suffix(),
)) ))
} }