method function_expression_or_method loc (stmt : ('loc, 'loc) Ast.Function.t) =
this#function_ loc stmt
[@@alert deprecated "Use either function_expression or class_method"]
The warning seems legitimate -- the warning is indeed unused. It appears that we can attach the alert to a class definition, but not to its methods. It's easy enough to remove the alert in this case, but would it be possible to actually support alerts in this position?
For example:
class c = object
method m () = () [@@alert deprecated "foo"]
end
let () = new c#m ()
While testing OCaml 5.2 on the Flow codebase, the new unused attribute warning triggered on this code:
https://github.com/facebook/flow/blob/f77ee9d1e4bb18bae47c6e9500a0807fa000f0bb/src/parser/flow_ast_mapper.ml#L1931-L1933
The warning seems legitimate -- the warning is indeed unused. It appears that we can attach the alert to a class definition, but not to its methods. It's easy enough to remove the alert in this case, but would it be possible to actually support alerts in this position?
For example: