-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Labels
hardAn issue that requires lots of tricky design and implementation.An issue that requires lots of tricky design and implementation.
Description
What happened?
Unit compatibility is inconsistent:
*1 + 1s Accepted, but incorrect.
1s + 1Correctly not accepted.1 · 1mCorrectly accepted.
Anything else?
The root cause of this is is that + function on a number expects its right operand to be of the same type as the left operand. This is expressed as a UnitDeriver, which defines the expected type of the right operand as the left. That's why the second example above works.
But there is no corresponding constraint in the other direction, where the right must accept the left type. Moreover, unitless numbers are defined to accept numbers with units.
Overall, the implementation of the unit type checking is mostly right, but wrong in particular cases like this, and needs to be revised to account for the first case above.
What browsers are you seeing the problem on?
Chrome
What operating system are you using?
macOS
Metadata
Metadata
Assignees
Labels
hardAn issue that requires lots of tricky design and implementation.An issue that requires lots of tricky design and implementation.