Skip to content

v0.18.0

Choose a tag to compare

@github-actions github-actions released this 02 Oct 08:19
· 17 commits to main since this release
Immutable release. Only release title and notes can be modified.
3144653

Important

declscope shrink reports change on unchanged code. Some values of an enum are no longer reported, and an existing //declscope:ignore overexported on such a value can now be reported as unused. The analyzer is unchanged.

shrink

  • The values of an enum are judged as one set. A const block of 2 or more constants, all of one exported type of the package, is a set. Before, each constant was judged on its own, so a set could split: the values another package happened to use stayed exported, and the rest were unexported. Keeping it whole took one ignore per value. (#179, #180)

    // internal/user/user.go
    type Status string
    
    const (
    	Active  Status = "active"
    	Blocked Status = "blocked"
    )
    
    const DefaultStatus Status = Active
    
    // api/api.go
    var _ = user.Active
    Case Result
    The type is used, silenced or baselined, or another package uses any value No value of the set is reported. Blocked above
    The type is reported Every value is reported with it
    One value keeps its name Every other value's fix is withheld: another value of its const block keeps its name
    A constant outside such a block Judged on its own, as before. DefaultStatus above
    A block that mixes in another constant, or a block of another package's type such as time.Duration Not a set, judged one by one

    To put a default in the set, put it in the block. Implicit types from iota or a repeated expression count. A blank _ does not.

    An ignore you added to keep a set whole is now reported as unused when the set is left alone. Remove it.

Specs

  • shrink_settle.fsl proves that a const set is fixed or kept whole, and that one run of -fix still settles the package. (#181)
  • Every leadsTo is proved for all depths, by a ranking measure, and verify.sh checks that each one is. The specs move to fslc 4.8.1. (#178)

Changelog

  • 5132e64 feat(shrink): judge the values of an enum as one set, by their const block (#180)
  • d46fba9 spec: prove a const set is fixed or kept whole when shrink settles (#181)
  • a6ad8d7 spec: prove every leadsTo by ranking, and adopt state initializers (#178)