chore: avoid turning accesses to private decs from public signatures into auto implicits (#9961)

This commit is contained in:
Sebastian Ullrich 2025-08-18 10:01:12 +02:00 committed by GitHub
parent 3c702f38ee
commit a805e7e12c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -1994,9 +1994,12 @@ def resolveName (stx : Syntax) (n : Name) (preresolved : List Syntax.Preresolved
where
process (candidates : List (Name × List String)) : TermElabM (List (Expr × List String)) := do
if candidates.isEmpty then
let env ← getEnv
if (← read).autoBoundImplicit &&
!(← read).autoBoundImplicitForbidden n &&
isValidAutoBoundImplicitName n (relaxedAutoImplicit.get (← getOptions)) then
isValidAutoBoundImplicitName n (relaxedAutoImplicit.get (← getOptions)) &&
-- do not turn a scope error into an auto implicit
!(env.isExporting && (env.setExporting false).contains n) then
throwAutoBoundImplicitLocal n
else
throwUnknownIdentifierAt (declHint := n) stx m!"Unknown identifier `{.ofConstName n}`"

View file

@ -12,7 +12,6 @@ error: Unknown identifier `f`
Note: A private declaration `f` exists but is not accessible in the current context.
-/
#guard_msgs in
set_option autoImplicit false in
public theorem t2 : f = 1 := sorry
/--