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

Confusing type of Expr inputs in the local context #15

Open
Vtec234 opened this issue Jun 26, 2023 · 0 comments
Open

Confusing type of Expr inputs in the local context #15

Vtec234 opened this issue Jun 26, 2023 · 0 comments

Comments

@Vtec234
Copy link
Contributor

Vtec234 commented Jun 26, 2023

Consider the following program:

def abc : Q(Type) :=
  let e : Expr := Expr.const `abc []
  let f : Q(Type) := Expr.const ``Nat []
  q(sorry)

Then hovering over sorry, we see the following Expected type:

«$e» : Expr := Expr.const `abc []
«$f» : TypeType

Here $f has its "internal" type shown properly (Type rather than Q(Type)), whereas $e has its "external" type shown which is quite confusing as the context is now mixing up theories. Could quote4 assume something like e : Q(?), or e : Q(dummy), and show $e : ?mvar, or $e : dummy, in the local context?

UPDATE: This happens because quote4 comes with an auto-quotation feature using the ToExpr typeclass. For example, if we have n : Nat in the external context, we get $n : Nat internally. This is actually mkNatLit n, using the ToExpr Nat instance. Combining this behaviour with the ToExpr Expr instance present in mathlib makes for the confusing situation described here where e gets quoted twice.

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

1 participant