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
This commit is contained in:
parent
02790f32c9
commit
46cf6764fd
1 changed files with 6 additions and 12 deletions
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue