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

Add %deprecate pragma #2086

Merged
merged 20 commits into from Nov 17, 2021
Merged

Add %deprecate pragma #2086

merged 20 commits into from Nov 17, 2021

Conversation

mattpolzin
Copy link
Collaborator

@mattpolzin mattpolzin commented Nov 2, 2021

Add the %deprecate pragma as proposed here.

Closes #2082.

In short, add %deprecate before a definition to cause the compiler to generate a warning whenever the given function is applied. Modify or add code documentation (||| docs) for the definition to give any additional suggestions you want printed along with the warning.

  • Adds %deprecate pragma and associated warning.
  • Updates CHANGELOG
  • Adds beginnings of a "pragmas" page in the reference documentation.

@mattpolzin mattpolzin marked this pull request as ready for review November 4, 2021 15:08
Copy link
Member

@gallais gallais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the fact checkDeprecation is called from CompileExpr mean that we get away with
using deprecated functions in values that have a 0 quantity and are not compiled?
Should this be checked during variable lookup in TTImp.Elab.App instead?

@mattpolzin
Copy link
Collaborator Author

Does the fact checkDeprecation is called from CompileExpr mean that we get away with

using deprecated functions in values that have a 0 quantity and are not compiled?

Not sure, I'll try that and see.

Should this be checked during variable lookup in TTImp.Elab.App instead?

Quite possibly. Thanks for the idea. Where to check this was roughly a guess on my part so I only know that it works for the cases I tested but not that it's the best place to put it.

@mattpolzin
Copy link
Collaborator Author

Much better results; in broad strokes moving to Elab.App was the prefect plan, but let me know if the way I surfaced it there seems reasonable to you!

src/TTImp/Elab/App.idr Outdated Show resolved Hide resolved
@gallais gallais merged commit 0eba4c6 into idris-lang:main Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Proposal] A new %deprecate pragma
3 participants