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

Colon at BaseConstructorInitializer wrong #65

Open
p-bojkowski opened this issue Apr 15, 2021 · 3 comments
Open

Colon at BaseConstructorInitializer wrong #65

p-bojkowski opened this issue Apr 15, 2021 · 3 comments

Comments

@p-bojkowski
Copy link

Hi!

RoslynQuoter generate for this:

public class CLASS_NAME : ClassTemplateBase
{
	public CLASS_NAME() : base()
	{

	}
}

Result:

CompilationUnit()
.WithMembers(
    SingletonList<MemberDeclarationSyntax>(
        ClassDeclaration("CLASS_NAME")
        .WithModifiers(
            TokenList(
                Token(SyntaxKind.PublicKeyword)))
        .WithBaseList(
            BaseList(
                SingletonSeparatedList<BaseTypeSyntax>(
                    SimpleBaseType(
                        IdentifierName("ClassTemplateBase")))))
        .WithMembers(
            SingletonList<MemberDeclarationSyntax>(
                ConstructorDeclaration(
                    Identifier("CLASS_NAME"))
                .WithModifiers(
                    TokenList(
                        Token(SyntaxKind.PublicKeyword)))
                .WithInitializer(
                    ConstructorInitializer(
                        SyntaxKind.BaseConstructorInitializer,
                        ArgumentList()))
                .WithBody(
                    Block())))))
.NormalizeWhitespace()

What result with this:

public class CLASS_NAME : ClassTemplateBase
{
	public CLASS_NAME(): base()
	{

	}
}

The position of the colon is wrong

CLASS_NAME(): base()

it should be:

CLASS_NAME() : base()

like in the class declaration.

@bernd5
Copy link
Contributor

bernd5 commented May 6, 2021

That is an issue in NormalizeWhitespace() - not in the quoter...
Please open an issue at dotnet/roslyn

@p-bojkowski
Copy link
Author

Done! dotnet/roslyn#53254

@KirillOsenkov
Copy link
Owner

This was fixed in Roslyn: dotnet/roslyn#53326

Leaving this bug open to track updating to a version of Roslyn that has that fix ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants