diagnostic#294
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces diagnostic improvements and additional test coverage for type checking, template pattern matching, and field checking in the Emmylua code analyzer. Key changes include:
- Enhancements in type checking for unions and enum integer constants.
- Improved handling of table generic types and template pattern matching for object members.
- New test cases addressing undefined fields, return type mismatches, assign type mismatches, and field injection scenarios, alongside updated diagnostic checks for field access.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/emmylua_code_analysis/src/semantic/type_check/ref_type.rs | Adds logic to infer integer type when an enum’s values are all integer constants. |
| crates/emmylua_code_analysis/src/semantic/type_check/complex_type/table_generic_check.rs | Enables handling of LuaType::Union in table generic type checking. |
| crates/emmylua_code_analysis/src/semantic/generic/tpl_pattern.rs | Incorporates table constant handling and introduces a helper for member owner matching in template patterns. |
| crates/emmylua_code_analysis/src/diagnostic/test/undefined_field_test.rs | Adds test cases for undefined field diagnostics under various key type scenarios. |
| crates/emmylua_code_analysis/src/diagnostic/test/return_type_mismatch_test.rs | Provides a test case for return type mismatch diagnostics. |
| crates/emmylua_code_analysis/src/diagnostic/test/inject_field_test.rs | Introduces tests to verify correct field injection with different table index types. |
| crates/emmylua_code_analysis/src/diagnostic/test/assign_type_mismatch_test.rs | Adds an enum-based test case that differentiates allowed and disallowed assign type mismatches. |
| crates/emmylua_code_analysis/src/diagnostic/checker/check_field.rs | Refactors field checking with a focused member validation helper and supporting utilities. |
Comments suppressed due to low confidence (1)
crates/emmylua_code_analysis/src/semantic/generic/tpl_pattern.rs:221
- [nitpick] The function name 'object_tpl_pattern_match_member_owner_match' is quite long and may benefit from a more concise name to improve clarity and readability.
fn object_tpl_pattern_match_member_owner_match(
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.
No description provided.