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

langref and compiler disagree on @typeName of function-scoped container type #21535

Open
LearnLoop365 opened this issue Sep 27, 2024 · 0 comments · May be fixed by #21536
Open

langref and compiler disagree on @typeName of function-scoped container type #21535

LearnLoop365 opened this issue Sep 27, 2024 · 0 comments · May be fixed by #21536
Labels
Milestone

Comments

@LearnLoop365
Copy link

LearnLoop365 commented Sep 27, 2024

Zig Version

0.13.0

Steps to Reproduce and Observed Behavior

//! struct_name.zig
const std: type = @import("std");

pub fn main() void {
    std.debug.print("anonymous: {s}\n", .{@typeName(struct {})});
}

--------- Result ----------

$ zig run struct_name.zig
anonymous: struct_name.main__struct_2632

Expected Behavior

According to the docs: https://ziglang.org/documentation/master/#Struct-Naming

Expected by the 3rd rule:
"Otherwise, the struct gets a name such as (filename.funcname.__struct_ID)."

anonymous: struct_name.main.__struct_2632

Missing dot(.) between funcname and __struct_ID

If it's just a typo in the docs, fix the docs please.

@LearnLoop365 LearnLoop365 added the bug Observed behavior contradicts documented or intended behavior label Sep 27, 2024
@kj4tmp kj4tmp linked a pull request Sep 28, 2024 that will close this issue
@mlugg mlugg changed the title @typeName does not meet the 3rd rule of Struct Naming in the docs as it misses a dot after funcname langref and compiler disagree on @typeName of function-scoped container type Sep 30, 2024
@mlugg mlugg added docs and removed bug Observed behavior contradicts documented or intended behavior labels Sep 30, 2024
@mlugg mlugg added this to the 0.14.0 milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants