Explorar o código

call abstract toString only if it actually exists

Simon Krajewski %!s(int64=12) %!d(string=hai) anos
pai
achega
06d9e0530f
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      typer.ml

+ 1 - 1
typer.ml

@@ -3132,7 +3132,7 @@ and type_expr ctx (e,p) (with_type:with_type) =
 		let e = match m with
 			| (Meta.ToString,_,_) ->
 				(match follow e.etype with
-					| TAbstract({a_impl = Some c},_) -> call_to_string ctx c e
+					| TAbstract({a_impl = Some c},_) when PMap.mem "toString" c.cl_statics -> call_to_string ctx c e
 					| _ -> e)
 			| _ -> e
 		in