Skip to content

Assignment of constant values should not generate conversion calls #20

Description

@bdunderscore

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"

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions