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

Name hygiene in expanded structure command #793

Closed
1 task done
gebner opened this issue Nov 13, 2021 · 4 comments
Closed
1 task done

Name hygiene in expanded structure command #793

gebner opened this issue Nov 13, 2021 · 4 comments

Comments

@gebner
Copy link
Member

gebner commented Nov 13, 2021

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Description

When a macro expands to a structure, name resolution fails in fields with dependent types.

Steps to Reproduce

macro "foo" : command =>
  `(structure Foo where
      val : Nat
      prop : val = 42)

foo

Expected behavior: foo declares the structure Foo

Actual behavior: foo fails with unknown identifier 'val✝'

Versions

Nightly from November 12.

@Kha
Copy link
Member

Kha commented Nov 17, 2021

Hygiene of compound identifiers is not something we have really tackled yet (and for which we can't defer to Racket). Not sure when we'll get to it, there are a few fundamental issues to solve/decide on.

@Kha
Copy link
Member

Kha commented Nov 17, 2021

That is, this specific issue is simple to solve I believe. The hard part is to make Foo.prop and x.prop and { prop := ... } work.

@leodemoura
Copy link
Member

I fixed the issue above.

That is, this specific issue is simple to solve I believe. The hard part is to make Foo.prop and x.prop and { prop := ... } work.

The only one that does not work yet is Foo.prop. Not sure how critical it is.

@gebner
Copy link
Member Author

gebner commented Nov 23, 2021

At least for my application, this was enough. I could remove the $value:ident : $ty workaround I was using before.

ChrisHughes24 added a commit to ChrisHughes24/lean4 that referenced this issue Dec 2, 2022
mathlib3 sha 4e42a9d0a79d151ee359c270e498b1a00cc6fa4e 


- [x] depends on: leanprover#792 
- [x] depends on: leanprover-community/mathlib4#800

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>
Co-authored-by: ChrisHughes24 <chrishughes24@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants