mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Make structs with the same fields but with different tags distinct types
This commit is contained in:
@@ -955,7 +955,6 @@ struct_field_tags :: proc() {
|
|||||||
z: bool, // no tag
|
z: bool, // no tag
|
||||||
}
|
}
|
||||||
|
|
||||||
f: Foo;
|
|
||||||
ti := runtime.type_info_base(type_info_of(Foo));
|
ti := runtime.type_info_base(type_info_of(Foo));
|
||||||
s := ti.variant.(runtime.Type_Info_Struct);
|
s := ti.variant.(runtime.Type_Info_Struct);
|
||||||
fmt.println("Foo :: struct {");
|
fmt.println("Foo :: struct {");
|
||||||
|
|||||||
@@ -1712,6 +1712,12 @@ bool are_types_identical(Type *x, Type *y) {
|
|||||||
if (xf_is_using ^ yf_is_using) {
|
if (xf_is_using ^ yf_is_using) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (x->Struct.tags.count != y->Struct.tags.count) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (x->Struct.tags.count > 0 && x->Struct.tags[i] != y->Struct.tags[i]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user