Skip to content

dart: call sites with closure-literal trailing arguments misdetected as function definitions #1624

Closed

Description

@squid-protocol

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):

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

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

  1. added
    bug
    core-engine
    on Aug 14, 2026
  2. added this to the v2.4.8 milestone on Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions