Skip to content

Commit e361733

Browse files
alokclaude
andcommitted
chore: use backticks instead of single quotes for identifiers in messages
This PR standardizes the formatting of identifiers in error messages, warnings, diagnostics, and documentation to use backticks instead of single quotes. For example, `'sorry'` becomes `` `sorry` ``. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent cc89a85 commit e361733

File tree

100 files changed

+221
-221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+221
-221
lines changed

src/Init/MetaTypes.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ structure ExtractLetsConfig where
367367
useContext : Bool := true
368368
/-- If true (default: false), then once `givenNames` is exhausted, stop extracting lets. Otherwise continue extracting lets. -/
369369
onlyGivenNames : Bool := false
370-
/-- If true (default: false), then when no name is provided for a 'let' expression, the name is used as-is without making it be inaccessible.
370+
/-- If true (default: false), then when no name is provided for a `let` expression, the name is used as-is without making it be inaccessible.
371371
The name still might be inaccessible if the binder name was. -/
372372
preserveBinderNames : Bool := false
373373
/-- If true (default: false), lift non-extractable `let`s as far out as possible. -/

src/Init/Notation.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ By default, the command captures all messages, but the filter condition can be a
803803
For example, we can select only warnings:
804804
```lean
805805
/--
806-
warning: declaration uses 'sorry'
806+
warning: declaration uses `sorry`
807807
-/
808808
#guard_msgs(warning) in
809809
example : α := sorry

src/Lean/AddDecl.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def wasOriginallyTheorem (env : Environment) (declName : Name) : Bool :=
6868
getOriginalConstKind? env declName |>.map (· matches .thm) |>.getD false
6969

7070
/-- If `warn.sorry` is set to true, then, so long as the message log does not already have any errors,
71-
declarations with `sorryAx` generate the "declaration uses 'sorry'" warning. -/
71+
declarations with `sorryAx` generate the "declaration uses `sorry`" warning. -/
7272
register_builtin_option warn.sorry : Bool := {
7373
defValue := true
7474
descr := "warn about uses of `sorry` in declarations added to the environment"
@@ -81,7 +81,7 @@ logs a warning if the declaration uses `sorry`.
8181
def warnIfUsesSorry (decl : Declaration) : CoreM Unit := do
8282
if warn.sorry.get (← getOptions) then
8383
if !(← MonadLog.hasErrors) && decl.hasSorry then
84-
-- Find an actual sorry expression to use for 'sorry'.
84+
-- Find an actual sorry expression to use for `sorry`.
8585
-- That way the user can hover over it to see its type and use "go to definition" if it is a labeled sorry.
8686
let findSorry : StateRefT (Array (Bool × MessageData)) MetaM Unit := decl.forEachSorryM fun s => do
8787
let s' ← addMessageContext s
@@ -91,10 +91,10 @@ def warnIfUsesSorry (decl : Declaration) : CoreM Unit := do
9191
-- These can appear without logged errors if `decl` is referring to declarations with elaboration errors;
9292
-- that's where a user should direct their focus.
9393
if let some (_, s) := sorries.find? (·.1) <|> sorries[0]? then
94-
logWarning <| .tagged `hasSorry m!"declaration uses '{s}'"
94+
logWarning <| .tagged `hasSorry m!"declaration uses `{s}`"
9595
else
9696
-- This case should not happen, but it ensures a warning will get logged no matter what.
97-
logWarning <| .tagged `hasSorry m!"declaration uses 'sorry'"
97+
logWarning <| .tagged `hasSorry m!"declaration uses `sorry`"
9898

9999
builtin_initialize
100100
registerTraceClass `addDecl

src/Lean/Attributes.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ structure AttributeImplCore where
3030
applicationTime := AttributeApplicationTime.afterTypeChecking
3131
deriving Inhabited
3232

33-
/-- You can tag attributes with the 'local' or 'scoped' kind.
33+
/-- You can tag attributes with the `local` or `scoped` kind.
3434
For example: `attribute [local myattr, scoped yourattr, theirattr]`.
3535
3636
This is used to indicate how an attribute should be scoped.

src/Lean/Class.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def addClass (env : Environment) (clsName : Name) : Except MessageData Environme
159159
let some decl := env.find? clsName
160160
| throw m!"unknown declaration '{clsName}'"
161161
unless decl matches .inductInfo .. | .axiomInfo .. do
162-
throw m!"invalid 'class', declaration '{.ofConstName clsName}' must be inductive datatype, structure, or constant"
162+
throw m!"invalid `class`, declaration '{.ofConstName clsName}' must be inductive datatype, structure, or constant"
163163
let outParams ← checkOutParam 0 #[] #[] decl.type
164164
return classExtension.addEntry env { name := clsName, outParams }
165165

