瀏覽代碼

Add test for #6066 (#11936)

Rudy Ges 6 月之前
父節點
當前提交
24daf4cd48
共有 2 個文件被更改,包括 13 次插入0 次删除
  1. 12 0
      tests/misc/projects/Issue6066/Main.hx
  2. 1 0
      tests/misc/projects/Issue6066/compile.hxml

+ 12 - 0
tests/misc/projects/Issue6066/Main.hx

@@ -0,0 +1,12 @@
+typedef S = {a:Int, ?b:Int};
+
+class Main {
+    static function f1(a:S):Void {}
+    static function f2<T:S>(a:T):Void {}
+
+    static function main() {
+        f1({a: 1}); // works
+        f2({a: 1}); // Constraint check failure: { a : Int } should be { ?b : Null<Int>, a : Int }
+        f2(({a: 1} : S)); // works
+    }
+}

+ 1 - 0
tests/misc/projects/Issue6066/compile.hxml

@@ -0,0 +1 @@
+-main Main