MCPcopy
hub / github.com/uber-go/nilaway / FuncErrRetNonnilArg

Struct FuncErrRetNonnilArg

assertion/function/assertiontree/rich_check_effect.go:114–119  ·  view source on GitHub ↗

A FuncErrRetNonnilArg is a RichCheckEffect for a trusted function call `f(..., &v, ...)` whose final result is of type `error` and which, on success (`err == nil`), guarantees that the pointee `v` of a by-address argument is non-nil. The canonical example is `json.Unmarshal(data, &v)`: once the retu

Source from the content-addressed store, hash-verified

112// pre-existing expression with its own (e.g., unassigned/nilable) producer, so on the error-is-nil
113// branch we must actively *produce* a non-nil value for it, exactly as a `v != nil` check would.
114type FuncErrRetNonnilArg struct {
115 root *RootAssertionNode // an associated root node
116 err TrackableExpr // the `error`-typed return of the function
117 arg TrackableExpr // the trackable pointee argument guaranteed non-nil on success
118 argExpr ast.Expr // the raw pointee expression, for producing a non-nil value
119}
120
121func (f *FuncErrRetNonnilArg) isTriggeredBy(expr ast.Expr) bool {
122 return exprIsPositiveNilCheck(f.root, expr, f.err)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected