UdonSharp
UdonSharp copied to clipboard
Assignment of constant values should not generate conversion calls
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"