Macro references to symbols in same file as macro definition don't get discovered.
某人(在这里开始的不一致对话开始)遇到了达多克的错误:
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)
(从此构建日志中,此叉中的此PR)
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
嗯。宏目前仅充当文本扩展,不保留其定义的任何原始上下文。但是对于用户而言,对于宏中定义的符号来说是合理的,可以意识到这种情况。我们要么不应该允许宏定义在源头上(可悲的是,这艘船很可能已经很久以前航行),要么我们应该以某种方式保留对定义背景的知识。