Skip to content

Macro references to symbols in same file as macro definition don't get discovered. #2735

Open
@gspencergoog

Description

@gspencergoog

Someone (Discord conversation starts here) ran across this error from Dartdoc:

dartdoc:stdout: Generating docs for library services from package:flutter/services.dart...
dartdoc:stderr:   error: unresolved doc reference [onSelectionChanged]
dartdoc:stderr:     from services.TextSelectionDelegate.cutSelection: (file:///b/s/w/ir/x/w/flutter%20sdk/packages/flutter/lib/src/services/text_input.dart:874:8)
dartdoc:stderr:   error: unresolved doc reference [onSelectionChanged]
dartdoc:stderr:     from services.TextSelectionDelegate.pasteText: (file:///b/s/w/ir/x/w/flutter%20sdk/packages/flutter/lib/src/services/text_input.dart:904:16)
dartdoc:stderr:   error: unresolved doc reference [onSelectionChanged]
dartdoc:stderr:     from services.TextSelectionDelegate.selectAll: (file:///b/s/w/ir/x/w/flutter%20sdk/packages/flutter/lib/src/services/text_input.dart:934:8)
dartdoc:stderr:   error: unresolved doc reference [onSelectionChanged]
dartdoc:stderr:     from services.TextSelectionDelegate.copySelection: (file:///b/s/w/ir/x/w/flutter%20sdk/packages/flutter/lib/src/services/text_input.dart:956:8)

(from this build log, from this PR in this fork)

The error is on a line like the line below, that references a macro in a library that would be a layer violation if it referenced it in code, since the flutter.rendering.RenderEditable.cause macro is defined in editable.dart in the widgets library, and it is what contains the reference to the missing onSelectionChanged symbol, which is also in the widgets library (in the same file as the macro). Dartdoc is expanding the macro, but then not finding the symbol. I imagine that Dartdoc knows nothing about Flutter's library layers, but I would have thought it could find the symbol.

  /// Cut current selection to [Clipboard].
  ///
  /// If and only if [cause] is [SelectionChangedCause.toolbar], the toolbar
  /// will be hidden and the current selection will be scrolled into view.
  ///
  /// {@macro flutter.rendering.RenderEditable.cause}
  void cutSelection(SelectionChangedCause cause) {

cc @jcollins-g

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work oncustomer-flutterIssues originating from important to Flutter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions