Re-use generic id across builtin type-definitions.
This was somehow wrong and corrected by codegen later on, but we should be re-using the same generic id across an entire definition if the variable refers to the same element.
This commit is contained in:
parent
1070347203
commit
ef70c6b8a8
|
@ -394,7 +394,7 @@ pub fn prelude(id_gen: &IdGenerator) -> TypeInfo {
|
||||||
TypeConstructor {
|
TypeConstructor {
|
||||||
location: Span::empty(),
|
location: Span::empty(),
|
||||||
parameters: vec![option_value.clone()],
|
parameters: vec![option_value.clone()],
|
||||||
tipo: option(option_value),
|
tipo: option(option_value.clone()),
|
||||||
module: "".to_string(),
|
module: "".to_string(),
|
||||||
public: true,
|
public: true,
|
||||||
},
|
},
|
||||||
|
@ -405,12 +405,10 @@ pub fn prelude(id_gen: &IdGenerator) -> TypeInfo {
|
||||||
vec!["Some".to_string(), "None".to_string()],
|
vec!["Some".to_string(), "None".to_string()],
|
||||||
);
|
);
|
||||||
|
|
||||||
let some = generic_var(id_gen.next());
|
|
||||||
|
|
||||||
prelude.values.insert(
|
prelude.values.insert(
|
||||||
"Some".to_string(),
|
"Some".to_string(),
|
||||||
ValueConstructor::public(
|
ValueConstructor::public(
|
||||||
function(vec![some.clone()], option(some)),
|
function(vec![option_value.clone()], option(option_value.clone())),
|
||||||
ValueConstructorVariant::Record {
|
ValueConstructorVariant::Record {
|
||||||
module: "".into(),
|
module: "".into(),
|
||||||
name: "Some".to_string(),
|
name: "Some".to_string(),
|
||||||
|
@ -422,12 +420,10 @@ pub fn prelude(id_gen: &IdGenerator) -> TypeInfo {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
let some = generic_var(id_gen.next());
|
|
||||||
|
|
||||||
prelude.values.insert(
|
prelude.values.insert(
|
||||||
"None".to_string(),
|
"None".to_string(),
|
||||||
ValueConstructor::public(
|
ValueConstructor::public(
|
||||||
option(some),
|
option(option_value),
|
||||||
ValueConstructorVariant::Record {
|
ValueConstructorVariant::Record {
|
||||||
module: "".into(),
|
module: "".into(),
|
||||||
name: "None".to_string(),
|
name: "None".to_string(),
|
||||||
|
|
|
@ -9,7 +9,7 @@ Schema {
|
||||||
Var {
|
Var {
|
||||||
tipo: RefCell {
|
tipo: RefCell {
|
||||||
value: Generic {
|
value: Generic {
|
||||||
id: 37,
|
id: 35,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
alias: None,
|
alias: None,
|
||||||
|
|
|
@ -9,7 +9,7 @@ Schema {
|
||||||
Var {
|
Var {
|
||||||
tipo: RefCell {
|
tipo: RefCell {
|
||||||
value: Generic {
|
value: Generic {
|
||||||
id: 37,
|
id: 35,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
alias: None,
|
alias: None,
|
||||||
|
|
Loading…
Reference in New Issue