perf: macro_inline ctorIdx for single constructor inductives (#11379)
This PR sets `@[macro_inline]` on the (trivial) `.ctorIdx` for inductive types with one constructor, to reduce the number of symbols generated by the compiler.
This commit is contained in:
parent
3772bb8685
commit
9ce8a062ba
1 changed files with 6 additions and 2 deletions
|
|
@ -71,16 +71,20 @@ public def mkCtorIdx (indName : Name) : MetaM Unit :=
|
|||
value := mkApp value alt
|
||||
pure value
|
||||
mkLambdaFVars (xs.push x) value
|
||||
addAndCompile (.defnDecl (← mkDefinitionValInferringUnsafe
|
||||
let decl := .defnDecl (← mkDefinitionValInferringUnsafe
|
||||
(name := declName)
|
||||
(levelParams := info.levelParams)
|
||||
(type := declType)
|
||||
(value := declValue)
|
||||
(hints := ReducibilityHints.abbrev)
|
||||
))
|
||||
)
|
||||
addDecl decl
|
||||
modifyEnv fun env => addToCompletionBlackList env declName
|
||||
modifyEnv fun env => addProtected env declName
|
||||
setReducibleAttribute declName
|
||||
if info.numCtors = 1 then
|
||||
setInlineAttribute declName .macroInline
|
||||
compileDecl decl
|
||||
|
||||
-- Deprecated alias for enumeration types (which used to have `toCtorIdx`)
|
||||
if (← isEnumType indName) then
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue