Adjust order in which Bool's constructors are declared in the prelude

True corresponds to Constr=1 and False corresponds to Constr=0; their position in the vector shall reflect that. Note that while this would in principle impact codegen for any other type, it doesn't for bool since we likely never looked up this type definition since it is well-known. It does now as the 'reify' function relies on this. Whoopsie.
This commit is contained in:
KtorZ
2024-02-28 10:09:29 +01:00
parent 14f1025f0b
commit 5272f5ecee
2 changed files with 62 additions and 34 deletions

View File

@@ -82,22 +82,7 @@ pub fn prelude(id_gen: &IdGenerator) -> TypeInfo {
// Bool
prelude.types_constructors.insert(
BOOL.to_string(),
vec!["True".to_string(), "False".to_string()],
);
prelude.values.insert(
"True".to_string(),
ValueConstructor::public(
bool(),
ValueConstructorVariant::Record {
module: "".into(),
name: "True".to_string(),
field_map: None::<FieldMap>,
arity: 0,
location: Span::empty(),
constructors_count: 2,
},
),
vec!["False".to_string(), "True".to_string()],
);
prelude.values.insert(
@@ -115,6 +100,21 @@ pub fn prelude(id_gen: &IdGenerator) -> TypeInfo {
),
);
prelude.values.insert(
"True".to_string(),
ValueConstructor::public(
bool(),
ValueConstructorVariant::Record {
module: "".into(),
name: "True".to_string(),
field_map: None::<FieldMap>,
arity: 0,
location: Span::empty(),
constructors_count: 2,
},
),
);
prelude.types.insert(
BOOL.to_string(),
TypeConstructor {