Skip to content

diagnostic#294

Merged
CppCXY merged 4 commits into
EmmyLuaLs:mainfrom
xuhuanzy:diagnostic
Mar 28, 2025
Merged

diagnostic#294
CppCXY merged 4 commits into
EmmyLuaLs:mainfrom
xuhuanzy:diagnostic

Conversation

@xuhuanzy
Copy link
Copy Markdown
Member

No description provided.

@CppCXY CppCXY requested a review from Copilot March 28, 2025 02:07
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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(

@CppCXY CppCXY merged commit 03b7227 into EmmyLuaLs:main Mar 28, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants