You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
value with comptime-only type '@TypeOf(null)' depends on runtime control flow #16770
enhancementSolving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.
fnfoo(x: bool) error{OutOfMemory}![]constu8 {
if (x) return""elsereturnerror.OutOfMemory;
}
test {
varx=true;
constval=foo(x) catch|err|switch (err) {
error.OutOfMemory=>null,
};
_=val;
}
~ % zig test test.zig
test.zig:7:36: error: value with comptime-only type '@TypeOf(null)' depends on runtime control flow
const val = foo(x) catch |err| switch (err) {
^~~~~~
test.zig:7:24: note: runtime control flow here
const val = foo(x) catch |err| switch (err) {
~~~~~~~^~~~~
Giving val an explicit type of ?[]const u8 prevents the error
enhancementSolving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.
Activity
mlugg commentedon Aug 11, 2023
Will be solved by the implementation of #11957
andrewrk commentedon Jan 9, 2024
fixed by acca16c