chore: remove mkInternalSubobjectFieldName hack

This commit is contained in:
Leonardo de Moura 2021-08-03 12:05:10 -07:00
parent 6e1620ca8d
commit 65aafc070c
2 changed files with 1 additions and 8 deletions

View file

@ -442,10 +442,7 @@ private def addCtorFields (fieldInfos : Array StructFieldInfo) : Nat → Expr
| StructFieldKind.fromParent =>
let val := decl.value
addCtorFields fieldInfos i (type.instantiate1 val)
| StructFieldKind.subobject =>
let n := mkInternalSubobjectFieldName decl.userName
addCtorFields fieldInfos i (mkForall n decl.binderInfo decl.type type)
| StructFieldKind.newField =>
| _ =>
addCtorFields fieldInfos i (mkForall decl.userName decl.binderInfo decl.type type)
private def mkCtor (view : StructView) (levelParams : List Name) (params : Array Expr) (fieldInfos : Array StructFieldInfo) : TermElabM Constructor :=

View file

@ -57,10 +57,6 @@ def getStructureInfo? (env : Environment) (structName : Name) : Option Structure
| some modIdx => structureExt.getModuleEntries env modIdx |>.binSearch { structName } StructureInfo.lt
| none => structureExt.getState env |>.map.find? structName
/-- We mark subobject fields by prefixing them with "_" in the structure's intro rule. -/
def mkInternalSubobjectFieldName (fieldName : Name) : Name :=
fieldName.appendBefore "_"
def getStructureCtor (env : Environment) (constName : Name) : ConstructorVal :=
match env.find? constName with
| some (ConstantInfo.inductInfo { isRec := false, ctors := [ctorName], .. }) =>