Skip to content

stage1: fix case close to 8520 #8529

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

Closed
wants to merge 1 commit into from
Closed

stage1: fix case close to 8520 #8529

wants to merge 1 commit into from

Conversation

g-w1
Copy link
Contributor

@g-w1 g-w1 commented Apr 14, 2021

Fix a case close to #8520.

const expect = @import("std").testing.expect;
const Empty = struct {
    pub const PI = 3.14;
    pub const PI2: u32 = undefined;
};
test "struct namespaced variable" {
    expect(Empty.PI == 3.14);
    expect(Empty.PI2 == 3.14); // fails to fail
    expect(@sizeOf(Empty) == 0);

    // you can still instantiate an empty struct
    const does_nothing = Empty{};
}

image
Note: without the u32 type annotation here, it does not work.

@g-w1 g-w1 changed the title stage1: fix 8520 stage1: fix case close to 8520 Apr 14, 2021
@g-w1
Copy link
Contributor Author

g-w1 commented Apr 14, 2021

I think this is a bug that has a bigger root and this is a bad fix, closing.

@g-w1 g-w1 closed this Apr 14, 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

Successfully merging this pull request may close these issues.

1 participant