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 -> NormalizeWhitespace() #53254

Closed
p-bojkowski opened this issue May 7, 2021 · 1 comment · Fixed by #53326
Closed

Colon at BaseConstructorInitializer wrong -> NormalizeWhitespace() #53254

p-bojkowski opened this issue May 7, 2021 · 1 comment · Fixed by #53326
Milestone

Comments

@p-bojkowski
Copy link

Hi!

there is an issue in the NormalizeWhitespace() methode:

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.

@svick
Copy link
Contributor

svick commented May 7, 2021

This looks like a duplicate of #35371.

@jcouv jcouv added this to the 17.0 milestone May 18, 2021
@jcouv jcouv removed the untriaged Issues and PRs which have not yet been triaged by a lead label May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants