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?
Zig Version
zig-0.11.0-dev.2704+83970b6d9
Steps to Reproduce and Observed Behavior
Consider the following:
Compiler says:
error: use of undeclared identifier 'arg1'On the other hand we can get that type using another function
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
Expected Behavior
So maybe function prototypes should have their own scope?