Skip to content

unnecessary_statements shouldn't trigger when the operator is overloaded #59188

Closed
@gaetschwartz

Description

Say you some code that overloads an operator:

class Logger {
	void operator<<(String message) {/*...*/}
}

void main() {
	final l = Logger();

	l << "Hello world (づ。◕‿‿◕。)づ"; 
	// Unnecessary statement.
	// Try completing the statement or breaking it up. (unnecessary_statements)
}

The lint trigger when it shouldn't as the statement has a clear effect here.

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestanalyzer-linterIssues with the analyzer's support for the linter packagearea-analyzerUse area-analyzer for Dart analyzer issues, including the analysis server and code completion.linter-false-positive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions