A RichCheckEffect is the fact that a certain check is associated with an effect that can be triggered by a conditional, for example the `ok` in `v, ok := m[k]` the functions `effectIfTrue` and `effectIfFalse` are analogous to the respective returns from `AddNilCheck` - functions that are marked as
| 40 | // the effect. Whether an expression invalidates this effect is determined by the interface function |
| 41 | // `isInvalidatedBy`. |
| 42 | type RichCheckEffect interface { |
| 43 | // isTriggeredBy indicates whether a given expression in a conditional is sufficient to trigger |
| 44 | // this `RichCheckEffect` |
| 45 | isTriggeredBy(expr ast.Expr) bool |
| 46 | |
| 47 | // isInvalidatedBy indicates whether a given expression invalidates this effect |
| 48 | isInvalidatedBy(node ast.Node) bool |
| 49 | |
| 50 | // effectIfTrue is the effect to insert as preprocessing in the true branch of a triggering conditional |
| 51 | effectIfTrue(node *RootAssertionNode) |
| 52 | |
| 53 | // effectIfFalse is the effect to insert as preprocessing in the false branch of a triggering condition |
| 54 | effectIfFalse(node *RootAssertionNode) |
| 55 | |
| 56 | // isNoop returns whether this effect is a noop (i.e. placeholder value) |
| 57 | isNoop() bool |
| 58 | |
| 59 | // equals returns true iff this effect should be considered equal to another |
| 60 | // correctness of these `equals` functions is vital to correctness (and termination) of the propagation |
| 61 | // in `propagateRichChecks`. |
| 62 | equals(RichCheckEffect) bool |
| 63 | } |
| 64 | |
| 65 | // A FuncErrRet is a RichCheckEffect for the `err` in `r0, r1, r2, ..., err := f()`, where the |
| 66 | // function `f` has a final result of type `error` - and until this is checked all other results are |
no outgoing calls
no test coverage detected