Merged
Conversation
Contributor
There was a problem hiding this comment.
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 <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Pull request summary
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_errorto theLexerErrorclass to identify end-of-file errors more efficiently. (core/src/lexer/error.rs)peek_token_notin theLexerto support skipping a specified number of tokens, with optimizations for EOF handling. (core/src/lexer/lexer.rs)letkeyword 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:
LiteralTypevariant to theAstenum, 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]Parserto 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::Identifierto use a struct-like variant with named fields and added a newConstructorvariant for type constructors. (core/src/parser/ast.rs)Interpreter Changes:
LiteralTypeinCheckedAst. (core/src/interpreter/eval.rs)CheckedAst::IdentifierwithCheckedBindPattern::Variablein assignment handling, aligning with type-checking changes. (core/src/interpreter/eval.rs,core/src/interpreter/tests.rs) [1] [2]Miscellaneous:
is_staticfield fromOperatorInfo, simplifying operator metadata. (core/src/parser/op.rs)core/src/lexer/lexer.rs)