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

bizarre zig compilation error on commented out Go code in zig src file #5

Closed
zigster64 opened this issue Aug 2, 2024 · 3 comments
Closed

Comments

@zigster64
Copy link

This is a good one, and quite funny !

0.14.0-dev.823+624fa8523 on Mac intel. Don't know if Mac arm64 has the same issue yet.

src/datetime.zig:1007:2: error: expected statement, found 'invalid token'
// us := rand.Int63n(31536000000000000)

same thing happens in web socket lib

handshake.zig:55:5: error: expected statement, found 'invalid token'
// Connection: keep-alive, Upgrade

Not a problem with your code, but ... looks like its uncovered an interesting compiler bug.

At first I thought it might be the incompatible Go code in a comment tripping up sema, but on closer inspection, looks like its the presence of a colon in a comment.

Working on a patch to Zig to fix :)

@karlseguin
Copy link
Owner

Had karlseguin/websocket.zig#40 on websocket.zig re tab in a comment this morning.

@zigster64
Copy link
Author

zigster64 commented Aug 2, 2024

oh - its a tab in a comment ?

that's weird. ok thanks. Still a zig bug then - good catch (ok, not a zig bug after reading the linked issue - Andy really doesn't like his tabs, hey. Looks like zig fmt and no tabs till be a thing we will have to live with long term. Spec conformance - fair enough)

Yeah, can't reproduce with a simple test app with commented out Go code

@karlseguin
Copy link
Owner

ziglang/zig#20885

ziglang/zig-spec#38

This is the new reality I guess.

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