Skip to content

Void arguments are allowed in dynamic invocations by the Analyzer #61479

@chloestefantsova

Description

@chloestefantsova

Note: this issue is a reformulation of flutter/flutter#161479 for the Dart SDK repo.

Consider the following program:

abstract class A {
  Function get fooFunction;
  dynamic get fooDynamic;
  void fooRegular(Object? arg);
  Never get fooNever;

  void bar() {}

  test() {
    fooFunction(bar());
    fooDynamic(bar());
    fooRegular(bar());
    fooNever(bar());
  }
}

All of the invocations in test should be reported in a compile-time error (see the discussion here). However, the Analyzer only reports the error for fooRegular and doesn't report it for fooFunction, fooDynamic, or fooNever (the latter may not be a strict requirement, however, since the actual invocation will never happen in practice).

Metadata

Metadata

Labels

area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions