Need to fix NSM behavior with missing optional, named and type arguments

Our current behavior when an NSM forwarder is called with missing optional, named or type arguments is to preserve their absence in the Invocation object passed to noSuchMethod. However, the spec. says they should be filled in with their default values.

In this example:

class C {
  dynamic noSuchMethod(Invocation invoke) {
    print(invoke.positionalArguments);
    print(invoke.namedArguments);
    print(invoke.typeArguments);
  }

  void f1<T>();
  void f2([int x = 3]);
  void f3({int y = 3});
}

void main() {
  var c = new C();
  c.f1();
  c.f2();
  c.f3();
}

Our behavior currently is:

[]
{}
[]
[]
{}
[]
[]
{}
[]

Whereas it should be:

[]
{}
[dynamic]
[3]
{}
[]
[]
{Symbol("y"): 3}
[]

Author: Fantashit

1 thought on “Need to fix NSM behavior with missing optional, named and type arguments

Comments are closed.