githwxi / ATS-Postiats

ATS2: Unleashing the Potentials of Types and Templates
www.ats-lang.org
Other
354 stars 54 forks source link

“[mpz_init_set_str()] failed” while lexing #201

Closed Hibou57 closed 6 years ago

Hibou57 commented 6 years ago

Type‑checking this (for a test):

    val a = 0xu

Which after pats_lexing.dats, should be the same as 0x0u, I get this error message from patsopt:

exit(ATS): [mpz_init_set_str()] failed

Unfortunately, it gives no source location. Pretty sure the error occurs while lexing.

Hibou57 commented 6 years ago

It’s in GMP, so no, it’s later after lexing is done, because lexing only stores the T_INT string, does not evaluate it.

githwxi commented 6 years ago

mpz_init_set_str treats empty string "" as invalid input. I have fixed this issue.

githwxi commented 6 years ago

By the way, if you pass the flag '--debug' to patsopt, the compiler can give you a bit of information when an error occurs.

Hibou57 commented 6 years ago

You are really nice :)

I did not knew the --debug flag, will keep it in mind. It indeed gives relevant informations.