-
Notifications
You must be signed in to change notification settings - Fork 0
Add typed variable assignments #36
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR aims to improve the language’s type system and variable assignment by introducing literal type expressions and typed variable assignments, while also refactoring operator handling to support parse-time operators. Key changes include enhancements to the lexer and parser to handle new type expression constructs, adjustments in the type checker for literal types and assignments, and updates to several tests and operator definitions.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
core/src/type_checker/checker.rs | Updated type expression checking and assignment handling. |
core/src/type_checker/checked_ast.rs | Added support for literal type AST nodes and bind patterns. |
core/src/stdlib/init.rs | Modified operator initialization and type registration. |
core/src/parser/parser.rs | Extended parsing to support typed definitions and type constructors. |
core/src/parser/op.rs | Added new constructor for parse-time operators. |
core/src/lexer/* | Removed the 'let' keyword and updated token peeking logic. |
core/src/interpreter/* | Adjustments to assignment evaluation and environment management. |
Comments suppressed due to low confidence (2)
core/src/type_checker/checked_ast.rs:475
- [nitpick] Relying on panic when retrieving line info for a wildcard pattern may reduce error resilience. Consider returning an Option<&LineInfo> or a default value instead.
CheckedBindPattern::Wildcard => panic!("Wildcard pattern has no line info"),
core/src/interpreter/env.rs:151
- [nitpick] Ensure that the error output here clearly communicates that redeclaration of a variable is not allowed, and consider aligning the error messaging style with other parts of the codebase.
).with_label("This is defined somewhere else".to_string(), info.clone()))
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Pull request summary
|
This pull request introduces several significant changes across different parts of the codebase, focusing on improving functionality, simplifying structures, and removing unused features. The most notable updates include enhancements to the lexer and parser, updates to the type system, and changes to operator handling.
Lexer Improvements:
is_eof_error
to theLexerError
class to identify end-of-file errors more efficiently. (core/src/lexer/error.rs
)peek_token_not
in theLexer
to support skipping a specified number of tokens, with optimizations for EOF handling. (core/src/lexer/lexer.rs
)let
keyword from the lexer and associated tests, simplifying the token set. (core/src/lexer/lexer.rs
,core/src/lexer/tests.rs
,core/src/lexer/token.rs
) [1] [2] [3]Parser Enhancements:
LiteralType
variant to theAst
enum, allowing the representation of literal type expressions. (core/src/parser/ast.rs
) [1] [2] [3]ParseOperatorHandler
) to the operator system, enabling macro-like behavior during parsing. (core/src/parser/op.rs
) [1] [2] [3]Parser
to manage a set of known types (types
) and enhanced operator handling to include the new parse-time operators. (core/src/parser/parser.rs
) [1] [2]Type System Updates:
TypeAst::Identifier
to use a struct-like variant with named fields and added a newConstructor
variant for type constructors. (core/src/parser/ast.rs
)Interpreter Changes:
LiteralType
inCheckedAst
. (core/src/interpreter/eval.rs
)CheckedAst::Identifier
withCheckedBindPattern::Variable
in assignment handling, aligning with type-checking changes. (core/src/interpreter/eval.rs
,core/src/interpreter/tests.rs
) [1] [2]Miscellaneous:
is_static
field fromOperatorInfo
, simplifying operator metadata. (core/src/parser/op.rs
)core/src/lexer/lexer.rs
)