compiler: permit expressions of abstract bool to remain abstract
Test case is https://go.dev/cl/414755.
Fixes golang/go#51475
Change-Id: Ib4a066c370440339d28a5bb5180a1f032e4fb4f7
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/414735
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
diff --git a/go/expressions.cc b/go/expressions.cc
index f59f61d..aadca97 100644
--- a/go/expressions.cc
+++ b/go/expressions.cc
@@ -6829,11 +6829,12 @@
{
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;