Documentation

Lean.Elab.DeclModifiers

Ensure the environment does not contain a declaration with name declName. Recall that a private declaration cannot shadow a non-private one and vice-versa, although they internally have different names.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    Declaration visibility modifier. That is, whether a declaration is public or private or inherits its visibility from the outer scope.

    Instances For
      @[implicit_reducible]
      Equations
      • One or more equations did not get rendered due to their size.

      Returns whether the given visibility modifier should be interpreted as public in the current environment.

      NOTE: Environment.isExporting defaults to false when command elaborators are invoked for backward compatibility. It needs to be initialized apropriately first before calling this function as e.g. done in elabDeclaration.

      Equations
      Instances For
        def Lean.Elab.elabVisibility {m : TypeType} [Monad m] [MonadError m] [MonadEnv m] [MonadOptions m] [MonadLog m] [AddMessageContext m] (vis? : Option (TSyntax `Lean.Parser.Command.visibility)) :

        Converts optional visibility syntax to a Visibility value.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Whether a declaration is default, partial or nonrec.

          Instances For

            Codegen-relevant modifiers.

            Instances For
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Flags and data added to declarations (eg docstrings, attributes, private, unsafe, partial, ...).

                Instances For
                  Equations
                  • One or more equations did not get rendered due to their size.
                  • x✝.isPartial = false
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    • x✝.isNonrec = false
                    Instances For
                      Equations
                      Instances For

                        Adds attribute attr in modifiers

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          Adds attribute attr in modifiers, at the beginning

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Filters attributes using p

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              Returns true if modifiers contains an attribute satisfying p.

                              Equations
                              Instances For
                                @[implicit_reducible]
                                Equations
                                • One or more equations did not get rendered due to their size.
                                def Lean.Elab.expandOptDocComment? {m : TypeType} [Monad m] [MonadError m] (optDocComment : Syntax) :

                                Retrieve doc string from stx of the form (docComment)?.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  def Lean.Elab.elabModifiers {m : TypeType} [Monad m] [MonadEnv m] [MonadResolveName m] [MonadError m] [MonadFinally m] [MonadMacroAdapter m] [MonadRecDepth m] [MonadTrace m] [MonadOptions m] [AddMessageContext m] [MonadLog m] [MonadLiftT IO m] (stx : TSyntax `Lean.Parser.Command.declModifiers) :

                                  Elaborate declaration modifiers (i.e., attributes, partial, private, protected, unsafe, meta, noncomputable, doc string)

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    def Lean.Elab.applyVisibility {m : TypeType} [Monad m] [MonadEnv m] [MonadError m] [MonadFinally m] [MonadInfoTree m] (modifiers : Modifiers) (declName : Name) :

                                    Ensure the function has not already been declared, and apply the given visibility setting to declName. If private, return the updated name using our internal encoding for private names. If protected, register declName as protected in the environment.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      Equations
                                      Instances For
                                        def Lean.Elab.mkDeclName {m : TypeType} [Monad m] [MonadEnv m] [MonadError m] [MonadFinally m] [MonadInfoTree m] (currNamespace : Name) (modifiers : Modifiers) (shortName : Name) :
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For

                                          declId is of the form

                                          leading_parser ident >> optional (".{" >> sepBy1 ident ", " >> "}")
                                          

                                          but we also accept a single identifier to users to make macro writing more convenient .

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For

                                            expandDeclId resulting type.

                                            • shortName : Name

                                              Short name for recursively referring to the declaration.

                                            • declName : Name

                                              Fully qualified name that will be used to name the declaration in the kernel.

                                            • levelNames : List Name

                                              Universe parameter names provided using the universe command and .{...} notation.

                                            • docString? : Option (TSyntax `Lean.Parser.Command.docComment × Bool)

                                              The docstring, and whether it's Verso

                                            Instances For
                                              def Lean.Elab.expandDeclId (currNamespace : Name) (currLevelNames : List Name) (declId : Syntax) (modifiers : Modifiers) :

                                              Given a declaration identifier (e.g., ident (".{" ident,+ "}")?) that may contain explicit universe parameters

                                              • Ensure the new universe parameters do not shadow universe parameters declared using universe command.
                                              • Create the fully qualified named for the declaration using the current namespace, and given modifiers
                                              • Create a short version for recursively referring to the declaration. Recall that the protected modifier affects the generation of the short name.

                                              The result also contains the universe parameters provided using universe command, and the .{...} notation.

                                              This commands also stores the doc string stored in modifiers.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                @[inline]

                                                If attrs contains an @[deprecated] attribute, runs the action with Term.Context.checkDeprecated disabled, suppressing the linter.deprecated warning that would otherwise fire when a deprecated constant is referenced. Otherwise, runs the action unchanged.

                                                This implements the suppression rule from RFC #8942: deprecation warnings should not fire inside the body of a declaration that is itself marked @[deprecated], since the references will go away along with the declaration.

                                                Equations
                                                Instances For