Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Assignment of constant values should not generate conversion calls #20

Open
bdunderscore opened this issue Apr 27, 2020 · 0 comments
Open
Labels
bug Something isn't working
Milestone

Comments

@bdunderscore
Copy link
Collaborator

Describe the bug in detail:
When assigning a variable from a constant, in some cases a runtime conversion is generated, instead of simply ensuring the constant is the correct type.

Provide steps/code to reproduce the bug:

uint[] x = new int[1];
x[0] = 0;

Expected behavior:
What was the excepted result?

A single array set instruction should be generated. However, in fact, a conversion is generated first:

         # x[0] = 0;
        PUSH, __1_const_intnl_SystemInt32
        PUSH, __0_intnl_SystemUInt32
        EXTERN, "SystemConvert.__ToUInt32__SystemInt32__SystemUInt32"
        PUSH, __0_x_UInt32Array
        PUSH, __1_const_intnl_SystemInt32
        PUSH, __0_intnl_SystemUInt32
        EXTERN, "SystemUInt32Array.__Set__SystemInt32_SystemUInt32__SystemVoid"
@bdunderscore bdunderscore added the bug Something isn't working label Apr 27, 2020
bdunderscore added a commit to bdunderscore/UdonSharp that referenced this issue Apr 27, 2020
bdunderscore added a commit to bdunderscore/UdonSharp that referenced this issue May 10, 2020
@MerlinVR MerlinVR added this to the UdonSharp 1.0 milestone Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants