mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-08 14:03:14 +00:00
fix open bindings
`open` specifies the `mode` argument as vararg (presumably to make it optional). varargs actually have rules about casting, in this case the rule that any integer arg of size <= 4 has to be casted to `i32` before passing it. Not doing that implicit cast makes the permissions wrong or not apply at all.
This commit is contained in:
@@ -691,6 +691,13 @@ gb_internal bool sig_compare(TypeCheckSig *a, TypeCheckSig *b, Type *x, Type *y)
|
||||
}
|
||||
|
||||
gb_internal bool signature_parameter_similar_enough(Type *x, Type *y) {
|
||||
if (is_type_bit_set(x)) {
|
||||
x = bit_set_to_int(x);
|
||||
}
|
||||
if (is_type_bit_set(y)) {
|
||||
y = bit_set_to_int(y);
|
||||
}
|
||||
|
||||
if (sig_compare(is_type_pointer, x, y)) {
|
||||
return true;
|
||||
}
|
||||
@@ -737,6 +744,14 @@ gb_internal bool signature_parameter_similar_enough(Type *x, Type *y) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sig_compare(is_type_slice, x, y)) {
|
||||
Type *s1 = core_type(x);
|
||||
Type *s2 = core_type(y);
|
||||
if (signature_parameter_similar_enough(s1->Slice.elem, s2->Slice.elem)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return are_types_identical(x, y);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user