If there was an error in a program related to n, such as the use of an undefined name to declare it, the node may be incomplete. In particular, using n.Val() can cause panics, as is the case of n.Val().Interface().
A recent example: #21988
We should check the compiler to see if there are other instances of n.Val() use without us checking for n.Type == nil (or n.Type != nil). Ideally in an automated manner, as there are more than a hundred .Val() method calls in the gc package.
If there was an error in a program related to
n, such as the use of an undefined name to declare it, the node may be incomplete. In particular, usingn.Val()can cause panics, as is the case ofn.Val().Interface().A recent example: #21988
We should check the compiler to see if there are other instances of
n.Val()use without us checking forn.Type == nil(orn.Type != nil). Ideally in an automated manner, as there are more than a hundred.Val()method calls in thegcpackage.