Skip to content

Inconsistent runtime errors for implicit method invocations. #36420

Open
@Markzipan

Description

@Markzipan

The following test snippet passes (throws) in DDC/analyzer but doesn't emit an error in the VM:

import "expect.dart";
class C {
  void Function() call = () {};
}

main() {
  C c = new C();
  dynamic d = c;

  var lambda_okay = () => d.call(); 
  var lambda_error = () => d();
  lambda_okay();
  Expect.throws(lambda_error);
}

Ditto for when call is a getter. From what I could find, CFE doesn't provide the backends a way to disambiguate the two cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    legacy-area-front-endLegacy: Use area-dart-model instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions