[api_summary] Include mixins in textual API summaries

Fixes an issue where with mixin clauses were omitted when generating textual API summaries for class and interface declarations.

Regenerates api.txt for analyzer and analyzer_plugin.

Change-Id: Ic33d76955cefb31709e265ec4ea9d5df9a065f7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/503701
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
kevmoo
2026-05-22 11:35:09 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 19f0f72d9e
commit 1e8a9d5d45
4 changed files with 33 additions and 3 deletions
+2 -2
View File
@@ -36,7 +36,7 @@ package:analyzer/analysis_rule/pubspec.dart:
name (getter: PubspecNode?)
path (getter: PubspecEntry?)
version (getter: PubspecEntry?)
PubspecDependencyList (class extends Object, abstract):
PubspecDependencyList (class extends Object with Iterable<PubspecDependency>, abstract):
new (constructor: PubspecDependencyList Function())
PubspecEntry (class extends Object):
new (constructor: PubspecEntry Function(PubspecNode?, PubspecNode))
@@ -60,7 +60,7 @@ package:analyzer/analysis_rule/pubspec.dart:
new (constructor: PubspecNode Function())
span (getter: SourceSpan)
text (getter: String?)
PubspecNodeList (class extends Object implements PubspecSection, abstract):
PubspecNodeList (class extends Object with Iterable<PubspecNode> implements PubspecSection, abstract):
new (constructor: PubspecNodeList Function())
iterator (getter: Iterator<PubspecNode>)
PubspecSection (class extends Object, abstract):
+3 -1
View File
@@ -1663,6 +1663,8 @@ package:analyzer_plugin/src/utilities/client_uri_converter.dart:
ClientUriConverter (non-public)
package:analyzer_plugin/src/utilities/completion/completion_target.dart:
CompletionTarget (non-public)
package:analyzer_plugin/src/utilities/completion/element_suggestion_builder.dart:
ElementSuggestionBuilder (non-public)
package:analyzer_plugin/src/utilities/completion/optype.dart:
OpType (non-public)
package:analyzer_plugin/starter.dart:
@@ -1850,7 +1852,7 @@ package:analyzer_plugin/utilities/completion/completion_core.dart:
new (constructor: DartCompletionRequest Function())
result (getter: ResolvedUnitResult)
package:analyzer_plugin/utilities/completion/inherited_reference_contributor.dart:
InheritedReferenceContributor (class extends Object implements CompletionContributor):
InheritedReferenceContributor (class extends Object with ElementSuggestionBuilder implements CompletionContributor):
new (constructor: InheritedReferenceContributor Function())
containingLibrary (getter: LibraryElement?)
containingLibrary= (setter: LibraryElement?)
@@ -260,6 +260,7 @@ class ApiDescription {
case InterfaceElement(
:var typeParameters,
:var supertype,
:var mixins,
:var interfaces,
):
var instanceDescription = <Object?>[
@@ -284,6 +285,11 @@ class ApiDescription {
..._describeType(supertype),
]);
}
if (mixins.isNotEmpty) {
instanceDescription.addAll(
mixins.map(_describeType).separatedBy(prefix: ' with '),
);
}
if (element is MixinElement &&
element.superclassConstraints.isNotEmpty) {
instanceDescription.addAll(
@@ -36,6 +36,28 @@ class Foo {}
super.setUp();
}
Future<void> test_class_mixins() async {
var summary = await _build({
'$testPackageLibPath/file.dart': '''
mixin M1 {}
mixin M2 {}
class C1 extends Object with M1 {}
class C2 extends Object with M2 implements M1 {}
''',
});
expect(summary, '''
package:test/file.dart:
C1 (class extends Object with M1):
new (constructor: C1 Function())
C2 (class extends Object with M2 implements M1):
new (constructor: C2 Function())
M1 (mixin on Object)
M2 (mixin on Object)
dart:core:
Object (referenced)
''');
}
Future<void> test_class_modifiers() async {
var summary = await _build({
'$testPackageLibPath/file.dart': '''