Skip to content

Commit 4c00a3c

Browse files
committed
At least this
1 parent d787b03 commit 4c00a3c

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/Lean/Elab/App.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ private def resolveLValAux (e : Expr) (eType : Expr) (lval : LVal) : TermElabM L
13731373
throwError m!"Invalid projection: Index `{idx}` is invalid for this structure; {bounds}"
13741374
++ .note m!"The expression{inlineExpr e}has type{inlineExpr eType}which has only {numFields} {fields}"
13751375
++ tupleHint
1376-
| some structName, LVal.fieldName ref fieldName _ fullRef => withRef ref do
1376+
| some structName, LVal.fieldName ref fieldName _ _ => withRef ref do
13771377
let env ← getEnv
13781378
if isStructure env structName then
13791379
if let some baseStructName := findField? env structName (Name.mkSimple fieldName) then
@@ -1389,12 +1389,12 @@ private def resolveLValAux (e : Expr) (eType : Expr) (lval : LVal) : TermElabM L
13891389
-- Then search the environment
13901390
if let some (baseStructName, fullName) ← findMethod? structName (.mkSimple fieldName) then
13911391
return LValResolution.const baseStructName structName fullName
1392-
throwInvalidFieldAt fullRef fieldName fullName
1393-
| none, LVal.fieldName _ _ (some suffix) fullRef =>
1392+
throwInvalidFieldAt ref fieldName fullName
1393+
| none, LVal.fieldName ref _ (some suffix) _fullRef =>
13941394
-- This may be a function constant whose implicit arguments have already been filled in:
13951395
let c := e.getAppFn
13961396
if c.isConst then
1397-
throwUnknownConstantAt fullRef (c.constName! ++ suffix)
1397+
throwUnknownConstantAt ref (c.constName! ++ suffix)
13981398
else
13991399
throwInvalidFieldNotation e eType
14001400
| _, _ => throwInvalidFieldNotation e eType

tests/lean/run/issue10821.lean

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ example (n : Nat) : Nat :=
4141
n.inc'
4242

4343
/--
44-
@ +2:2...8
44+
@ +2:4...8
4545
error: Invalid field `incc`: The environment does not contain `Nat.incc`
4646
n
4747
has type
@@ -50,3 +50,14 @@ has type
5050
#guard_msgs (positions := true) in
5151
example (n : Nat) : Nat :=
5252
n.incc
53+
54+
/--
55+
@ +2:4...8
56+
error: Invalid field `incc`: The environment does not contain `Nat.incc`
57+
n
58+
has type
59+
Nat
60+
-/
61+
#guard_msgs (positions := true) in
62+
example (n : Nat) : Nat :=
63+
n.incc.foo

0 commit comments

Comments
 (0)