Confusing error message when a void
value is used
#56992
Labels
area-meta
Cross-cutting, high-level issues (for tracking many other implementation issues, ...).
improve-diagnostics
Related to the quality of diagnostic messages
The code above produces an error in both analyzer and VM. Analyzer error message is
A value of type 'void' can't be returned from the function 'foo' because it has a return type of 'FutureOr<void>'
and VM error isError: A value of type 'void' can't be returned from a function with return type 'FutureOr<void>'.
This error message is confusing.
void
is assignable toFutureOr<void>
, the problem here is that avoid
value returned byprint()
is used. Please update the error message accordingly.cc @eernstg
Dart SDK version: 3.7.0-71.0.dev (dev) (Fri Oct 25 17:06:43 2024 -0700) on "windows_x64"
The text was updated successfully, but these errors were encountered: