Documentation

Lean.Message

def Lean.mkErrorStringWithPos (fileName : String) (pos : Lean.Position) (msg : String) (endPos : Option Lean.Position := none) :
Equations
  • One or more equations did not get rendered due to their size.
Instances For

    A naming context is the information needed to shorten names in pretty printing.

    It gives the current namespace and the list of open declarations.

    Instances For
      structure Lean.TraceData :
      • cls : Lean.Name

        Trace class, e.g. Elab.step.

      • startTime : Float

        Start time in seconds; 0 if unknown to avoid Option allocation.

      • stopTime : Float

        Stop time in seconds; 0 if unknown to avoid Option allocation.

      • collapsed : Bool

        Whether trace node defaults to collapsed in the infoview.

      • tag : String

        Optional tag shown in trace.profiler.output output after the trace class name.

      Instances For

        Structured message data. We use it for reporting errors, trace messages, etc.

        Instances For

          Eagerly formatted text.

          Equations
          Instances For

            Lazy message data production, with access to the context as given by a surrounding MessageData.withContext (which is expected to exist).

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

              Returns true when the message contains a MessageData.tagged tag .. constructor where p tag is true.

              This does not descend into lazily generated subtrees (.ofLazy); message tags of interest (like those added by logLinter) are expected to be near the root of the MessageData, and not hidden inside .ofLazy.

              Returns the top-level tag of the message. If none, returns Name.anonymous.

              This does not descend into message subtrees (e.g., .compose, .ofLazy). The message kind is expected to describe the whole message.

              Equations
              Instances For
                Equations
                • Lean.MessageData.mkPPContext nCtx ctx = { env := ctx.env, mctx := ctx.mctx, lctx := ctx.lctx, opts := ctx.opts, currNamespace := nCtx.currNamespace, openDecls := nCtx.openDecls }
                Instances For
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        Simply formats the name. See MessageData.ofConstName for richer messages.

                        Equations
                        Instances For

                          Represents a constant name such that hovering and "go to definition" works. If there is no such constant in the environment, the name is simply formatted, but sanitized if it is a hygienic name. Use MessageData.ofName if hovers are undesired.

                          If fullNames is true, then pretty prints as if pp.fullNames is true. Otherwise, pretty prints using the current user setting for pp.fullNames.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            Equations
                            Instances For
                              Equations
                              • msgData.toString = do let __do_liftmsgData.format pure (toString __do_lift)
                              Instances For
                                Equations
                                • One or more equations did not get rendered due to their size.

                                Wrap the given message in l and r. See also Format.bracket.

                                Equations
                                Instances For

                                  Wrap the given message in parentheses ().

                                  Equations
                                  Instances For

                                    Wrap the given message in square brackets [].

                                    Equations
                                    Instances For

                                      Append the given list of messages with the given separator.

                                      Equations
                                      Instances For

                                        Write the given list of messages as a list, separating each item with ,\n and surrounding with square brackets.

                                        Equations
                                        Instances For

                                          Puts MessageData into a comma-separated list with "or" at the back (no Oxford comma). Best used on non-empty lists; returns "– none –" for an empty list.

                                          Equations
                                          Instances For

                                            Puts MessageData into a comma-separated list with "and" at the back (no Oxford comma). Best used on non-empty lists; returns "– none –" for an empty list.

                                            Equations
                                            Instances For
                                              structure Lean.BaseMessage (α : Type u) :

                                              A BaseMessage is a richly formatted piece of information emitted by Lean. They are rendered by client editors in the infoview and in diagnostic windows. There are two varieties in the Lean core:

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

                                                A Message is a richly formatted piece of information emitted by Lean. They are rendered by client editors in the infoview and in diagnostic windows.

                                                Equations
                                                Instances For

                                                  A SerialMessage is a Message whose MessageData has been eagerly serialized and is thus appropriate for use in pure contexts where the effectful MessageData.toString cannot be used.

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

                                                        Returns the top-level tag of the message. If none, returns Name.anonymous.

                                                        This does not descend into message subtrees (e.g., .compose, .ofLazy). The message kind is expected to describe the whole message.

                                                        Equations
                                                        • msg.kind = msg.data.kind
                                                        Instances For
                                                          @[inline]

                                                          Serializes the message, converting its data into a string and saving its kind.

                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            def Lean.Message.toString (msg : Lean.Message) (includeEndPos : Bool := false) :
                                                            Equations
                                                            • msg.toString includeEndPos = do let __do_liftmsg.serialize pure (inline (__do_lift.toString includeEndPos))
                                                            Instances For
                                                              Equations
                                                              Instances For

                                                                A persistent array of messages.

                                                                In the Lean elaborator, we use a fresh message log per command but may also report diagnostics at various points inside a command, which will empty unreported and move its messages to reported. Reported messages are preserved for some specific "lookback" operations such as hasError that should consider the entire message history of the current command; most other functions such as add and toList will only operate on unreported messages.

                                                                • The list of messages already reported (i.e. saved in a Snapshot), in insertion order.

                                                                • The list of messages not already reported, in insertion order.

                                                                • loggedKinds : Lean.NameSet

                                                                  Set of message kinds that have been added to the log. For example, we have the kind unsafe.exponentiation.warning for warning messages associated with the configuration option exponentiation.threshold. We don't produce a warning if the kind is already in the following set.

                                                                Instances For
                                                                  Equations
                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    @[deprecated "renamed to `unreported`; direct access should in general be avoided in favor of using `MessageLog.toList/toArray`" (since := "2024-05-22")]
                                                                    Equations
                                                                    Instances For
                                                                      Equations
                                                                      • { reported := r, unreported := u, loggedKinds := loggedKinds }.reportedPlusUnreported = r ++ u
                                                                      Instances For
                                                                        Equations
                                                                        • log.hasUnreported = !log.unreported.isEmpty
                                                                        Instances For
                                                                          Equations
                                                                          • Lean.MessageLog.add msg log = { reported := log.reported, unreported := log.unreported.push msg, loggedKinds := log.loggedKinds }
                                                                          Instances For
                                                                            Equations
                                                                            • l₁.append l₂ = { reported := l₁.reported ++ l₂.reported, unreported := l₁.unreported ++ l₂.unreported, loggedKinds := Lean.RBTree.union l₁.loggedKinds l₂.loggedKinds }
                                                                            Instances For

                                                                              Checks if either of reported or unreported contains an error, i.e. whether the current command has errored yet.

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

                                                                                Moves unreported messages to reported.

                                                                                Equations
                                                                                • One or more equations did not get rendered due to their size.
                                                                                Instances For
                                                                                  Equations
                                                                                  • One or more equations did not get rendered due to their size.
                                                                                  Instances For
                                                                                    Equations
                                                                                    • One or more equations did not get rendered due to their size.
                                                                                    Instances For
                                                                                      def Lean.MessageLog.forM {m : TypeType} [Monad m] (log : Lean.MessageLog) (f : Lean.Messagem Unit) :
                                                                                      Equations
                                                                                      • log.forM f = log.unreported.forM f
                                                                                      Instances For

                                                                                        Converts the unreported messages to a list, oldest message first.

                                                                                        Equations
                                                                                        • log.toList = log.unreported.toList
                                                                                        Instances For

                                                                                          Converts the unreported messages to an array, oldest message first.

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