False positive for unnecessary_parenthesis
#4871
Labels
false-positive
P2
A bug or feature request we're likely to work on
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
Describe the issue
Given a class with a non-nullable field, and a constructor with a nullable equivalent, and without a default value (because the wanted default would be non-
const
), an initialiser list with a default is required to prevent an error.However, if this relies around a function callback, such as type
void Function()
, defining a default function with the arrow syntax is impossible without producing either an error or a lint warning.To Reproduce
Expected behavior
Unnecessary parenthesis lint should not be thrown, as the brackets are necessary.
Additional context
The suggested fix that removes the brackets causes the issue shown in image 2 & 3.
The text was updated successfully, but these errors were encountered: