Repository navigation
Description
Summary
A function call whose final argument is itself a closure/callback literal (e.g., identifier(args, (ParamType name) {) reads structurally like a function signature followed by its body-open brace (name(params) {), defeating the existing Invocation Shield (fixes #1221, #1428). This is the same bug class, but specifically for closure-typed trailing arguments (distinct from the list-literal-element shape fixed in #1479).
Confirmed repro
All examples are real corpus call sites from language-crucible/data/dart/flutter/:
// flutter/framework.dart:3756 -- visitChildren is a CALL, not a declaration
visitChildren((Element child) {
child.reassemble();
});
// flutter/editable_text.dart:2729 -- setState is a Flutter State method CALL
setState(() {
// Inform the widget that the value of clipboardStatus has changed.
});
// flutter/object.dart:5887 -- configProvider.updateConfig is a CALL
configProvider.updateConfig((SemanticsConfiguration config) {
tags.forEach(config.addTagForChildren);
});
// flutter/semantics.dart:5268 -- _addAction is a call with 2 args, 2nd is a closure
_addAction(action, (Object? args) {
assert(args == null);
handler();
});Each produces a phantom function_data row (e.g., named visitChildren, setState, configProvider.updateConfig, _addAction) when scanned. Confirmed via direct SQLite query against a real galaxyscope scan of this corpus.
Corpus impact (confirmed via tests/tools/tree_sitter_accuracy_audit.py --lang dart):
language-crucible/data/dart/flutter/*.dartcorpus: ~80+ of dart's 186 remainingfunc_startfalse positives trace to this shape- The single largest remaining false-positive bucket after dart func_start: 4 distinct false-positive shapes remain after #1477's ground-truth fix (const ctors, colon-init-no-body ctors, multi-line class headers, multi-line bare calls) #1479's fixes
Fix direction
Extend the Invocation Shield logic (wherever it lives for dart in detector.py/language_standards.py — see the #1221/#1428/#1479 precedent) to also recognize a call whose final argument is itself a closure literal (params) {/(params) =>, not just bare calls or list-literal elements.
Related issues
- func_start missing the args regex's 'Invocation Shield': bare call statements false-positive as function definitions (7 languages) #1221: func_start missing Invocation Shield (7 languages)
- csharp: detector.py's ';' vs '{'/'=>' terminator shield is fooled by a lambda arrow inside multi-line call arguments #1428: csharp Invocation Shield lambda-arrow fix (related dart follow-up)
- dart func_start: 4 distinct false-positive shapes remain after #1477's ground-truth fix (const ctors, colon-init-no-body ctors, multi-line class headers, multi-line bare calls) #1479: dart func_start false positives (multi-line bare calls mentioned but closure-literal variant not covered)
Labels
bug, core-engine
File location
gitgalaxy/core/detector.py (dart Invocation Shield logic) or gitgalaxy/standards/language_standards.py (if dart-specific regex adjustment needed)
Activity