Skip to content

Commit 9f8eda8

Browse files
committed
this works
1 parent 4c00a3c commit 9f8eda8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Lean/Elab/App.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,7 @@ private def elabAppLValsAux (namedArgs : Array NamedArg) (args : Array Arg) (exp
16021602
let some info := getFieldInfo? (← getEnv) baseStructName fieldName | unreachable!
16031603
if isInaccessiblePrivateName (← getEnv) info.projFn then
16041604
throwError "Field `{fieldName}` from structure `{structName}` is private"
1605-
let projFn ← mkConst info.projFn
1605+
let projFn ← withRef lval.getRef <| mkConst info.projFn
16061606
let projFn ← addProjTermInfo lval.getRef projFn
16071607
if lvals.isEmpty then
16081608
let namedArgs ← addNamedArg namedArgs { name := `self, val := Arg.expr f, suppressDeps := true }
@@ -1612,7 +1612,7 @@ private def elabAppLValsAux (namedArgs : Array NamedArg) (args : Array Arg) (exp
16121612
loop f lvals
16131613
| LValResolution.const baseStructName structName constName =>
16141614
let f ← if baseStructName != structName then mkBaseProjections baseStructName structName f else pure f
1615-
let projFn ← mkConst constName
1615+
let projFn ← withRef lval.getRef <| mkConst constName
16161616
let projFn ← addProjTermInfo lval.getRef projFn
16171617
if lvals.isEmpty then
16181618
let (args, namedArgs) ← addLValArg baseStructName f args namedArgs projFn explicit

tests/lean/run/issue10821.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def Nat.inc (n : Nat) : Nat := n + 1
88
def Nat.inc' (n : Nat) : Nat := n + 1
99

1010
/--
11-
@ +2:2...+3:9
11+
@ +3:5...9
1212
warning: `Nat.inc'` has been deprecated: Use `Nat.inc` instead
1313
-/
1414
#guard_msgs (positions := true) in
@@ -17,23 +17,23 @@ example (n : Nat) : Nat :=
1717
|>.inc'
1818

1919
/--
20-
@ +2:2...11
20+
@ +2:7...11
2121
warning: `Nat.inc'` has been deprecated: Use `Nat.inc` instead
2222
-/
2323
#guard_msgs (positions := true) in
2424
example (n : Nat) : Nat :=
2525
n |>.inc'
2626

2727
/--
28-
@ +2:2...10
28+
@ +2:6...10
2929
warning: `Nat.inc'` has been deprecated: Use `Nat.inc` instead
3030
-/
3131
#guard_msgs (positions := true) in
3232
example (n : Nat) : Nat :=
3333
(n).inc'
3434

3535
/--
36-
@ +2:2...8
36+
@ +2:4...8
3737
warning: `Nat.inc'` has been deprecated: Use `Nat.inc` instead
3838
-/
3939
#guard_msgs (positions := true) in

0 commit comments

Comments
 (0)