Skip to content

Why can't we declare a top-level delegate returning a value-tuple? #7054

Closed Answered by bernd5
Odepax asked this question in Q&A
Discussion options

You must be logged in to vote

It seems to be a roslyn bug.

delegate (int, int) I(int x);

it is parsed as anonymous method expression with some missing parts.
See: https://roslynquoter.azurewebsites.net/

CompilationUnit()
.WithMembers(
    List<MemberDeclarationSyntax>(
        new MemberDeclarationSyntax[]{
            GlobalStatement(
                ExpressionStatement(
                    AnonymousMethodExpression()
                    .WithParameterList(
                        ParameterList(
                            SeparatedList<ParameterSyntax>(
                                new SyntaxNodeOrToken[]{
                                    Parameter(
                                        MissingToken(SyntaxKind.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@bernd5
Comment options

@Odepax
Comment options

Answer selected by 333fred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants