@@ -320,6 +320,7 @@ opaque addDeclCore (env : Environment) (maxHeartbeats : USize) (decl : @& Declar
320
320
@[inherit_doc Kernel.Environment.addDeclWithoutChecking, extern "lean_elab_add_decl_without_checking"]
321
321
opaque addDeclWithoutChecking (env : Environment) (decl : @& Declaration) : Except Kernel.Exception Environment
322
322
323
+ @[deprecated "use `Lean.addDecl` instead"]
323
324
def addDecl (env : Environment) (opts : Options) (decl : Declaration)
324
325
(cancelTk? : Option IO.CancelToken := none) : Except Kernel.Exception Environment :=
325
326
if debug.skipKernelTC.get opts then
@@ -1103,34 +1104,9 @@ def isNamespace (env : Environment) (n : Name) : Bool :=
1103
1104
def getNamespaceSet (env : Environment) : NameSSet :=
1104
1105
namespacesExt.getState env
1105
1106
1106
- private def isNamespaceName : Name → Bool
1107
- | .str .anonymous _ => true
1108
- | .str p _ => isNamespaceName p
1109
- | _ => false
1110
-
1111
- private def registerNamePrefixes (env : Environment) (name : Name) : Environment :=
1112
- match name with
1113
- | .str _ s =>
1114
- if s.get 0 == '_' then
1115
- -- Do not register namespaces that only contain internal declarations.
1116
- env
1117
- else
1118
- go env name
1119
- | _ => env
1120
- where go env
1121
- | .str p _ => if isNamespaceName p then go (registerNamespace env p) p else env
1122
- | _ => env
1123
-
1124
1107
@[export lean_elab_environment_update_base_after_kernel_add]
1125
- private def updateBaseAfterKernelAdd (env : Environment) (added : Declaration) (base : Kernel.Environment) : Environment := Id.run do
1126
- let mut env := { env with base }
1127
- env := added.getNames.foldl registerNamePrefixes env
1128
- if let .inductDecl _ _ types _ := added then
1129
- -- also register inductive type names as namespaces; this used to be done by the kernel itself
1130
- -- when adding e.g. the recursor but now that the environment extension API exists only for
1131
- -- `Lean.Environment`, we have to do it here
1132
- env := types.foldl (registerNamePrefixes · <| ·.name ++ `rec) env
1133
- env
1108
+ private def updateBaseAfterKernelAdd (env : Environment) (base : Kernel.Environment) : Environment :=
1109
+ { env with base }
1134
1110
1135
1111
@[export lean_display_stats]
1136
1112
def displayStats (env : Environment) : IO Unit := do
0 commit comments