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

Invalid tokens are silently accepted #242

Closed
leodemoura opened this issue Dec 29, 2020 · 0 comments
Closed

Invalid tokens are silently accepted #242

leodemoura opened this issue Dec 29, 2020 · 0 comments
Labels
bug Something isn't working low priority

Comments

@leodemoura
Copy link
Member

Consider the following example

def a := "hello"

macro (priority := high) "0" : term => `(a)

#eval 0
-- 0 

The parser above is bogus, but Lean does not report an error.
Note that the parser always parses numerals as numLit independently of tokens defined by the user. I think this is a sensible behavior, but we should probably report an error at macro definition time.
BTW, we can create variants of this issue using different kinds of built-in literals: char, string, scientific, etc.
Example:

def  m := "hello"
macro (priority := high) "'a'" : term => `(m)
#eval 'a'
-- 'a'

Remark: users can overload individual numerals using the OfNat type class.

@leodemoura leodemoura added bug Something isn't working low priority labels Dec 29, 2020
ChrisHughes24 pushed a commit to ChrisHughes24/lean4 that referenced this issue Dec 2, 2022
Adding `set` tactic

Co-authored-by: Beanway144 <65977044+Beanway144@users.noreply.github.com>
Co-authored-by: Mario Carneiro <di.gama@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority
Projects
None yet
Development

No branches or pull requests

1 participant