You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2019/01/29 17:28:49 UTC

[GitHub] joshtynjala commented on issue #74: Assign to int or uint variable does not convert Number from floating point to integer

joshtynjala commented on issue #74: Assign to int or uint variable does not convert Number from floating point to integer
URL: https://github.com/apache/royale-compiler/issues/74#issuecomment-458631050
 
 
   > It looks like the compiler has a bug. It adds the Language.string call even when using an as cast in a ternary expression.
   
   I updated your fix in Language.string() to add parentheses around the whole expression, and that allows the ternary operator to remain.
   
   I also did some tests, and if both results of the ternary operator are strings, the compiler correctly understands that it can be assigned to a string without coercsion. If one of them is another type (even null), the compiler treats it as type * instead. That's why the whole expression needs to be wrapped.
   
   I could have it crawl into the sub-expressions of the ternary operator, but I'd have to keep checking for more ternary operators (and possibly some other operators) and potentially go any number of levels deep, which isn't ideal.
   
   Regardless, this is the only place where it truly matters, since a stack overflow cannot be triggered anywhere else. I believe that this workaround is the correct solution.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services