Skip to content
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

Cast from nuint to nint is missing when neg is used #2407

Closed
yyjdelete opened this issue May 11, 2021 · 0 comments
Closed

Cast from nuint to nint is missing when neg is used #2407

yyjdelete opened this issue May 11, 2021 · 0 comments
Labels
Bug Decompiler The decompiler engine itself

Comments

@yyjdelete
Copy link
Contributor

Input code

public class C {
    public nint Test(nuint x) => -(nint)x;// or `(nint)(0-x)` as the decompile result for cast from uint to int
}

Erroneous output

error CS0023: Operator '-' cannot be applied to operand of type 'nuint'

public class C
{
    public nint Test(nuint x)
    {
        return -x;
    }
}

Details

  • Product in use: ILSpy
  • Version in use: 7.0.0
@yyjdelete yyjdelete added Bug Decompiler The decompiler engine itself labels May 11, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2021
ElektroKill added a commit to dnSpyEx/ILSpy that referenced this issue Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Decompiler The decompiler engine itself
Projects
None yet
Development

No branches or pull requests

1 participant