chore: naming convention and cleanup
This commit is contained in:
parent
bcfc927799
commit
56320cb84f
2 changed files with 10 additions and 11 deletions
|
|
@ -622,11 +622,11 @@ def delabProjectionApp : Delab := whenPPOption getPPStructureProjections $ do
|
|||
guard $ !info.fromClass
|
||||
-- projection function should be fully applied (#struct params + 1 instance parameter)
|
||||
-- TODO: support over-application
|
||||
guard $ e.getAppNumArgs == info.nparams + 1
|
||||
guard $ e.getAppNumArgs == info.numParams + 1
|
||||
-- If pp.explicit is true, and the structure has parameters, we should not
|
||||
-- use field notation because we will not be able to see the parameters.
|
||||
let expl ← getPPOption getPPExplicit
|
||||
guard $ !expl || info.nparams == 0
|
||||
guard $ !expl || info.numParams == 0
|
||||
let appStx ← withAppArg delab
|
||||
`($(appStx).$(mkIdent f):ident)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,24 +11,23 @@ namespace Lean
|
|||
for each field. This structure caches information about these auxiliary definitions. -/
|
||||
structure ProjectionFunctionInfo where
|
||||
ctorName : Name -- Constructor associated with the auxiliary projection function.
|
||||
nparams : Nat -- Number of parameters in the structure
|
||||
numParams : Nat -- Number of parameters in the structure
|
||||
i : Nat -- The field index associated with the auxiliary projection function.
|
||||
fromClass : Bool -- `true` if the structure is a class
|
||||
deriving Inhabited
|
||||
|
||||
@[export lean_mk_projection_info]
|
||||
def mkProjectionInfoEx (ctorName : Name) (nparams : Nat) (i : Nat) (fromClass : Bool) : ProjectionFunctionInfo :=
|
||||
{ctorName := ctorName, nparams := nparams, i := i, fromClass := fromClass }
|
||||
def mkProjectionInfoEx (ctorName : Name) (numParams : Nat) (i : Nat) (fromClass : Bool) : ProjectionFunctionInfo :=
|
||||
{ ctorName, numParams, i, fromClass }
|
||||
@[export lean_projection_info_from_class]
|
||||
def ProjectionFunctionInfo.fromClassEx (info : ProjectionFunctionInfo) : Bool := info.fromClass
|
||||
|
||||
instance : Inhabited ProjectionFunctionInfo :=
|
||||
⟨{ ctorName := arbitrary, nparams := arbitrary, i := 0, fromClass := false }⟩
|
||||
def ProjectionFunctionInfo.fromClassEx (info : ProjectionFunctionInfo) : Bool :=
|
||||
info.fromClass
|
||||
|
||||
builtin_initialize projectionFnInfoExt : MapDeclarationExtension ProjectionFunctionInfo ← mkMapDeclarationExtension `projinfo
|
||||
|
||||
@[export lean_add_projection_info]
|
||||
def addProjectionFnInfo (env : Environment) (projName : Name) (ctorName : Name) (nparams : Nat) (i : Nat) (fromClass : Bool) : Environment :=
|
||||
projectionFnInfoExt.insert env projName { ctorName := ctorName, nparams := nparams, i := i, fromClass := fromClass }
|
||||
def addProjectionFnInfo (env : Environment) (projName : Name) (ctorName : Name) (numParams : Nat) (i : Nat) (fromClass : Bool) : Environment :=
|
||||
projectionFnInfoExt.insert env projName { ctorName, numParams, i, fromClass }
|
||||
|
||||
namespace Environment
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue