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
The root cause for the current behavior is that the check that the defer expression is a function call happens at parse time; and if there are parse errors, gotype stops (and doesn't bother type-checking the code). go/types testing on the other hand continues, hence the discrepancy.
We cannot easily remove the parser check as it would require changing the field go/ast/DeferStmt.Call (which we know is a *go/ast/CallExpr) to an unchecked expression, which is a backward-incompatible change.
Instead, make gotype continue with type-checking even if there are parser errors.
type-checks with only one error:
It should also complain about
i
being declared but not used.See also #23586.
The text was updated successfully, but these errors were encountered: