Skip to content

v0.8.2

Choose a tag to compare

@github-actions github-actions released this 14 Nov 00:55
· 12 commits to main since this release
v0.8.2
a7fde02

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 = u40 was reported as
    a private type. The builtin table listed only the common integer widths, so
    u40 did not count as a primitive and Code was never recorded as a type
    declaration. Any alias that reduces to a type the caller can spell is no
    longer reported, whatever its pub status: a primitive, another pub type,
    or a shape like []const u8 around one. pub const UINT = c_uint was 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
    private Hidden went unreported, as did const ObjectPointer = *anyopaque.
  • Z012 (qualified paths): Outer.Inner in 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
    be pub in 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 on b or self
    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,
    including std.Build.Cache.addFile called through self.
  • 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