Bogus warnings of `Expression result unused` in conditional statements

This code gives me two warnings in each of the code branches, both
NPL: Warning: W0009: Expression result unused

           paymentInformation = if (newPaymentInformation.vatNumber.isPresent() && newPaymentInformation.vatNumber.getOrFail().length() == 0) {
                newPaymentInformation.copy(vatNumber = optionalOf<Text>());
            } else {
                newPaymentInformation;
            }

This is obviously incorrect as the result of the both branches is used if the branch is active

From General to Noumena Protocol Language

Missing a bit the context. Where exactly do you get the warning? For which part and what is the surrounding code?

This is an assignment from an if, so the result of the if expression is being used, but it’s complaining that the results of the expressions in both branches are not being used, but they are, either one or the other provides the result of the if.