Type calculation for implicit conversions in the physunit language was improved.
Implicit conversions can now be deactivated conditionally in the physunit language. You can for example, only activate them for binary operations, so that normal assignments like val length: number = 1 km still leads to errors
The noConvert expressions in the physunit language doesn't strip the unit anymore. Use the stripUnit expression for that.
I also have to fix the type calculation for div expressions since they contained unnecessary trailing zeros which leads to ugly number ranges with those implicit conversions. The changes for the type calculation were also done for the convertTo expression.
Implementation details: The reason why we need to widen the precision in the tagged expression is that the interpreter needs to work with BigDecimal and not BigInteger in our calculations and with this change we enforce floating point calculation. The previous real type was not necessary, changing the precision is enough. I also try to use the precision and range from the original expression if possible. The conversions itself can overwrite this, so we do this only for implicit generated conversions rule of prefixes.
noConvert
expressions in the physunit language doesn't strip the unit anymore. Use thestripUnit
expression for that.I also have to fix the type calculation for div expressions since they contained unnecessary trailing zeros which leads to ugly number ranges with those implicit conversions. The changes for the type calculation were also done for the
convertTo
expression.Implementation details: The reason why we need to widen the precision in the tagged expression is that the interpreter needs to work with BigDecimal and not BigInteger in our calculations and with this change we enforce floating point calculation. The previous real type was not necessary, changing the precision is enough. I also try to use the precision and range from the original expression if possible. The conversions itself can overwrite this, so we do this only for implicit generated conversions rule of prefixes.
Examples: