Skip to content

Commit

Permalink
chore: lake: tweak hovers for family_def et al
Browse files Browse the repository at this point in the history
  • Loading branch information
digama0 committed May 7, 2024
1 parent 883a3e7 commit 9f63162
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/lake/Lake/Build/Data.lean
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ scoped macro (name := libraryDataDecl) doc?:optional(Parser.Command.docComment)
"library_data " id:ident " : " ty:term : command => do
let dty := mkCIdentFrom (← getRef) ``TargetData
let key := Name.quoteFrom id id.getId
let id := mkIdentFrom id <| id.getId.modifyBase (`leanLib ++ ·)
let id := mkIdentFrom id (canonical := true) <| id.getId.modifyBase (`leanLib ++ ·)
`($[$doc?]? family_def $id : $dty (`leanLib ++ $key) := $ty)

/-- Macro for declaring new `TargetData`. -/
Expand Down
2 changes: 1 addition & 1 deletion src/lake/Lake/Util/Family.lean
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ scoped macro (name := familyDef) doc?:optional(Parser.Command.docComment)
let tid := extractMacroScopes fam.getId |>.name
if let (tid, _) :: _ ← Macro.resolveGlobalName tid then
let app := Syntax.mkApp fam #[key]
let axm := mkIdentFrom fam <| `_root_ ++ tid ++ id.getId
let axm := mkIdentFrom id (canonical := true) <| `_root_ ++ tid ++ id.getId
`($[$doc?]? @[simp] axiom $axm : $app = $ty
instance : FamilyDef $fam $key $ty := ⟨$axm⟩)
else
Expand Down
6 changes: 2 additions & 4 deletions src/lake/Lake/Util/Name.lean
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,5 @@ instance : LawfulCmpEq Name Name.quickCmp where

open Syntax

def quoteFrom (ref : Syntax) : Name → Term
| .anonymous => mkCIdentFrom ref ``anonymous
| .str p s => mkApp (mkCIdentFrom ref ``mkStr) #[quoteFrom ref p, quote s]
| .num p v => mkApp (mkCIdentFrom ref ``mkNum) #[quoteFrom ref p, quote v]
def quoteFrom (ref : Syntax) (n : Name) : Term :=
⟨copyHeadTailInfoFrom (quote n : Term) ref⟩

0 comments on commit 9f63162

Please sign in to comment.