Fix MissingCommonModuleMethod false positive on chained common module accessor calls#3978
Fix MissingCommonModuleMethod false positive on chained common module accessor calls#3978Copilot wants to merge 2 commits into
Conversation
|
@claude pls review |
|
Claude finished @nixel2007's task in 2m 49s —— View job Code Review
The fix is correct and well-targeted. Here's a detailed analysis: How the fix worksThe root cause was that The fix introduces An additional guard in Correctness check
Observations1. Missing unit test for the global-form chained case
@Test
void testGlobalFormChainedCallIsNotCommonModuleExpression() {
var code = """
Процедура Тест()
Значение = ОбщийМодуль("ПервыйОбщийМодуль").НастройкиВитрины(Витрина);
КонецПроцедуры""";
// ... assertThat isCommonModuleExpression → false
}2. Pre-existing inconsistency in Случай 2a (lines 170–173) returns 3. The Javadoc on 4. Test fixture design
VerdictThe fix is correct and the test coverage for the primary scenario is solid. The only minor gap is a missing test for the global-call chained form ( |
MissingCommonModuleMethodreported a spurious error when a variable was assigned the result of a method called on a common module reference. The reference indexer mapped the variable to the common module itself, so subsequent member calls were resolved against the module.Changes
ModuleReference: an expression is now recognized as a common module reference only when the accessor call (.ОбщийМодуль("Имя")) is the terminal element of the chain.hasMatchingModifierMethodCall/extractModuleNameFromMatchingModifierinspect only the last modifier (via newgetMatchingTerminalModifierhelper), soОбщегоНазначения.ОбщийМодуль("X").Метод()no longer matches.extractModuleNameFromGlobalMethodCallbails out when modifiers trail the localОбщийМодуль("X")form.ModuleReferenceTestunit coverage andReferenceIndexFillerTestregression (withReferenceIndexCommonModuleChainedResult.bslfixture) verifying the chained result is not indexed as a module method call.Direct accessor assignments (
Перем = ОбщегоНазначения.ОбщийМодуль("X")) continue to resolve as before.