Commit e4f339e
committed
Fix false self-referential mixin when bare name matches ancestor namespace
When a module like `A::Enumerable` contains `include Enumerable`, YARD's
lexical resolver would walk up to parent namespace `A` and find `A::Enumerable`
as the match for the bare name `Enumerable`. This caused the module to be
recorded as including itself, producing incorrect documentation and potential
infinite recursion in `inheritance_tree`.
Fix: in `RegistryResolver#lookup_by_path`, skip a direct-lookup result that
resolves back to the original starting namespace when the search has already
moved to a parent namespace. This prevents circular resolution while leaving
all other lookups (including from root) unaffected.
Fixes #1116 (the valid-Ruby case from
#1116 (comment))1 parent 1e6d517 commit e4f339e
3 files changed
Lines changed: 28 additions & 0 deletions
File tree
- lib/yard
- spec/handlers
- examples
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
48 | 62 | | |
49 | 63 | | |
50 | 64 | | |
| |||
0 commit comments