Source file src/simd/archsimd/_gen/cmd/specstats/invariants.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  // An invariant is a count in the report that has reached zero and must stay
     8  // there: the task that drove it to zero is done, so a nonzero value is a
     9  // regression in whatever change caused it, not progress still to make.
    10  // TestInvariants enforces them, naming the items that break each one.
    11  //
    12  // Counts still heading for zero are not invariants yet. When one reaches zero,
    13  // add it here, so that the change that finishes a task also guards it.
    14  type invariant struct {
    15  	name  string   // the figure's label in the report
    16  	tasks string   // SPEC-TRANSITION.md tasks that drove it to zero
    17  	items []string // what breaks it; empty when it holds
    18  }
    19  
    20  func (m *metrics) invariants() []invariant {
    21  	return []invariant{
    22  		{"type mismatches with spec (§2)", "fill-enforce", m.typeOK.missed()},
    23  		{"parameter-name mismatches with spec (§2)", "named-results", m.paramNameOK.missed()},
    24  		{"result-name mismatches with spec (§2)", "named-results", m.resultNameOK.missed()},
    25  		{"declarations with unnamed parameters spec names (§2)", "named-results", m.paramsFilled.missed()},
    26  		{"declarations with unnamed results spec names (§2)", "named-results", m.resultsFilled.missed()},
    27  		{"divergent parameter or result types across targets (§2)", "fill-enforce", m.typeSame.missed()},
    28  		{"divergent parameter names across targets (§2)", "fill-enforce, spec-all", m.paramNameSame.missed()},
    29  		{"divergent result names across targets (§2)", "named-results", m.resultNameSame.missed()},
    30  		{"hand-written doc conflicts with spec (§3)", "doc-triage", m.handConflictDecls},
    31  		{"drifted docs in simd mirror, simd_stubs.go vs simd_emulated.go (§3)", "comments-yaml", m.mirror.missed()},
    32  		{"midway/comments.yaml entries spec covers (§4)", "comments-yaml, spec-all", m.commentsSpecCoveredNames},
    33  	}
    34  }
    35  

View as plain text