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

SyntaxGenerator crashes with 'checked' operators #63410

Closed
Youssef1313 opened this issue Aug 15, 2022 · 0 comments · Fixed by #63411
Closed

SyntaxGenerator crashes with 'checked' operators #63410

Youssef1313 opened this issue Aug 15, 2022 · 0 comments · Fixed by #63411
Labels
4 - In Review A fix for the issue is submitted for review. Area-IDE Bug
Milestone

Comments

@Youssef1313
Copy link
Member

on main branch, adding a test to SyntaxGeneratorTests.cs:

        [Fact]
        public void Test()
        {
            var comp = CSharpCompilation.Create(null, new[] { SyntaxFactory.ParseSyntaxTree("""
                public class C
                {
                    public static C operator checked ++(C x) => x;
                }
                """) });
            var operatorSymbol = (IMethodSymbol)comp.GetTypeByMetadataName("C").GetMembers(WellKnownMemberNames.CheckedIncrementOperatorName).Single();
            VerifySyntax<OperatorDeclarationSyntax>(Generator.OperatorDeclaration(operatorSymbol), "");
        }

crashes with

System.ArgumentException : Unknown operator kind.

  Stack Trace: 
    SyntaxGenerator.GetOperatorKind(IMethodSymbol method) line 256
    SyntaxGenerator.OperatorDeclaration(IMethodSymbol method, IEnumerable`1 statements) line 215
    SyntaxGeneratorTests.Test() line 3791
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 15, 2022
@jaredpar jaredpar added Bug and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 15, 2022
@jaredpar jaredpar added this to the C# 12.0 milestone Aug 15, 2022
@jcouv jcouv added Area-IDE 4 - In Review A fix for the issue is submitted for review. and removed Area-Compilers labels Nov 12, 2022
@jcouv jcouv modified the milestones: C# 12.0, 17.5 Nov 12, 2022
@arunchndr arunchndr modified the milestones: 17.5, Backlog Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - In Review A fix for the issue is submitted for review. Area-IDE Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants