blob: 81a4ef55ea98ebc8951d49cd7aec4c568aa56f61 [file] [log] [blame]
# Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Incremental compiler scenario coped from the tests in
# tests/language/macros/nesting/
# where macro_impl_uses_macro1_test.dart is recompiled.
type: newworld
worlds:
- entry: main.dart
experiments: macros
sources:
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "macros",
"rootUri": "holePunch:pkg/macros",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "_macros",
"rootUri": "holePunch:pkg/_macros",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "meta",
"rootUri": "holePunch:pkg/meta",
"packageUri": "lib/"
}
]
}
main.dart: |
import 'impl/declare_count1_macro.dart';
@DeclareCount1()
@override
class A {}
void main() {
print(A().count);
}
impl/declare_count1_macro.dart: |
import 'package:macros/macros.dart';
import 'declare_count0_macro.dart';
@DeclareCount0()
macro class DeclareCount1 implements ClassDeclarationsMacro {
const DeclareCount1();
@override
Future<void> buildDeclarationsForClass(
ClassDeclaration clazz, MemberDeclarationBuilder builder) async {
builder.declareInType(DeclarationCode.fromString('int get count => ${count + 1};'));
}
}
impl/declare_count0_macro.dart: |
import 'package:macros/macros.dart';
macro class DeclareCount0 implements ClassDeclarationsMacro {
const DeclareCount0();
@override
Future<void> buildDeclarationsForClass(
ClassDeclaration clazz, MemberDeclarationBuilder builder) async {
builder.declareInType(DeclarationCode.fromString('int get count => 0;'));
}
}
expectedLibraryCount: 5
- entry: main.dart
errors: false
worldType: updated
expectInitializeFromDill: false
experiments: macros
invalidate:
- main.dart
sources:
main.dart: |
import 'impl/declare_count1_macro.dart';
@DeclareCount1()
@override
@override // make it an outline change
class A {}
void main() {
print(A().count);
}
expectedLibraryCount: 5
advancedInvalidation: outlineChange