go/types: fix crash following misuse of [...]T in composite literal
The type-checker currently crashes when checking code such as: _ = map[string][...]int{"": {1, 2, 3}} In this case, the type checker reports an error for map[string][...]int, then proceeds to type-check the values of the map literal using a hint type of [...]int. When type-checking the inner composite (array) literal, the length of the open array type is computed from the elements, then the array type is recorded, but the literal has no explicit type syntax against which to record the type, so this code causes the type-checker to panic. Add a nil check before calling check.recordTypeAndValue to avoid that. Updates #22467 Change-Id: Ic4453ba485b7b88ede2a89f209365eda9e032abc Reviewed-on: https://go-review.googlesource.com/132355Reviewed-by: Alan Donovan <adonovan@google.com>
Showing
Please
register
or
sign in
to comment