Closed
Description
The compiler exports untyped constants' format to their respective type. types2
and go/types
together with the go/constant
package don't require a constant representation to match the (untyped) constant type. For instance, it's ok to represent real(0)
of type untyped float
with a constant of kind constant.Int
.
Should remove this restriction from the export format as it may cause loss of precision and also lead to larger than necessary export data. This will require an extra byte for each exported constant, encoding the respective constant kind. This will also require a bump of the export data version.
Marking for go1.18 since we are changing the export format anyway (generics). But it's not crucial to get this in.
See #43891 for details.