@@ -10,6 +10,7 @@
cs/java : fixed rest arguments for cases when only one argument is provided (#10315)
php : fixed type of `php.db.PDO.ATTR_DRIVER_NAME` (#10319)
eval : fixed signature of `eval.luv.Tcp.noDelay` method
+ lua : fixed `string.length` when `string` has type of a type parameter constrained to `String` (#10343)
2021-07-01 4.2.3:
@@ -273,6 +273,7 @@ let mk_mr_select com e ecall name =
(* from genphp *)
let rec is_string_type t =
match follow t with
+ | TInst ({cl_kind = KTypeParameter constraints}, _) -> List.exists is_string_type constraints
| TInst ({cl_path = ([], "String")}, _) -> true
| TAnon a ->
(match !(a.a_status) with
@@ -0,0 +1,13 @@
+package unit.issues;
+
+class Issue10343 extends Test {
+ function test() {
+ final str = "hello";
+ eq(str.length, foo(str));
+ }
+ @:pure(false)
+ public function foo<T:String>(str:T):Int {
+ return str.length;
+}