biddyweb / checker-framework

Automatically exported from code.google.com/p/checker-framework
Other
0 stars 1 forks source link

Unit Calculations #426

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. When multiplying a unit of seconds to a unit of meter per second, it does 
not produce a unit of meter.
2. When dividing a unit of meter by a unit of meter per second, it does not 
produce a unit of second.

What is the expected output? What do you see instead?
Expected: The expected units should be produced, and the compilation should 
pass without throwing any errors.
Current: The following two sets of code currently throws 
assignment.type.incompatible errors.

Set 1:
@mPERs double speedOfSound = (340.29 * UnitsTools.m) / (UnitsTools.s);
@s double tenSeconds = 10.0 *  UnitsTools.s;
@m double soundIn10Seconds = speedOfSound * tenSeconds;

Results in Compilation failure in the line with "soundIn10Seconds":
error: [assignment.type.incompatible] incompatible types in assignment.

Set 2:
@mPERs double speedOfSound = (340.29 * UnitsTools.m) / (UnitsTools.s); 
@m double length = 100.0 * UnitTools.m;
@s soundNeedTimeForLength = length / speedOfSound;

Results in Compilation failure in the line with "soundNeedTimeForLength":
error: [assignment.type.incompatible] incompatible types in assignment.

What version of the product are you using? On what operating system?
Development Build rev 9250, on Ubuntu 14.04

Please provide any additional information below.
Related discussion: 
https://groups.google.com/forum/#!searchin/checker-framework-discuss/Unit$20calc
ulations/checker-framework-discuss/EZ7LWkyPRzE/Zd77kJOwDWcJ

Original issue reported on code.google.com by jeffyuco...@gmail.com on 9 Apr 2015 at 9:37

GoogleCodeExporter commented 9 years ago
Jeff sent me a bundle with a fix for this issue. I will convert it into a 
rbcommons review later today.

Original comment by wdi...@gmail.com on 10 Apr 2015 at 5:55

GoogleCodeExporter commented 9 years ago

Original comment by wdi...@gmail.com on 15 Apr 2015 at 2:22

GoogleCodeExporter commented 9 years ago

Original comment by jtha...@cs.washington.edu on 18 Apr 2015 at 6:42