-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed as not planned
Labels
proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Description
Zig Version
zig-0.11.0-dev.2704+83970b6d9
Steps to Reproduce and Observed Behavior
Consider the following:
const FnProto = fn (arg1: anytype, arg2: @TypeOf(arg1.some_field)) u32;Compiler says: error: use of undeclared identifier 'arg1'
On the other hand we can get that type using another function
fn dummy(arg1: anytype, arg2: @TypeOf(arg1.some_field)) u32 {
_ = arg2;
return 0;
}
const FnProto = @TypeOf(dummy);but I think that this is not the way out. Moreover, we may face to incorrect error message if there is a declaration with the same name as the parameter
const FnProto = fn (arg1: anytype, arg2: @TypeOf(arg1.some_field)) u32;
const arg1: u64 = 0;error: type 'u64' does not support field access
Expected Behavior
So maybe function prototypes should have their own scope?
adler-amorette
Metadata
Metadata
Assignees
Labels
proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.