-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Closed
Copy link
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Description
Zig Version
0.12
Steps to Reproduce and Observed Behavior
test {
@compileLog(@TypeOf(&(try @as(anyerror!usize, 0))));
@compileLog(@TypeOf(&(@as(anyerror!usize, 0) catch {})));
@compileLog(@TypeOf(&(@as(anyerror!usize, 0) catch |err| return err)));
@compileLog(@TypeOf(&(@as(anyerror!usize, 0) catch |err| switch (err) {
else => return err,
})));
}Compile Log Output:
@as(type, *const usize)
@as(type, *const usize)
@as(type, *const usize)
@as(type, usize)
this didnt happen in 0.11, im guessing its caused by #18173
interestingly if you take the address of the switch itself it becomes correct
@compileLog(@TypeOf((@as(anyerror!usize, 0) catch |err| &switch (err) {
else => return err,
})));
@as(type, *const usize)
Expected Behavior
all logs should be *const usize
Compile Log Output:
@as(type, *const usize)
@as(type, *const usize)
@as(type, *const usize)
@as(type, *const usize)
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.