Closed Simn closed 5 years ago
I think we just have to accept the first situation. I can't think of a sane way to deal with this.
Given that this is only a problem if externs are inaccurate and that there's no reason for inaccurate externs other than the Math API, hardcoding this seems fair.
Math.floor is a good example:
For the first one, the result has to be cast to
Int
. We cannot detect this at compile-time in the general case, so the dynamic resolution has to deal with this. This may be a good use-case for annotations.In the second one we have to patch the signature at compile-time, but still make sure the result is cast back to
Int
. This is hardcoded in genjava, but I would like look into having a more flexible solution (metadata?).