Skip to content

Warning if a function call is missing parenthesis #58281

@kinex

Description

@kinex

I wrote by accident a function call without the parenthesis at the end. I even copy/pasted this code to several places before I noticed it in my final code review. I would have expected to get a warning about this.

Example:

void foo() {
}

void foo2(int i) {
}


void main() {
  foo; // Warning should be shown for this line for an invalid function call
  foo();
  foo2; // Also this should give a warning
}

I know that a function reference is needed in some situations (like when passing a function as a parameter), but in the example above the situation is clear (only a function call makes sense).

Dart SDK version: 2.10.4 (stable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions