fix: ignore implementationDetail hyps in rename_i (#5183)

Closes #5176
This commit is contained in:
Jannis Limperg 2024-08-27 16:45:16 +02:00 committed by GitHub
parent 095c7b2bfc
commit 44366382d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

View file

@ -458,6 +458,8 @@ def renameInaccessibles (mvarId : MVarId) (hs : TSyntaxArray ``binderIdent) : Ta
match lctx.getAt? j with
| none => pure ()
| some localDecl =>
if localDecl.isImplementationDetail then
continue
let inaccessible := !(extractMacroScopes localDecl.userName |>.equalScope callerScopes)
let shadowed := found.contains localDecl.userName
if inaccessible || shadowed then

14
tests/lean/run/5176.lean Normal file
View file

@ -0,0 +1,14 @@
class Foo where
class Bar extends Foo where
bar : True
def foo : Foo := {}
example [Bar] : Bar := {
foo with bar := by {
rename_i inst
guard_hyp inst : Bar
trivial
}
}