The current unit language org.iets3.core.expr.typetags.physunits (see documentation) should support combining operands which have proper units using binary expressions, like plus, minus, etc. However, this fails if one of the operands is not a NumberLiteral, but a reference to some variable or a function call, even if the variable or function has the proper type and unit.
Example: Given the following definitions:
Two literals can be combined, e.g. with a plus-expression (can be done also with other operators):
But this fails if one of the operands isn't a literal, although the type including the physical unit or quantity matches:
For function calls, the error looks even more weird:
If the binary operation is a multiplication, the computed type is wrong (it contains two tags, one of them null):
Expected: All these failing examples (and all similar ones) should work without any errors.