Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global definition shadowing a local one when using dot-notation #3079

Closed
1 task done
nnmm opened this issue Dec 15, 2023 · 0 comments · Fixed by #4497
Closed
1 task done

Global definition shadowing a local one when using dot-notation #3079

nnmm opened this issue Dec 15, 2023 · 0 comments · Fixed by #4497
Labels
bug Something isn't working

Comments

@nnmm
Copy link

nnmm commented Dec 15, 2023

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Check that your issue is not already filed.
    • Reduce the issue to a minimal, self-contained, reproducible test case. Avoid dependencies to mathlib4 or std4.

Description

I would expect that a "local" definition in the form of a where clause shadows a global definition with the same name. Instead, it appears that the global definition shadows the local definition if dot notation is used.

Context

Zulip chat

Steps to Reproduce

Minimal example (H/T to @eric-wieser)

def foo : Nat := 1

def bar : Nat :=
  foo.add 1
where
  foo := 10

def baz : Nat :=
  .add foo 1
where
  foo := 10

#eval bar -- 2
#eval baz -- 11

Expected behavior: [Clear and concise description of what you expect to happen]

#eval bar returns 11

Actual behavior: [Clear and concise description of what actually happens]

#eval bar returns 2

Versions

Lean (version 4.3.0, commit 8e5cf64, Release)
Ubuntu 22.04.3

Additional Information

[Additional information, configuration or data that might be necessary to reproduce the issue]

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant