Zcu: fix nav_ty dependency on nav_val
In the case where a declaration has no type annotation, the interaction between resolution of `nav_ty` and `nav_val` is a little fiddly because of the fact that resolving `nav_val` actually implicitly resolves the type as well. This means `nav_ty` never gets an opporunity to mark its dependency on the `nav_val`. So, `ensureNavValUpToDate` needs to be the one to do it. It can't do it too early, though; otherwise, our marking of dependees as out-of-date/up-to-date will go wrong. Resolves: #23959
This commit is contained in:
30
test/incremental/dependency_on_type_of_inferred_global
Normal file
30
test/incremental/dependency_on_type_of_inferred_global
Normal file
@@ -0,0 +1,30 @@
|
||||
#target=x86_64-linux-selfhosted
|
||||
#target=x86_64-linux-cbe
|
||||
#target=x86_64-windows-cbe
|
||||
#target=wasm32-wasi-selfhosted
|
||||
#update=initial version
|
||||
#file=main.zig
|
||||
const foo = @as(u8, 123);
|
||||
comptime {
|
||||
// depends on value of `foo`
|
||||
if (foo != 123) unreachable;
|
||||
}
|
||||
comptime {
|
||||
// depends on type of `foo`
|
||||
if (@TypeOf(&foo) != *const u8) unreachable;
|
||||
}
|
||||
pub fn main() void {}
|
||||
#expect_stdout=""
|
||||
#update=change the type
|
||||
#file=main.zig
|
||||
const foo = @as(u16, 123);
|
||||
comptime {
|
||||
// depends on value of `foo`
|
||||
if (foo != 123) unreachable;
|
||||
}
|
||||
comptime {
|
||||
// depends on type of `foo`
|
||||
if (@TypeOf(&foo) != *const u8) unreachable;
|
||||
}
|
||||
pub fn main() void {}
|
||||
#expect_error=main.zig:8:37: error: reached unreachable code
|
||||
Reference in New Issue
Block a user