githwxi / ATS-Postiats

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

Bug with record definitions #209

Open Hibou57 opened 6 years ago

Hibou57 commented 6 years ago

While testing, I tried this:

    typedef t = @{0x1=int, 02=int, 3=int, a=int}
    static val v: t
    val x = v.1

The first line triggers no error, suggesting natural numbers as record member names may be expressed in any base, although the syntax requires the selectors to be expressed with the decimal notation (it’s a special lexical unit).

But I get an error on the third line: “the record-type […] is expected to contain the label [int] but it does not.”

If for the third line I do this instead:

    val x = v.0

… then there is no more error. It seems 0x1 is misinterpreted as 0.

githwxi commented 6 years ago

I think '0x1' is parsed using the function 'atoi'. I will revisit the issue later.

Hibou57 commented 6 years ago

In the syntax guide, I wrote the label must use decimal notation. If this error is there, I believe this means in practice it always uses decimal else someone would have already noticed the issue.

githwxi commented 6 years ago

Thanks!