Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support alert for class methods #13109

Open
samwgoldman opened this issue Apr 22, 2024 · 0 comments
Open

Support alert for class methods #13109

samwgoldman opened this issue Apr 22, 2024 · 0 comments

Comments

@samwgoldman
Copy link
Contributor

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

 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 ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant