Following https://go.dev/cl/478715, type-checking the following two packages causes an assertion failure inside of go/types:
-- lib.go --
package lib
const C = undef
-- p.go --
package p
import "lib"
const _ = lib.C
The problem is that undefined constants are imported as valid operands.
This is actually tricky to fix forward, as certain imports must have invalid type, initially (specifically: functions in the unsafe package). Therefore, I think we should revert that CL, putting back the defensive logic.
CC @griesemer