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

feat: add @[inheritDoc] attribute #1480

Merged
merged 1 commit into from
Aug 17, 2022
Merged

Conversation

digama0
Copy link
Collaborator

@digama0 digama0 commented Aug 14, 2022

This attribute allows you to specify another declaration to copy the docstring for the given declaration from. Example:

/-- Foo doc string -/ def foo := 1
@[inheritDoc foo] def bar := 1

This will give bar the same docstring as foo. It does not otherwise link the two declarations, but users that arrive at bar can click on the foo identifier to jump to the other declaration.

For infix and notation declarations, it is also possible to omit the identifier, in which case it will use the declaration the notation unfolds to. For example:

@[inheritDoc] infix:65 " >+< " => Nat.add

This gives the >+< syntax the same docstring as Nat.add.

@[inheritDoc] is also integrated into the missingDocs linter, which will not lint on declarations which have @[inheritDoc] but no documentation.

@leodemoura leodemoura merged commit e0221db into leanprover:master Aug 17, 2022
@digama0 digama0 deleted the inherit_doc branch August 17, 2022 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants