Repository navigation
v0.8.2
Z012 Sees Through Aliases, Z011 Finds Build-File Deprecations
This release fixes a class of Z012 false positives on type aliases, the
false negatives that hid behind them on qualified paths, and the Z011 gap
that kept b.lazyDependency(...) in a build.zig from being reported.
Fixes
- Z012 (aliases are transparent):
pub const Code = u40was reported as
a private type. The builtin table listed only the common integer widths, so
u40did not count as a primitive andCodewas never recorded as a type
declaration. Any alias that reduces to a type the caller can spell is no
longer reported, whatever itspubstatus: a primitive, another pub type,
or a shape like[]const u8around one.pub const UINT = c_uintwas the
same bug, and the C ABI primitives were missing from the table as well. - Z012 (local types read as imports): a resolver answer of
user_type
counted as an import even when the type lived in the same module. That
excused every local alias to a private type:const Alias = Hidden;with a
privateHiddenwent unreported, as didconst ObjectPointer = *anyopaque. - Z012 (qualified paths):
Outer.Innerin a signature was never checked,
and an alias whose initializer is a qualified path read as an import. Both
are checked now: the base must be nameable by the caller and the field must
bepubin its container. Against the Zig 0.16 tree this finds 13 published
functions that hand out a private nested type, plus one private nested error
set reported as Z015. - Z011 (parameter receivers):
fn build(b: *std.Build)receivers resolved
to unknown, because the resolver only knew module-level declarations, and
pointer types resolved with no pointee, so method lookup onborself
found nothing. The resolver now resolves pointer and optional children and
unwraps them for method lookup, and the linter maps a parameter receiver to
its declared type. This finds 3 deprecated calls in the Zig 0.16 tree,
includingstd.Build.Cache.addFilecalled throughself. - Z011 (multi-line messages): a deprecation doc that runs to several lines
(std.mem.Allocator.dupeZ) produced a diagnostic that continued on the next
output line. The message now carries the deprecation line only. - Duplicate diagnostics: a signature that names the same private type
twice (f(a: Hidden, b: Hidden)) reported the function twice.
Verification
One diagnostic per report site is now enforced, and the Z012 and Z011 changes
were diffed against the whole Zig 0.16 tree before release: 17 new reports,
all confirmed as genuine findings, and 2 Z012 false positives removed. No
other rule's output changed.
Installation
mise use github:rockorager/ziglint@v0.8.2