Main.hx 321 B

123456789101112
  1. typedef S = {a:Int, ?b:Int};
  2. class Main {
  3. static function f1(a:S):Void {}
  4. static function f2<T:S>(a:T):Void {}
  5. static function main() {
  6. f1({a: 1}); // works
  7. f2({a: 1}); // Constraint check failure: { a : Int } should be { ?b : Null<Int>, a : Int }
  8. f2(({a: 1} : S)); // works
  9. }
  10. }