-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
eliminate the BoundFn type from the language and the compiler implementations #9484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What is the expected implementation here?
|
@zigazeljko apologies for not seeing your question earlier. You'll need to change the parser as noted here:
|
Probably a stupid question, but how will zig handle a 'class fn' in a struct? eg usually you want:
|
Is anyone working on this? I've been looking for something for a first time contribution that touches the language itself (since that's my interest area). Aside from overall simplification, what is the motivation for removing |
it is normal that I arrive at the following when applying the patch in the first comment?
compiled with zig version 0.10.0 fbe5336 case ZigTypeIdVector: {
// one of the following asserts fails...
assert(payload->special == ConstValSpecialStatic);
assert(payload->type == ir_type_info_get_type(ira, "Vector", nullptr));
BigInt *len = get_const_field_lit_int(ira, source_node, payload, "len", 0);
if (len == nullptr)
return ira->codegen->invalid_inst_gen->value->type;
ZigType *child_type = get_const_field_meta_type(ira, source_node, payload, "child", 1);
if ((err = ir_validate_vector_elem_type(ira, source_node, child_type))) {
return ira->codegen->invalid_inst_gen->value->type;
}
return get_vector_type(ira->codegen, bigint_as_u32(len), child_type);
} |
Currently the Zig type system has a "BoundFn" which can be observed thusly:
This type is to be removed from the language. Instead, method call syntax will be explicitly recognized in the parser. Here's an example which currently passes but will become a compile error:
After this change, this will give a compile error: struct
A
has no field namedb
.Related: #7942
Here's a diff to get you started:
The text was updated successfully, but these errors were encountered: