Repository navigation
fix: add version check for meta decl member resolution - #1012
Conversation
… out mismatched version overloads
There was a problem hiding this comment.
Code Review
This pull request introduces Lua version checks using check_member_version when resolving member types and owner IDs for meta declarations. The review feedback points out that these changes lack fallback logic, which could lead to inconsistent behavior compared to other resolution methods. Specifically, returning LuaType::Never or None when no version matches may break type inference and navigation features like 'Go to Definition' for members defined in other Lua versions.
| if feature.is_meta_decl() | ||
| && check_member_version(db, LuaSemanticDeclId::Member(member.get_id())) |
There was a problem hiding this comment.
When MemberTypeResolveState::Meta is active, this change causes the function to return LuaType::Never if no meta declarations match the current Lua version. This behavior is inconsistent with resolve_member_semantic_id (lines 221-235), which provides a fallback to the last meta declaration if no version match is found. Returning Never can break type inference for members that have meta definitions for other Lua versions but are missing an explicit definition for the current one. Consider implementing a similar fallback or ensuring that the state only switches to Meta if a version-compatible declaration exists.
| if feature.is_meta_decl() | ||
| && check_member_version(db, LuaSemanticDeclId::Member(member.get_id())) |
There was a problem hiding this comment.
Similar to the issue in resolve_member_type, returning None here when no meta declarations match the version can lead to missing definitions for features like "Go to Definition" or type owner resolution. To maintain consistency with resolve_member_semantic_id, consider falling back to the first available meta declaration if none match the version criteria.
…type and resolve_member_owner_id
496c2fc to
e18a4e7
Compare
Add a version check when resolving meta declaration members, filtering out overloads that do not match the configured Lua version.