You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While reading code in unitchecker I noticed that the algorithm for Fact registration appears to be backwards (my bad), as noted by the TODO comment which I added in CL 443099. This issue is a reminder to fix it.
// Register fact types with gob.
// In VetxOnly mode, analyzers are only for their facts,
// so we can skip any analysis that neither produces facts
// nor depends on any analysis that produces facts.
//
// TODO(adonovan): fix: the command (and logic!) here are backwards.
// It should say "...nor is required by any...".
//
// Also build a map to hold working state and result.
type action struct {
once sync.Once
result interface{}
err error
usesFacts bool // (transitively uses)
diagnostics []analysis.Diagnostic
}
actions := make(map[*analysis.Analyzer]*action)
var registerFacts func(a *analysis.Analyzer) bool
registerFacts = func(a *analysis.Analyzer) bool {
act, ok := actions[a]
if !ok {
act = new(action)
var usesFacts bool
for _, f := range a.FactTypes {
usesFacts = true
gob.Register(f)
}
for _, req := range a.Requires {
if registerFacts(req) {
usesFacts = true
}
}
act.usesFacts = usesFacts
actions[a] = act
}
return act.usesFacts
}
The text was updated successfully, but these errors were encountered:
While reading code in unitchecker I noticed that the algorithm for Fact registration appears to be backwards (my bad), as noted by the TODO comment which I added in CL 443099. This issue is a reminder to fix it.
The text was updated successfully, but these errors were encountered: