-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GR-54995] Should '0' should not be able to map to int? type coercion #9096
Labels
Comments
I will probably use this workaround (
|
fernando-valdez
changed the title
Should '0' should not be able to map to int? type coercion
[GR-54995] Should '0' should not be able to map to int? type coercion
Jun 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe GraalVM and your environment :
java -Xinternalversion
:Have you verified this issue still happens when using the latest snapshot?
You can find snapshot builds here: https://github.com/graalvm/graalvm-ce-dev-builds/releases
No, but I have looked at the code and it's the same:
https://github.com/oracle/graal/blob/master/truffle/src/com.oracle.truffle.host/src/com/oracle/truffle/host/HostUtil.java#L141
Describe the issue
Rhino can "cast" to int, while Graal / Truffel does not, see code below.
Get ClassCastException with
Cannot convert 'com.oracle.truffle.api.strings.TruffleString'(language: Java, type: com.oracle.truffle.api.strings.TruffleString) to Java type 'int': Invalid or lossy primitive coercion.
Code snippet or code repository that reproduces the issue
Steps to reproduce the issue
Run the above test.
Expected behavior
I would assume that Truffle would cast that (as long as it's compliant?).
Caller is com.oracle.truffle.host.HostToTypeNode.convertImpl()
Maybe https://github.com/oracle/graal/blob/master/truffle/src/com.oracle.truffle.host/src/com/oracle/truffle/host/HostUtil.java#L141 should support other target types (such as int?).
Additional context
Add any other context about the problem here. Specially important are stack traces or log output. Feel free to link to gists or to screenshots if necesary
Details
The text was updated successfully, but these errors were encountered: