dart-archive / kernel

Dart IR (Intermediate Representation) -- moved to dart-lang/sdk
BSD 3-Clause "New" or "Revised" License
20 stars 3 forks source link

Calls to a constructor with mismatched arguments should not be in the IR #18

Closed mkustermann closed 8 years ago

mkustermann commented 8 years ago

This example:

class C {
   C(x,[y=2]) {}
}

main() {
  Expect.throws(() => new C(1,2,3), (e) => e is NoSuchMethodError);
}

gets translated to

class C extends core::Object {
    constructor •(dynamic x, [dynamic y = 2]) → void {}
  }
  static method main() → dynamic {
    Exp::Expect::throws(() → dynamic => new test::C::•(1, 2, 3), (dynamic e) → dynamic => e is core::NoSuchMethodError);
  }

The new C(1, 2, 3) has mismatched number of arguments and should therefore be translated to an invalid expression.

asgerf commented 8 years ago

Should be fixed in 0d9ab9099c35b93c92951885f83a6f596c574312