teal-language / tl

The compiler for Teal, a typed dialect of Lua
MIT License
2.11k stars 109 forks source link

Is "type" keyword accepted as identifier ? #510

Closed mingodad closed 2 years ago

mingodad commented 2 years ago

Trying to write an alternative parser for tl I found a possible bug on https://github.com/teal-language/tl/blob/ef4fcda5ba0a0c83d2a4dbfac67baf186e8c4252/tl.tl#L46 we have as field of a record but on https://github.com/teal-language/tl/blob/ef4fcda5ba0a0c83d2a4dbfac67baf186e8c4252/tl.tl#L54 and https://github.com/teal-language/tl/blob/ef4fcda5ba0a0c83d2a4dbfac67baf186e8c4252/tl.tl#L1201 we have type as field name for another record.

This makes difficult to parse because type seems to be a keyword that also is valid inside a record for type declaration like here https://github.com/teal-language/tl/blob/ef4fcda5ba0a0c83d2a4dbfac67baf186e8c4252/tl.tl#L10 inside local record tl.

Is this intended or a bug ?