src/Lean/Compiler/CSimpAttr.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def add (declName : Name) (kind : AttributeKind) : CoreM Unit := do
5050
if let some entry ← isConstantReplacement? declName then
5151
ext.add entry kind
5252
else
53-
throwError "invalid 'csimp' theorem, only constant replacement theorems (e.g., `@f = @g`) are currently supported."
53+
throwError "invalid `csimp` theorem, only constant replacement theorems (e.g., `@f = @g`) are currently supported."
5454

5555
/--
5656
Tags compiler simplification theorems, which allow one value to be replaced by another equal value

src/Lean/Compiler/IR/Checker.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def markJP (j : JoinPointId) : M Unit :=
5757
def getDecl (c : Name) : M Decl := do
5858
let ctx ← read
5959
match findEnvDecl' (← getEnv) c ctx.decls with
60-
| none => throwCheckerError s!"depends on declaration '{c}', which has no executable code; consider marking definition as 'noncomputable'"
60+
| none => throwCheckerError s!"depends on declaration `{c}`, which has no executable code; consider marking definition as `noncomputable`"
6161
| some d => pure d
6262

6363
def checkVar (x : VarId) : M Unit := do

src/Lean/Compiler/IR/EmitLLVM.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ def emitSSet (builder : LLVM.Builder llvmctx) (x : VarId) (n : Nat) (offset : Na
10671067
| IRType.uint16 => pure ("lean_ctor_set_uint16", ← LLVM.i16Type llvmctx)
10681068
| IRType.uint32 => pure ("lean_ctor_set_uint32", ← LLVM.i32Type llvmctx)
10691069
| IRType.uint64 => pure ("lean_ctor_set_uint64", ← LLVM.i64Type llvmctx)
1070-
| _ => throw s!"invalid type for 'lean_ctor_set': '{t}'"
1070+
| _ => throw s!"invalid type for `lean_ctor_set`: `{t}`"
10711071
let argtys := #[ ← LLVM.voidPtrType llvmctx, ← LLVM.unsignedType llvmctx, setty]
10721072
let retty ← LLVM.voidType llvmctx
10731073
let fn ← getOrCreateFunctionPrototype (← getLLVMModule) retty fnName argtys
@@ -1489,9 +1489,9 @@ def emitMainFn (mod : LLVM.Module llvmctx) (builder : LLVM.Builder llvmctx) : M
14891489
let d ← getDecl `main
14901490
let xs ← match d with
14911491
| .fdecl (xs := xs) .. => pure xs
1492-
| _ => throw "Function declaration expected for 'main'"
1492+
| _ => throw "Function declaration expected for `main`"
14931493

1494-
unless xs.size == 2 || xs.size == 1 do throw s!"Invalid main function, main expected to have '2' or '1' arguments, found '{xs.size}' arguments"
1494+
unless xs.size == 2 || xs.size == 1 do throw s!"Invalid main function, main expected to have `2` or `1` arguments, found `{xs.size}` arguments"
14951495
let env ← getEnv
14961496
let usesLeanAPI := usesModuleFrom env `Lean
14971497
let mainTy ← LLVM.functionType (← LLVM.i64Type llvmctx)

src/Lean/Compiler/IR/ToIR.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ partial def lowerLet (decl : LCNF.LetDecl) (k : LCNF.Code) : M FnBody := do
252252
| some (.axiomInfo ..) | .some (.quotInfo ..) | .some (.inductInfo ..) | .some (.thmInfo ..) =>
253253
throwNamedError lean.dependsOnNoncomputable f!"`{name}` not supported by code generator; consider marking definition as `noncomputable`"
254254
| some (.recInfo ..) =>
255-
throwError f!"code generator does not support recursor `{name}` yet, consider using 'match ... with' and/or structural recursion"
255+
throwError f!"code generator does not support recursor `{name}` yet, consider using `match ... with` and/or structural recursion"
256256
| none => panic! "reference to unbound name"
257257
| .fvar fvarId args =>
258258
match (← getFVarValue fvarId) with

src/Lean/Compiler/LCNF/ToMono.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def Param.toMono (param : Param) : ToMonoM Param := do
2626
param.update (← toMonoType param.type)
2727

2828
def throwNoncomputableError {α : Type} (declName : Name) : ToMonoM α :=
29-
throwNamedError lean.dependsOnNoncomputable m!"failed to compile definition, consider marking it as 'noncomputable' because it depends on '{.ofConstName declName}', which is 'noncomputable'"
29+
throwNamedError lean.dependsOnNoncomputable m!"failed to compile definition, consider marking it as `noncomputable` because it depends on '{.ofConstName declName}', which is `noncomputable`"
3030

3131
def checkFVarUse (fvarId : FVarId) : ToMonoM Unit := do
3232
if let some declName := (← get).noncomputableVars.get? fvarId then

0 commit comments

Comments
 (0)