diff options
author | Cole Faust <colefaust@google.com> | 2024-03-27 16:39:07 -0700 |
---|---|---|
committer | Cole Faust <colefaust@google.com> | 2024-03-27 16:39:07 -0700 |
commit | 46cf6764fdce3471f0ff44b8959e0e975d7838ac (patch) | |
tree | af94b271a4c7c889b95f719834da97662cc1b8fd | |
parent | 02790f32c9a4c7f3337a2aea08bfbfc493fbeaa8 (diff) | |
download | blueprint-46cf6764fdce3471f0ff44b8959e0e975d7838ac.tar.gz |
OR booleans together when appending configurables
This is to match how (non-pointer) booleans work in AppendProperties().
Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I16791fc5ac684eedf8064a65953b8b68f18c37c1
-rw-r--r-- | proptools/configurable.go | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/proptools/configurable.go b/proptools/configurable.go index 46c98fd..416614c 100644 --- a/proptools/configurable.go +++ b/proptools/configurable.go @@ -173,22 +173,16 @@ func mergeConfiguredValues[T ConfigurableElements](a, b *T, propertyName string, result := a + b return any(&result).(*T) case *bool: - numNonNil := 0 - var nonNil *T + // Addition of bools will OR them together. This is inherited behavior + // from how proptools.ExtendBasicType works with non-configurable bools. + result := false if a != nil { - numNonNil += 1 - nonNil = a + result = result || *any(a).(*bool) } if b != nil { - numNonNil += 1 - nonNil = b - } - if numNonNil == 1 { - return nonNil - } else { - evalutor.PropertyErrorf(propertyName, "Cannot append bools") - return nil + result = result || *any(b).(*bool) } + return any(&result).(*T) default: panic("Should be unreachable") } |