Commit Graph
3 Commits
Author SHA1 Message Date
Jon Ross-Perkins e89fb83e7e Rename self/Self enums to SelfValueIdentifier/SelfTypeIdentifier (#2701)
Using `Identifier` because `self` and `Self` will resolve to different things. While `i32` uses `Literal`, it'd always resolve to the same type.
2023-03-22 10:07:09 -07:00
Jon Ross-Perkins d0105e119f Parse self in expressions. (#2697)
`self` wasn't being handled in expression logic, only parameter logic. This is needed for `self.x`.

Also renames SelfDeducedParameter to SelfIdentifier because it's parsed fairly consistently with Identifier; this better represents the situations where `self` will need to be handled, it's where `Identifier` is allowed (although `Identifier` could also refer to a type... but I still think `SelfDeducedParameter` is a more difficult to understand name).
2023-03-20 14:13:29 -07:00
Jon Ross-Perkins e613ad5323 Reorganize interface parsing so that it's shared with class and constraint (#2666)
We could similarly add others -- this is intended to make it easy to add more that parse essentially the same.

The functionality expected is that types will use GetDeclarationContext in order to error on certain functionality in the declaration scope loop. e.g., with how constraints and interfaces currently don't allow definitions.

I've only moved out `package` because it's only valid on the top line. It might still be good to parse it later, but with slightly different logic because it would always be an error, and the declaration context isn't quite the right framing for that.

Also unifies some errors with `fn`.
2023-03-13 17:24:01 -07:00