mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 20:09:41 +00:00
Macro. Issue 55931. Failing test for adding 'extends' and then new type.
Bug: https://github.com/dart-lang/sdk/issues/55931 Change-Id: Iaf7f147b1d710d55f70ecaa2d26a8c2f88fd4afe Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371781 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
2e9bd8a967
commit
9d642f43fe
|
@ -182,10 +182,11 @@ Future<List<Object>> resolveIdentifiers(
|
|||
const DeclareType.named(this.name, this.code);
|
||||
|
||||
@override
|
||||
buildTypesForClass(clazz, builder) {
|
||||
buildTypesForClass(clazz, builder) async {
|
||||
var parts = await resolveIdentifiers(builder, code);
|
||||
builder.declareType(
|
||||
name,
|
||||
DeclarationCode.fromString(code),
|
||||
DeclarationCode.fromParts(parts),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6153,6 +6153,62 @@ abstract class MacroElementsTest extends MacroElementsBaseTest {
|
|||
@override
|
||||
bool get retainDataForTesting => true;
|
||||
|
||||
@FailingTest(
|
||||
issue: 'https://github.com/dart-lang/sdk/issues/55931',
|
||||
reason: r'''
|
||||
Here we apply `SetExtendsType` first, so `augment class B` is first.
|
||||
Then we apply `DeclareType`, so `class C @113` is next.
|
||||
But the actual merged code has the different order.
|
||||
Note, that the code below has the _expected_ merged code.
|
||||
''',
|
||||
)
|
||||
test_addClass_extendsTypeOther() async {
|
||||
var library = await buildLibrary(r'''
|
||||
import 'append.dart';
|
||||
|
||||
class A {}
|
||||
|
||||
@DeclareType('C', 'class C {}')
|
||||
@SetExtendsType('{{package:test/test.dart@A}}', [])
|
||||
class B {}
|
||||
''');
|
||||
|
||||
configuration
|
||||
..withConstructors = false
|
||||
..withMetadata = false;
|
||||
checkElementText(library, r'''
|
||||
library
|
||||
imports
|
||||
package:test/append.dart
|
||||
definingUnit
|
||||
classes
|
||||
class A @29
|
||||
class B @125
|
||||
augmentation: self::@augmentation::package:test/test.macro.dart::@classAugmentation::B
|
||||
supertype: A
|
||||
augmented
|
||||
augmentationImports
|
||||
package:test/test.macro.dart
|
||||
macroGeneratedCode
|
||||
---
|
||||
augment library 'package:test/test.dart';
|
||||
|
||||
import 'package:test/test.dart' as prefix0;
|
||||
|
||||
augment class B extends prefix0.A {
|
||||
}
|
||||
class C {}
|
||||
---
|
||||
imports
|
||||
package:test/test.dart as prefix0 @78
|
||||
definingUnit
|
||||
classes
|
||||
augment class B @94
|
||||
augmentationTarget: self::@class::B
|
||||
class C @113
|
||||
''');
|
||||
}
|
||||
|
||||
test_disable_declarationsPhase() async {
|
||||
var library = await buildLibrary(r'''
|
||||
// @dart = 3.2
|
||||
|
|
Loading…
Reference in a new issue