Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stage2: --watch broken on with std support #8480

Closed
g-w1 opened this issue Apr 9, 2021 · 2 comments
Closed

stage2: --watch broken on with std support #8480

g-w1 opened this issue Apr 9, 2021 · 2 comments
Milestone

Comments

@g-w1
Copy link
Contributor

g-w1 commented Apr 9, 2021

❯ git log | head -n2
commit 0d92bd474f0aa93c79b532b6dc713790597fa293
Author: jacob gw <jacoblevgw@gmail.com>

❯ ninja
ninja: no work to do.

❯ cat test.zig
const std = @import("std");
export fn _start() void {}

❯ ./zig build-exe test.zig -fno-LLVM

❯ vim test.zig

❯ cat test.zig
const std = @import("std");
export fn _start() void {
    const builtin = std.builtin;
}

❯ ./zig build-exe test.zig -fno-LLVM --watch
error(module): TODO: analyze usingnamespace decl
error(module): TODO: analyze usingnamespace decl
/home/jacob/dev/zig/build/zig-cache/o/123cedf7d91452b8b51164dbd7b9e47f/builtin.zig:12:25: error: use of undeclared identifier 'OutputMode'
pub const output_mode = OutputMode.Exe;
                        ^
(zig) ^Z
[1]+  Stopped                 ./zig build-exe test.zig -fno-LLVM --watch

✦ ❯ vim test.zig

✦ ❯ cat test.zig

const std = @import("std");
export fn _start() void {}

✦ ❯ fg
./zig build-exe test.zig -fno-LLVM --watch

unknown command:
(zig) update
error(module): TODO: analyze usingnamespace decl
error(module): TODO: analyze usingnamespace decl
/home/jacob/dev/zig/build/zig-cache/o/123cedf7d91452b8b51164dbd7b9e47f/builtin.zig:12:25: error: use of undeclared identifier 'OutputMode'
pub const output_mode = OutputMode.Exe;
                        ^
(zig)

As you can see, we start with the easiest file, which zig can do, then we up the complexity, which zig can't do, when going back down to the easier file with update, zig still is stuck on its past errors.
Failing test case:

{
        var case = ctx.exe("importing builtin", linux_x64);
        case.addCompareOutput(
            \\pub export fn _start() noreturn {
            // \\  const std = @import("std");
            \\  exit();
            \\}
            \\fn exit() noreturn {
            \\    asm volatile ("syscall"
            \\        :
            \\        : [number] "{rax}" (231),
            \\          [arg1] "{rdi}" (@as(usize, 0))
            \\        : "rcx", "r11", "memory"
            \\    );
            \\    unreachable;
            \\}
            \\
        , "");
        case.addError(
            \\pub export fn _start() noreturn {
            \\  const std = @import("std");
            \\  exit();
            \\}
            \\fn exit() noreturn {
            \\    asm volatile ("syscall"
            \\        :
            \\        : [number] "{rax}" (231),
            \\          [arg1] "{rdi}" (@as(usize, 0))
            \\        : "rcx", "r11", "memory"
            \\    );
            \\    unreachable;
            \\}
            \\
        , &.{":20:16: error: struct 'struct {}' has no member named 'output_mode'"});
        case.addCompareOutput(
            \\pub export fn _start() noreturn {
            // \\  const std = @import("std");
            \\  exit();
            \\}
            \\fn exit() noreturn {
            \\    asm volatile ("syscall"
            \\        :
            \\        : [number] "{rax}" (231),
            \\          [arg1] "{rdi}" (@as(usize, 0))
            \\        : "rcx", "r11", "memory"
            \\    );
            \\    unreachable;
            \\}
            \\
        , "");
    }
Case 'importing builtin': unexpected errors at update_index=2:
========================================
:20:16: error: struct 'struct {}' has no member named 'output_mode'
========================================
@andrewrk
Copy link
Member

andrewrk commented May 19, 2021

The test case is wrong because it should not be a compile error. After merging #8554 the expected behavior happens, which is to successfully compile all 3 times.

Did this issue ever even apply to master branch? The issue tracker is for master branch only.

@g-w1
Copy link
Contributor Author

g-w1 commented May 19, 2021

This did apply to master branch at one point I think.

@andrewrk andrewrk added this to the 0.8.0 milestone Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants