You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
It compiled and generated code in all three languages. However, all three threw errors when I tried to use the code:
$ python wrongReturn.py
Traceback (most recent call last):
File "wrongReturn.py", line 40, in <module>
main()
File "wrongReturn.py", line 11, in main
(length2).value = (conversion).Convert(length1, length2)
File "/Users/janicekarin/quark-examples/python/convert/__init__.py", line 47, in Convert
(input).conversionFactor = (self.relativeLengths).get((input).label)
AttributeError: 'int' object has no attribute 'get'
$ node wrongReturn.js
/Users/janicekarin/quark-examples/javascript/node_modules/quark_runtime.js:31
if (m.has(key)) {
^
TypeError: undefined is not a function
at Object.map_get (/Users/janicekarin/quark-examples/javascript/node_modules/quark_runtime.js:31:15)
at Conversion_Convert [as Convert] (/Users/janicekarin/quark-examples/javascript/convert/index.js:63:45)
at main (/Users/janicekarin/quark-examples/javascript/wrongReturn.js:10:36)
at Object.<anonymous> (/Users/janicekarin/quark-examples/javascript/wrongReturn.js:39:1)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
$ javac Functions.java
Functions.java:4: error: incompatible types: int cannot be converted to Double
convert.Unit length2 = new convert.Unit("length", "foot", 0);
^
./convert/Unit.java:8: error: incompatible types: int cannot be converted to Double
public Double value = (Double) (0);
^
./convert/Unit.java:9: error: incompatible types: int cannot be converted to Double
public Double conversionFactor = (Double) (0);
^
./convert/Conversion.java:15: error: incompatible types: int cannot be converted to Double
return (Double) (-(123456789));
^
./convert/Conversion.java:18: error: incompatible types: int cannot be converted to Double
return (Double) (-(987654321));
^
./convert/ConversionFactors.java:4: error: incompatible types: int cannot be converted to Double
public Double foo = (Double) (1);
^
./convert/ConversionFactors.java:7: error: no suitable method found for put(String,int)
(lengthFactors).put(("meter"), (1));
^
method Map.put(String,Double) is not applicable
(argument mismatch; int cannot be converted to Double)
method AbstractMap.put(String,Double) is not applicable
(argument mismatch; int cannot be converted to Double)
method HashMap.put(String,Double) is not applicable
(argument mismatch; int cannot be converted to Double)
./convert/ConversionFactors.java:8: error: no suitable method found for put(String,int)
(lengthFactors).put(("centimeter"), (100));
^
method Map.put(String,Double) is not applicable
(argument mismatch; int cannot be converted to Double)
method AbstractMap.put(String,Double) is not applicable
(argument mismatch; int cannot be converted to Double)
method HashMap.put(String,Double) is not applicable
(argument mismatch; int cannot be converted to Double)
./convert/ConversionFactors.java:13: error: incompatible types: Double cannot be converted to HashMap<String,Double>
return (java.util.HashMap<String,Double>) (foo);
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
9 errors
The text was updated successfully, but these errors were encountered:
Quark lets me return a value of the wrong type. However, the generated code complains in all three languages.
For example, I compiled this class:
It compiled and generated code in all three languages. However, all three threw errors when I tried to use the code:
The text was updated successfully, but these errors were encountered: