compiler: permit expressions of abstract bool to remain abstract

Test case is https://go.dev/cl/414755.

Fixes golang/go#51475

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414735
This commit is contained in:
Ian Lance Taylor 2022-06-27 22:17:51 -07:00
parent 5745301983
commit ed06274eac
2 changed files with 6 additions and 5 deletions

View file

@ -1,4 +1,4 @@
927528cdc112fc51e0d07ee79e7a1254b586eabe
28fe9fad4acb4e02083faf5503b06e3e6e8eecaf
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.

View file

@ -6829,11 +6829,12 @@ Binary_expression::do_determine_type(const Type_context* context)
{
if ((tleft->integer_type() != NULL && tright->integer_type() != NULL)
|| (tleft->float_type() != NULL && tright->float_type() != NULL)
|| (tleft->complex_type() != NULL && tright->complex_type() != NULL))
|| (tleft->complex_type() != NULL && tright->complex_type() != NULL)
|| (tleft->is_boolean_type() && tright->is_boolean_type()))
{
// Both sides have an abstract integer, abstract float, or
// abstract complex type. Just let CONTEXT determine
// whether they may remain abstract or not.
// Both sides have an abstract integer, abstract float,
// abstract complex, or abstract boolean type. Just let
// CONTEXT determine whether they may remain abstract or not.
}
else if (tleft->complex_type() != NULL)
subcontext.type = tleft;