Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Default values are not checked against type declarations #14

Closed
janicedatawire opened this issue Oct 9, 2015 · 1 comment
Closed

Default values are not checked against type declarations #14

janicedatawire opened this issue Oct 9, 2015 · 1 comment

Comments

@janicedatawire
Copy link
Contributor

I was able to compile the following without complaint:

    class Foot extends Unit {
       String type=1;
       String system="English";
       float baseValue="3.2808399";
    }

I expected complaints that 1 is not a string and "3.2808399" is not a float. Instead, I get complaints from the Java compiler:

javac Functions.java
./convert/Foot.java:4: error: incompatible types: int cannot be converted to String
    public String type = (String) (1);
                                  ^
./convert/Foot.java:6: error: incompatible types: String cannot be converted to float
    public float baseValue = (float) ("3.2808399");
                                     ^
2 errors

The Python and Javascript work as is and return the same results as if I had supplied a float for Foot.baseValue.

@bozzzzo
Copy link
Contributor

bozzzzo commented Jul 21, 2016

Fixed in recent quark

@bozzzzo bozzzzo closed this as completed Jul 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants