fix: improved error span for inherit_doc (#1807)
This commit is contained in:
parent
cf35416f5b
commit
22cdac914d
1 changed files with 2 additions and 2 deletions
|
|
@ -16,12 +16,12 @@ builtin_initialize
|
|||
unless kind == AttributeKind.global do
|
||||
throwError "invalid `[inherit_doc]` attribute, must be global"
|
||||
match stx with
|
||||
| `(attr| inherit_doc $[$id?:ident]?) =>
|
||||
| `(attr| inherit_doc $[$id?:ident]?) => withRef stx[0] do
|
||||
let some id := id?
|
||||
| throwError "invalid `[inherit_doc]` attribute, could not infer doc source"
|
||||
let declName ← Elab.resolveGlobalConstNoOverloadWithInfo id
|
||||
if (← findDocString? (← getEnv) decl).isSome then
|
||||
logWarningAt id m!"{← mkConstWithLevelParams decl} already has a doc string"
|
||||
logWarning m!"{← mkConstWithLevelParams decl} already has a doc string"
|
||||
let some doc ← findDocString? (← getEnv) declName
|
||||
| logWarningAt id m!"{← mkConstWithLevelParams declName} does not have a doc string"
|
||||
addDocString decl doc
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue