Repository navigation
Fix autodoc support for slot writers #69
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8d1ba93
fixed autodoc detection of slot reader/writers
ethanxxxl c0f97ba
Merge branch 'master' into fix/issue-66-slot-writer
svetlyak40wt 7a2c2ed
Add tests for slot writer autodoc
svetlyak40wt b54b3a7
Add reader and accessor locative tests
svetlyak40wt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| (uiop:define-package #:40ants-doc-test/autodoc | ||
| (:use #:cl) | ||
| (:import-from #:40ants-doc/autodoc | ||
| #:defautodoc) | ||
| (:import-from #:40ants-doc-full/locatives/slots) | ||
| (:import-from #:rove | ||
| #:deftest | ||
| #:ok | ||
| #:testing)) | ||
| (in-package #:40ants-doc-test/autodoc) | ||
|
|
||
|
|
||
| (defclass slot-reader-writer-class () | ||
| ((accessor-slot :accessor slot-accessor) | ||
| (reader-slot :reader slot-reader) | ||
| (writer-slot :writer slot-writer))) | ||
|
|
||
|
|
||
| (deftest test-autodoc-classifies-slot-readers-writers-and-accessors | ||
| (testing "A class with all slot interface kinds is classified correctly" | ||
| (ok (equal (40ants-doc/autodoc::class-readers | ||
| 'slot-reader-writer-class) | ||
| '(slot-accessor | ||
| slot-reader))) | ||
| (ok (equal (40ants-doc/autodoc::class-writers | ||
| 'slot-reader-writer-class) | ||
| '(slot-accessor | ||
| slot-writer))) | ||
| (ok (equal (40ants-doc/autodoc::class-accessors | ||
| 'slot-reader-writer-class) | ||
| '(slot-accessor))) | ||
| (let ((readers-and-writers | ||
| (40ants-doc/autodoc::class-readers-writers | ||
| 'slot-reader-writer-class))) | ||
| (ok (= 3 (length readers-and-writers))) | ||
| (ok (subsetp '(slot-accessor | ||
| slot-reader | ||
| slot-writer) | ||
| readers-and-writers))))) | ||
|
|
||
|
|
||
| (deftest test-writer-locative-finds-a-writer-symbol | ||
| (testing "A writer locative resolves a slot declared with :writer" | ||
| (ok (40ants-doc-full/locatives/slots::find-writer-slot-definition | ||
| 'slot-writer | ||
| 'slot-reader-writer-class)))) | ||
|
|
||
|
|
||
| (deftest test-reader-locative-finds-a-reader-symbol | ||
| (testing "A reader locative resolves a slot declared with :reader" | ||
| (ok (40ants-doc-full/locatives/slots::find-reader-slot-definition | ||
| 'slot-reader | ||
| 'slot-reader-writer-class)))) | ||
|
|
||
|
|
||
| (deftest test-accessor-locative-finds-an-accessor-symbol | ||
| (testing "An accessor locative resolves a slot declared with :accessor" | ||
| (ok (40ants-doc-full/locatives/slots::find-accessor-slot-definition | ||
| 'slot-accessor | ||
| 'slot-reader-writer-class)))) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a valid slot option such as
:writer (setf foo)is used without a reader, this normalization reduces the writer name tofoo, so autodoc emits(foo (writer class)); GitHub source-link generation subsequently reacheslocate-and-find-sourceinfull/locatives/slots.lisp, which callssymbol-functiononfooeven though only(setf foo)is fbound, causing documentation rendering to signalundefined-function(or inspect an unrelated ordinary function). Preserve enough writer identity, or have writer source resolution select the matching slot writer's actual fdefinition. The new test covers only the symbol-form writer and misses this supported function-name edge case.AGENTS.md reference: AGENTS.md:L37-L39
Useful? React with 👍 / 👎.