Skip to content

Fix for use_primary_constructors produces syntax error when there's no constructor #63482

@stereotype441

Description

@stereotype441

In a project that's using language version 3.13, if the use_primary_constructors lint is enabled, the lint fires for a class like this:

class C<T> {}

(Which is admittedly kind of silly, since there's no value to be added by converting to primary constructor syntax when there's no constructor present).

If you bring up the context menu and select "Convert the default constructor to a primary constructor", the code is changed to:

class C()<T> {}

This is incorrect. It should be:

class C<T>() {}

Not sure how high of a priority this is, because we (currently) don't have plans to heavily advertise this lint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-quick-fixIssues with analysis server (quick) fixes

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions