[cfe] Handle augment super expressions
This adds the generation of access to augmented procedures.
TEST=existing
Change-Id: I5efa9cc541b86c18735bb1f4c51c73976ffa42ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250164
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index 5ae894f..6449763 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -8185,6 +8185,32 @@
problemMessage: r"""'new' can only be used as a constructor reference.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeNoAugmentSuperInvokeTarget =
+ messageNoAugmentSuperInvokeTarget;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageNoAugmentSuperInvokeTarget = const MessageCode(
+ "NoAugmentSuperInvokeTarget",
+ problemMessage: r"""Cannot call 'augment super'.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeNoAugmentSuperReadTarget = messageNoAugmentSuperReadTarget;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageNoAugmentSuperReadTarget = const MessageCode(
+ "NoAugmentSuperReadTarget",
+ problemMessage: r"""Cannot read from 'augment super'.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeNoAugmentSuperWriteTarget =
+ messageNoAugmentSuperWriteTarget;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageNoAugmentSuperWriteTarget = const MessageCode(
+ "NoAugmentSuperWriteTarget",
+ problemMessage: r"""Cannot write to 'augment super'.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(Token token)> templateNoFormals = const Template<
Message Function(Token token)>(
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_member_builder.dart b/pkg/front_end/lib/src/fasta/dill/dill_member_builder.dart
index 21cde4c..a782700 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_member_builder.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_member_builder.dart
@@ -266,7 +266,7 @@
@override
bool get isInternalImplementation {
Member member = memberBuilder.member;
- return member is Field && member.isInternalImplementation;
+ return member.isInternalImplementation;
}
@override
diff --git a/pkg/front_end/lib/src/fasta/kernel/augmentation_lowering.dart b/pkg/front_end/lib/src/fasta/kernel/augmentation_lowering.dart
index 67ba682..fba484d 100644
--- a/pkg/front_end/lib/src/fasta/kernel/augmentation_lowering.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/augmentation_lowering.dart
@@ -7,8 +7,32 @@
const String _augmentedNamePrefix = '_#';
const String _augmentedNameSuffix = '#augment';
-/// Creates the synthesized name to use for the [index]th augmented member by
-/// the given [name] in [library].
+/// Creates the synthesized name to use for the [index]th augmented
+/// member by the given [name] in [library].
+///
+/// The index refers to the augmentation layer. For instance if we have
+///
+/// // 'origin.dart':
+/// import augment 'augment1.dart';
+/// import augment 'augment2.dart';
+/// void method() {} // Index 0.
+///
+/// // 'augment1.dart':
+/// augment void method() { // Index 1.
+/// augment super(); // Calling index 0.
+/// }
+///
+/// // 'augment2.dart':
+/// augment void method() { // Not indexed.
+/// augment super(); // Calling index 1.
+/// }
+///
+/// the declaration from 'origin.dart' has index 0 and is generated with the
+/// name '_#method#augment0, the declaration from 'augment1.dart' has index 1
+/// and is generated with the name '_#method#augment1', and the declaration from
+/// 'augment2.dart' has no index but is generated using the declared name
+/// 'method' because it serves as the entry point for all external access to
+/// the method body.
Name augmentedName(String name, Library library, int index) {
return new Name(
'$_augmentedNamePrefix'
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 951fe0e..94bac69 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -5892,11 +5892,8 @@
if (member is SourceMemberBuilder) {
SourceMemberBuilder sourceMemberBuilder = member as SourceMemberBuilder;
if (sourceMemberBuilder.isAugmentation) {
- // TODO(johnniwinther): Implement augment super handling.
- int fileOffset = augmentToken.charOffset;
- push(forest.createAsExpression(fileOffset,
- forest.createNullLiteral(fileOffset), const DynamicType(),
- forNonNullableByDefault: libraryBuilder.isNonNullableByDefault));
+ push(new AugmentSuperAccessGenerator(
+ this, augmentToken, sourceMemberBuilder));
return;
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
index 39ecc43..486282b 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
@@ -51,6 +51,7 @@
tripleShiftName;
import '../problems.dart';
import '../scope.dart';
+import '../source/source_member_builder.dart';
import '../source/stack_listener_impl.dart' show offsetForToken;
import 'constness.dart' show Constness;
import 'expression_generator_helper.dart';
@@ -643,18 +644,8 @@
bool isPreIncDec: false,
bool isPostIncDec: false}) {
_reportNonNullableInNullAwareWarningIfNeeded();
- _helper.forest.createBinary(
- offset,
- _forest.createPropertyGet(
- fileOffset, _forest.createThisExpression(fileOffset), name),
- binaryOperator,
- value);
- Expression binary = _helper.forest.createBinary(
- offset,
- _forest.createPropertyGet(
- fileOffset, _forest.createThisExpression(fileOffset), name),
- binaryOperator,
- value);
+ Expression binary = _helper.forest
+ .createBinary(offset, _createRead(), binaryOperator, value);
return _createWrite(fileOffset, binary, forEffect: voidContext);
}
@@ -667,9 +658,8 @@
offset: offset, voidContext: voidContext, isPostIncDec: true);
}
_reportNonNullableInNullAwareWarningIfNeeded();
- VariableDeclarationImpl read = _helper.createVariableDeclarationForValue(
- _forest.createPropertyGet(
- fileOffset, _forest.createThisExpression(fileOffset), name));
+ VariableDeclarationImpl read =
+ _helper.createVariableDeclarationForValue(_createRead());
Expression binary = _helper.forest.createBinary(offset,
_helper.createVariableGet(read, fileOffset), binaryOperator, value);
VariableDeclarationImpl write = _helper.createVariableDeclarationForValue(
@@ -4955,3 +4945,130 @@
sink.write(name.text);
}
}
+
+class AugmentSuperAccessGenerator extends Generator {
+ final SourceMemberBuilder augmentation;
+
+ AugmentSuperAccessGenerator(
+ ExpressionGeneratorHelper helper, Token token, this.augmentation)
+ : super(helper, token);
+
+ @override
+ String get _debugName => "AugmentSuperGenerator";
+
+ @override
+ String get _plainNameForRead {
+ return unsupported("augment super.plainNameForRead", fileOffset, _uri);
+ }
+
+ Expression _createRead() {
+ Member? readTarget = augmentation.augmentSuperTarget?.readTarget;
+ if (readTarget != null) {
+ return new AugmentSuperGet(readTarget, fileOffset: fileOffset);
+ } else {
+ return _helper.buildProblem(
+ messageNoAugmentSuperReadTarget, fileOffset, noLength);
+ }
+ }
+
+ @override
+ Expression buildAssignment(Expression value, {bool voidContext: false}) {
+ return _createWrite(fileOffset, value, forEffect: voidContext);
+ }
+
+ Expression _createWrite(int offset, Expression value,
+ {required bool forEffect}) {
+ Member? writeTarget = augmentation.augmentSuperTarget?.writeTarget;
+ if (writeTarget != null) {
+ return new AugmentSuperSet(writeTarget, value,
+ forEffect: forEffect, fileOffset: fileOffset);
+ } else {
+ return _helper.buildProblem(
+ messageNoAugmentSuperWriteTarget, offset, noLength);
+ }
+ }
+
+ @override
+ Expression buildCompoundAssignment(Name binaryOperator, Expression value,
+ {int offset = TreeNode.noOffset,
+ bool voidContext = false,
+ bool isPreIncDec = false,
+ bool isPostIncDec = false}) {
+ // TODO(johnniwinther): Is this ever valid? Augment getters have no access
+ // to the augmented setter, augmenting setters have no access to the
+ // augmented getters, and augmenting fields only have read access to the
+ // augmented field initializer expression.
+
+ Expression binary = _helper.forest
+ .createBinary(offset, _createRead(), binaryOperator, value);
+ return _createWrite(fileOffset, binary, forEffect: voidContext);
+ }
+
+ @override
+ Expression buildIfNullAssignment(Expression value, DartType type, int offset,
+ {bool voidContext = false}) {
+ // TODO(johnniwinther): Is this ever valid? Augment getters have no access
+ // to the augmented setter, augmenting setters have no access to the
+ // augmented getters, and augmenting fields only have read access to the
+ // augmented field initializer expression.
+ return new IfNullSet(
+ _createRead(), _createWrite(offset, value, forEffect: voidContext),
+ forEffect: voidContext)
+ ..fileOffset = offset;
+ }
+
+ @override
+ Generator buildIndexedAccess(Expression index, Token token,
+ {required bool isNullAware}) {
+ // TODO(johnniwinther): The semantics is unclear. Is this accessing the
+ // invoke target, which must be an `operator []` or the read target with a
+ // type that has an `operator []`.
+ throw new UnimplementedError();
+ }
+
+ @override
+ Expression buildPostfixIncrement(Name binaryOperator,
+ {int offset = TreeNode.noOffset, bool voidContext = false}) {
+ // TODO(johnniwinther): Is this ever valid? Augment getters have no access
+ // to the augmented setter, augmenting setters have no access to the
+ // augmented getters, and augmenting fields only have read access to the
+ // augmented field initializer expression.
+ Expression value = _forest.createIntLiteral(offset, 1);
+ if (voidContext) {
+ return buildCompoundAssignment(binaryOperator, value,
+ offset: offset, voidContext: voidContext, isPostIncDec: true);
+ }
+ VariableDeclarationImpl read =
+ _helper.createVariableDeclarationForValue(_createRead());
+ Expression binary = _helper.forest.createBinary(offset,
+ _helper.createVariableGet(read, fileOffset), binaryOperator, value);
+ VariableDeclarationImpl write = _helper.createVariableDeclarationForValue(
+ _createWrite(fileOffset, binary, forEffect: true));
+ return new PropertyPostIncDec.onReadOnly(read, write)..fileOffset = offset;
+ }
+
+ @override
+ Expression buildSimpleRead() {
+ return _createRead();
+ }
+
+ @override
+ Expression_Generator_Initializer doInvocation(
+ int offset, List<TypeBuilder>? typeArguments, ArgumentsImpl arguments,
+ {bool isTypeArgumentsInForest = false}) {
+ Member? invokeTarget = augmentation.augmentSuperTarget?.invokeTarget;
+ if (invokeTarget != null) {
+ return new AugmentSuperInvocation(invokeTarget, arguments,
+ fileOffset: fileOffset);
+ } else {
+ return _helper.buildProblem(
+ messageNoAugmentSuperInvokeTarget, offset, noLength);
+ }
+ }
+
+ @override
+ void printOn(StringSink sink) {
+ sink.write(", augmentation: ");
+ sink.write(augmentation);
+ }
+}
diff --git a/pkg/front_end/lib/src/fasta/kernel/hierarchy/class_member.dart b/pkg/front_end/lib/src/fasta/kernel/hierarchy/class_member.dart
index dd83533..708205e 100644
--- a/pkg/front_end/lib/src/fasta/kernel/hierarchy/class_member.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/hierarchy/class_member.dart
@@ -60,11 +60,11 @@
/// source code.
bool get isSynthesized;
- // If `true` this member is not part of the interface but only part of the
- // class members.
- //
- // This is `true` for instance for synthesized fields added for the late
- // lowering.
+ /// If `true` this member is not part of the interface but only part of the
+ /// class members.
+ ///
+ /// This is `true` for instance for synthesized fields added for the late
+ /// lowering.
bool get isInternalImplementation;
/// Returns `true` if this member is composed from a list of class members
diff --git a/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart b/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart
index bc654d8..70a5ee3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/internal_ast.dart
@@ -394,6 +394,9 @@
}
enum InternalExpressionKind {
+ AugmentSuperInvocation,
+ AugmentSuperGet,
+ AugmentSuperSet,
Binary,
Cascade,
CompoundExtensionIndexSet,
@@ -4781,3 +4784,160 @@
printer.writeExpression(value);
}
}
+
+/// An augment super invocation of the form `augment super()`.
+///
+/// This will be transformed into an [InstanceInvocation], [InstanceGet] plus
+/// [FunctionInvocation], or [StaticInvocation] after type inference.
+class AugmentSuperInvocation extends InternalExpression {
+ final Member target;
+
+ Arguments arguments;
+
+ AugmentSuperInvocation(this.target, this.arguments,
+ {required int fileOffset}) {
+ arguments.parent = this;
+ this.fileOffset = fileOffset;
+ }
+
+ @override
+ ExpressionInferenceResult acceptInference(
+ InferenceVisitorImpl visitor, DartType typeContext) {
+ return visitor.visitAugmentSuperInvocation(this, typeContext);
+ }
+
+ @override
+ InternalExpressionKind get kind =>
+ InternalExpressionKind.AugmentSuperInvocation;
+
+ @override
+ void visitChildren(Visitor<dynamic> v) {
+ arguments.accept(v);
+ }
+
+ @override
+ void transformChildren(Transformer v) {
+ arguments = v.transform(arguments);
+ arguments.parent = this;
+ }
+
+ @override
+ void transformOrRemoveChildren(RemovingTransformer v) {
+ arguments = v.transform(arguments);
+ arguments.parent = this;
+ }
+
+ @override
+ String toString() {
+ return "AugmentSuperInvocation(${toStringInternal()})";
+ }
+
+ @override
+ int get precedence => Precedence.PRIMARY;
+
+ @override
+ void toTextInternal(AstPrinter printer) {
+ printer.write('augment super');
+ printer.writeArguments(arguments);
+ }
+}
+
+/// An augment super read of the form `augment super`.
+///
+/// This will be transformed into an [InstanceGet], [InstanceTearOff],
+/// [DynamicGet], [FunctionTearOff] or [StaticInvocation] (for implicit
+/// extension member access) after type inference.
+class AugmentSuperGet extends InternalExpression {
+ final Member target;
+
+ AugmentSuperGet(this.target, {required int fileOffset}) {
+ this.fileOffset = fileOffset;
+ }
+
+ @override
+ ExpressionInferenceResult acceptInference(
+ InferenceVisitorImpl visitor, DartType typeContext) {
+ return visitor.visitAugmentSuperGet(this, typeContext);
+ }
+
+ @override
+ InternalExpressionKind get kind => InternalExpressionKind.AugmentSuperGet;
+
+ @override
+ void visitChildren(Visitor<dynamic> v) {}
+
+ @override
+ void transformChildren(Transformer v) {}
+
+ @override
+ void transformOrRemoveChildren(RemovingTransformer v) {}
+
+ @override
+ String toString() {
+ return "AugmentSuperGet(${toStringInternal()})";
+ }
+
+ @override
+ int get precedence => Precedence.PRIMARY;
+
+ @override
+ void toTextInternal(AstPrinter printer) {
+ printer.write('augment super');
+ }
+}
+
+/// An augment super write of the form `augment super = e`.
+///
+/// This will be transformed into an [InstanceSet], or [StaticSet] after type
+/// inference.
+class AugmentSuperSet extends InternalExpression {
+ final Member target;
+
+ Expression value;
+
+ /// If `true` the assignment is need for its effect and not for its value.
+ final bool forEffect;
+
+ AugmentSuperSet(this.target, this.value,
+ {required this.forEffect, required int fileOffset}) {
+ value.parent = this;
+ this.fileOffset = fileOffset;
+ }
+
+ @override
+ ExpressionInferenceResult acceptInference(
+ InferenceVisitorImpl visitor, DartType typeContext) {
+ return visitor.visitAugmentSuperSet(this, typeContext);
+ }
+
+ @override
+ InternalExpressionKind get kind => InternalExpressionKind.AugmentSuperSet;
+
+ @override
+ void visitChildren(Visitor v) {
+ value.accept(v);
+ }
+
+ @override
+ void transformChildren(Transformer v) {
+ value = v.transform(value);
+ value.parent = this;
+ }
+
+ @override
+ void transformOrRemoveChildren(RemovingTransformer v) {
+ value = v.transform(value);
+ value.parent = this;
+ }
+
+ @override
+ String toString() {
+ return "AugmentSuperSet(${toStringInternal()})";
+ }
+
+ @override
+ void toTextInternal(AstPrinter printer) {
+ printer.write('augment super = ');
+ printer.writeExpression(value);
+ }
+}
diff --git a/pkg/front_end/lib/src/fasta/scope.dart b/pkg/front_end/lib/src/fasta/scope.dart
index 187af99..65a2fa5 100644
--- a/pkg/front_end/lib/src/fasta/scope.dart
+++ b/pkg/front_end/lib/src/fasta/scope.dart
@@ -790,23 +790,22 @@
@override
void set isConflictingAugmentationMember(bool value) {
- throw new UnsupportedError(
- 'AmbiguousMemberBuilder.isConflictingAugmentationMember=');
+ throw new UnsupportedError('$runtimeType.isConflictingAugmentationMember=');
}
@override
void set parent(Builder? value) {
- throw new UnsupportedError('AmbiguousMemberBuilder.parent=');
+ throw new UnsupportedError('$runtimeType.parent=');
}
@override
ClassBuilder get classBuilder {
- throw new UnsupportedError('AmbiguousMemberBuilder.classBuilder');
+ throw new UnsupportedError('$runtimeType.classBuilder');
}
@override
SourceLibraryBuilder get libraryBuilder {
- throw new UnsupportedError('AmbiguousMemberBuilder.library');
+ throw new UnsupportedError('$runtimeType.library');
}
// TODO(johnniwinther): Remove this and create a [ProcedureBuilder] interface.
@@ -818,8 +817,7 @@
ClassHierarchy classHierarchy,
List<DelayedActionPerformer> delayedActionPerformers,
List<DelayedDefaultValueCloner> delayedDefaultValueCloners) {
- throw new UnsupportedError(
- 'AmbiguousMemberBuilder.buildOutlineExpressions');
+ throw new UnsupportedError('$runtimeType.buildOutlineExpressions');
}
@override
@@ -853,7 +851,12 @@
@override
bool get isAugmentation {
- throw new UnsupportedError('AmbiguousMemberBuilder.isAugmentation');
+ throw new UnsupportedError('$runtimeType.isAugmentation');
+ }
+
+ @override
+ AugmentSuperTarget? get augmentSuperTarget {
+ throw new UnsupportedError('$runtimeType.augmentSuperTarget}');
}
}
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index 5a845c0e..d35c1b8 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -3979,10 +3979,18 @@
void injectMemberFromPatch(String name, Builder member) {
if (member.isSetter) {
- assert(scope.lookupLocalMember(name, setter: true) == null);
+ assert(
+ scope.lookupLocalMember(name, setter: true) == null,
+ "Setter $name already bound to "
+ "${scope.lookupLocalMember(name, setter: true)}, "
+ "trying to add $member.");
scope.addLocalMember(name, member as MemberBuilder, setter: true);
} else {
- assert(scope.lookupLocalMember(name, setter: false) == null);
+ assert(
+ scope.lookupLocalMember(name, setter: false) == null,
+ "Member $name already bound to "
+ "${scope.lookupLocalMember(name, setter: false)}, "
+ "trying to add $member.");
scope.addLocalMember(name, member, setter: false);
}
}
diff --git a/pkg/front_end/lib/src/fasta/source/source_member_builder.dart b/pkg/front_end/lib/src/fasta/source/source_member_builder.dart
index 822ea53..af7e756 100644
--- a/pkg/front_end/lib/src/fasta/source/source_member_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_member_builder.dart
@@ -57,6 +57,8 @@
/// library that conflicts with a member in the origin library.
bool get isConflictingAugmentationMember;
void set isConflictingAugmentationMember(bool value);
+
+ AugmentSuperTarget? get augmentSuperTarget;
}
mixin SourceMemberBuilderMixin implements SourceMemberBuilder {
@@ -85,6 +87,11 @@
assert(false,
"Unexpected call to $runtimeType.isConflictingAugmentationMember=");
}
+
+ @override
+ AugmentSuperTarget? get augmentSuperTarget {
+ throw new UnimplementedError('$runtimeType.augmentSuperTarget}');
+ }
}
abstract class SourceMemberBuilderImpl extends MemberBuilderImpl
@@ -156,6 +163,11 @@
/// The builder for the enclosing class or extension, if any.
DeclarationBuilder? get declarationBuilder =>
parent is DeclarationBuilder ? parent as DeclarationBuilder : null;
+
+ @override
+ AugmentSuperTarget? get augmentSuperTarget {
+ throw new UnimplementedError('$runtimeType.augmentSuperTarget}');
+ }
}
enum BuiltMemberKind {
@@ -187,3 +199,16 @@
member.name = new Name(member.name.text, libraryBuilder.library);
}
}
+
+class AugmentSuperTarget {
+ final SourceMemberBuilder declaration;
+ final Member? readTarget;
+ final Member? invokeTarget;
+ final Member? writeTarget;
+
+ AugmentSuperTarget(
+ {required this.declaration,
+ required this.readTarget,
+ required this.invokeTarget,
+ required this.writeTarget});
+}
diff --git a/pkg/front_end/lib/src/fasta/source/source_procedure_builder.dart b/pkg/front_end/lib/src/fasta/source/source_procedure_builder.dart
index e6686bc..4e65a5d 100644
--- a/pkg/front_end/lib/src/fasta/source/source_procedure_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_procedure_builder.dart
@@ -57,7 +57,14 @@
@override
final ProcedureKind kind;
- SourceProcedureBuilder? actualOrigin;
+ /// The builder for the original declaration.
+ SourceProcedureBuilder? _origin;
+
+ /// If this builder is a patch or an augmentation, this is the builder for
+ /// the immediately augmented procedure.
+ SourceProcedureBuilder? _augmentedBuilder;
+
+ int _augmentationIndex = 0;
List<SourceProcedureBuilder>? _patches;
@@ -142,13 +149,15 @@
Member get member => procedure;
@override
- SourceProcedureBuilder get origin => actualOrigin ?? this;
+ SourceProcedureBuilder get origin => _origin ?? this;
@override
Procedure get procedure => isPatch ? origin.procedure : _procedure;
Procedure get actualProcedure => _procedure;
+ Procedure? _augmentedProcedure;
+
@override
FunctionNode get function => _procedure.function;
@@ -459,7 +468,11 @@
void applyPatch(Builder patch) {
if (patch is SourceProcedureBuilder) {
if (checkPatch(patch)) {
- patch.actualOrigin = this;
+ patch._origin = this;
+ SourceProcedureBuilder augmentedBuilder =
+ _patches == null ? this : _patches!.last;
+ patch._augmentedBuilder = augmentedBuilder;
+ patch._augmentationIndex = augmentedBuilder._augmentationIndex + 1;
(_patches ??= []).add(patch);
}
} else {
@@ -467,30 +480,93 @@
}
}
+ Map<SourceProcedureBuilder, AugmentSuperTarget?> _augmentedProcedures = {};
+
+ AugmentSuperTarget? _createAugmentSuperTarget(
+ SourceProcedureBuilder? targetBuilder) {
+ if (targetBuilder == null) return null;
+ Procedure declaredProcedure = targetBuilder.actualProcedure;
+
+ if (declaredProcedure.isAbstract || declaredProcedure.isExternal) {
+ return targetBuilder._augmentedBuilder != null
+ ? _getAugmentSuperTarget(targetBuilder._augmentedBuilder!)
+ : null;
+ }
+
+ Procedure augmentedProcedure =
+ targetBuilder._augmentedProcedure = new Procedure(
+ augmentedName(declaredProcedure.name.text, libraryBuilder.library,
+ targetBuilder._augmentationIndex),
+ declaredProcedure.kind,
+ declaredProcedure.function,
+ fileUri: declaredProcedure.fileUri)
+ ..flags = declaredProcedure.flags
+ ..isStatic = procedure.isStatic
+ ..parent = procedure.parent
+ ..isInternalImplementation = true;
+
+ Member? readTarget;
+ Member? invokeTarget;
+ Member? writeTarget;
+ switch (kind) {
+ case ProcedureKind.Method:
+ readTarget = extensionTearOff ?? augmentedProcedure;
+ invokeTarget = augmentedProcedure;
+ break;
+ case ProcedureKind.Getter:
+ readTarget = augmentedProcedure;
+ invokeTarget = augmentedProcedure;
+ break;
+ case ProcedureKind.Factory:
+ readTarget = augmentedProcedure;
+ invokeTarget = augmentedProcedure;
+ break;
+ case ProcedureKind.Operator:
+ invokeTarget = augmentedProcedure;
+ break;
+ case ProcedureKind.Setter:
+ writeTarget = augmentedProcedure;
+ break;
+ }
+ return new AugmentSuperTarget(
+ declaration: targetBuilder,
+ readTarget: readTarget,
+ invokeTarget: invokeTarget,
+ writeTarget: writeTarget);
+ }
+
+ AugmentSuperTarget? _getAugmentSuperTarget(
+ SourceProcedureBuilder augmentation) {
+ return _augmentedProcedures[augmentation] ??=
+ _createAugmentSuperTarget(augmentation._augmentedBuilder);
+ }
+
+ @override
+ AugmentSuperTarget? get augmentSuperTarget =>
+ origin._getAugmentSuperTarget(this);
+
@override
int buildBodyNodes(void Function(Member, BuiltMemberKind) f) {
List<SourceProcedureBuilder>? patches = _patches;
if (patches != null) {
- Procedure augmentedProcedure = _procedure;
- int index = 0;
- for (SourceProcedureBuilder patch in patches) {
- if (!augmentedProcedure.isExternal && !augmentedProcedure.isAbstract) {
- Procedure newProcedure = new Procedure(
- augmentedName(augmentedProcedure.name.text,
- libraryBuilder.library, index++),
- augmentedProcedure.kind,
- augmentedProcedure.function,
- fileUri: augmentedProcedure.fileUri)
- ..fileOffset = augmentedProcedure.fileOffset
- ..fileEndOffset = augmentedProcedure.fileEndOffset
- ..fileStartOffset = augmentedProcedure.fileStartOffset
- ..signatureType = augmentedProcedure.signatureType
- ..flags = augmentedProcedure.flags;
- f(newProcedure, BuiltMemberKind.Method);
+ void addAugmentedProcedure(SourceProcedureBuilder builder) {
+ Procedure? augmentedProcedure = builder._augmentedProcedure;
+ if (augmentedProcedure != null) {
+ augmentedProcedure
+ ..fileOffset = builder.actualProcedure.fileOffset
+ ..fileEndOffset = builder.actualProcedure.fileEndOffset
+ ..fileStartOffset = builder.actualProcedure.fileStartOffset
+ ..signatureType = builder.actualProcedure.signatureType
+ ..flags = builder.actualProcedure.flags;
+ f(augmentedProcedure, BuiltMemberKind.Method);
}
- augmentedProcedure = patch.actualProcedure;
}
- finishProcedurePatch(procedure, augmentedProcedure);
+
+ addAugmentedProcedure(this);
+ for (SourceProcedureBuilder patch in patches) {
+ addAugmentedProcedure(patch);
+ }
+ finishProcedurePatch(procedure, patches.last.actualProcedure);
return patches.length;
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/inference_visitor.dart b/pkg/front_end/lib/src/fasta/type_inference/inference_visitor.dart
index 1ff55fd..275c3ba 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/inference_visitor.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/inference_visitor.dart
@@ -3020,6 +3020,63 @@
isImplicitCall: false);
}
+ ExpressionInferenceResult visitAugmentSuperInvocation(
+ AugmentSuperInvocation node, DartType typeContext) {
+ Member member = node.target;
+ if (member.isInstanceMember) {
+ ObjectAccessTarget target = new ObjectAccessTarget.interfaceMember(member,
+ isPotentiallyNullable: false);
+ Link<NullAwareGuard> nullAwareGuards = const Link<NullAwareGuard>();
+ Expression receiver = new ThisExpression()..fileOffset = node.fileOffset;
+ DartType receiverType = thisType!;
+ return inferMethodInvocation(
+ this,
+ node.fileOffset,
+ nullAwareGuards,
+ receiver,
+ receiverType,
+ member.name,
+ node.arguments as ArgumentsImpl,
+ typeContext,
+ isExpressionInvocation: false,
+ isImplicitCall: false,
+ target: target);
+ } else if (member is Procedure) {
+ FunctionType calleeType =
+ member.function.computeFunctionType(libraryBuilder.nonNullable);
+ TypeArgumentsInfo typeArgumentsInfo =
+ getTypeArgumentsInfo(node.arguments);
+ InvocationInferenceResult result = inferInvocation(this, typeContext,
+ node.fileOffset, calleeType, node.arguments as ArgumentsImpl,
+ staticTarget: node.target);
+ StaticInvocation invocation =
+ new StaticInvocation(member, node.arguments);
+ if (!isTopLevel) {
+ libraryBuilder.checkBoundsInStaticInvocation(
+ invocation, typeSchemaEnvironment, helper.uri, typeArgumentsInfo);
+ }
+ return new ExpressionInferenceResult(
+ result.inferredType, result.applyResult(invocation));
+ } else {
+ // TODO(johnniwinther): Handle augmentation of field with inferred types.
+ TypeInferenceEngine.resolveInferenceNode(member, classHierarchy);
+ Link<NullAwareGuard> nullAwareGuards = const Link<NullAwareGuard>();
+ DartType receiverType = member.getterType;
+ Expression receiver = new StaticGet(member)..fileOffset = node.fileOffset;
+ return inferMethodInvocation(
+ this,
+ node.fileOffset,
+ nullAwareGuards,
+ receiver,
+ receiverType,
+ callName,
+ node.arguments as ArgumentsImpl,
+ typeContext,
+ isExpressionInvocation: true,
+ isImplicitCall: true);
+ }
+ }
+
ExpressionInferenceResult visitExpressionInvocation(
ExpressionInvocation node, DartType typeContext) {
ExpressionInferenceResult result =
@@ -4788,12 +4845,12 @@
DartType receiverType,
Name propertyName,
DartType typeContext,
- {required bool isThisReceiver}) {
+ {required bool isThisReceiver,
+ ObjectAccessTarget? readTarget}) {
// ignore: unnecessary_null_comparison
assert(isThisReceiver != null);
- ObjectAccessTarget readTarget = findInterfaceMember(
- receiverType, propertyName, fileOffset,
+ readTarget ??= findInterfaceMember(receiverType, propertyName, fileOffset,
includeExtensionMethods: true,
callSiteAccessKind: CallSiteAccessKind.getterInvocation);
@@ -5741,6 +5798,50 @@
rhsType, replacement, nullAwareGuards);
}
+ ExpressionInferenceResult visitAugmentSuperSet(
+ AugmentSuperSet node, DartType typeContext) {
+ Member member = node.target;
+ if (member.isInstanceMember) {
+ Expression receiver = new ThisExpression()..fileOffset = node.fileOffset;
+ DartType receiverType = thisType!;
+
+ ObjectAccessTarget target = new ObjectAccessTarget.interfaceMember(member,
+ isPotentiallyNullable: false);
+ if (target.isInstanceMember || target.isObjectMember) {
+ if (instrumentation != null && receiverType == const DynamicType()) {
+ instrumentation!.record(uriForInstrumentation, node.fileOffset,
+ 'target', new InstrumentationValueForMember(target.member!));
+ }
+ }
+ DartType writeContext = getSetterType(target, receiverType);
+ ExpressionInferenceResult rhsResult =
+ inferExpression(node.value, writeContext, true, isVoidAllowed: true);
+ rhsResult = ensureAssignableResult(writeContext, rhsResult,
+ fileOffset: node.fileOffset, isVoidAllowed: writeContext is VoidType);
+ Expression rhs = rhsResult.expression;
+ DartType rhsType = rhsResult.inferredType;
+
+ Expression replacement = _computePropertySet(
+ node.fileOffset, receiver, receiverType, member.name, target, rhs,
+ valueType: rhsType, forEffect: node.forEffect);
+
+ return new ExpressionInferenceResult(rhsType, replacement);
+ } else {
+ // TODO(johnniwinther): Handle augmentation of field with inferred types.
+ TypeInferenceEngine.resolveInferenceNode(member, classHierarchy);
+ DartType writeContext = member.setterType;
+ ExpressionInferenceResult rhsResult =
+ inferExpression(node.value, writeContext, true, isVoidAllowed: true);
+ rhsResult = ensureAssignableResult(writeContext, rhsResult,
+ fileOffset: node.fileOffset, isVoidAllowed: writeContext is VoidType);
+ Expression rhs = rhsResult.expression;
+ StaticSet result = new StaticSet(member, rhs)
+ ..fileOffset = node.fileOffset;
+ DartType rhsType = rhsResult.inferredType;
+ return new ExpressionInferenceResult(rhsType, result);
+ }
+ }
+
ExpressionInferenceResult visitNullAwareIfNullSet(
NullAwareIfNullSet node, DartType typeContext) {
ExpressionInferenceResult receiverResult = inferNullAwareExpression(
@@ -5864,6 +5965,39 @@
return expressionInferenceResult;
}
+ ExpressionInferenceResult visitAugmentSuperGet(
+ AugmentSuperGet node, DartType typeContext) {
+ Member member = node.target;
+ if (member.isInstanceMember) {
+ ObjectAccessTarget target = new ObjectAccessTarget.interfaceMember(member,
+ isPotentiallyNullable: false);
+ Expression receiver = new ThisExpression()..fileOffset = node.fileOffset;
+ DartType receiverType = thisType!;
+
+ PropertyGetInferenceResult propertyGetInferenceResult =
+ _computePropertyGet(
+ node.fileOffset, receiver, receiverType, member.name, typeContext,
+ isThisReceiver: true, readTarget: target);
+ ExpressionInferenceResult readResult =
+ propertyGetInferenceResult.expressionInferenceResult;
+ return new ExpressionInferenceResult(
+ readResult.inferredType, readResult.expression);
+ } else {
+ // TODO(johnniwinther): Handle augmentation of field with inferred types.
+ TypeInferenceEngine.resolveInferenceNode(member, classHierarchy);
+ DartType type = member.getterType;
+
+ if (member is Procedure && member.kind == ProcedureKind.Method) {
+ Expression tearOff = new StaticTearOff(node.target as Procedure)
+ ..fileOffset = node.fileOffset;
+ return instantiateTearOff(type, typeContext, tearOff);
+ } else {
+ return new ExpressionInferenceResult(
+ type, new StaticGet(member)..fileOffset = node.fileOffset);
+ }
+ }
+ }
+
@override
InitializerInferenceResult visitRedirectingInitializer(
RedirectingInitializer node) {
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 68129b6..bb686bf 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -3877,14 +3877,14 @@
{required bool isExpressionInvocation,
required bool isImplicitCall,
Name? implicitInvocationPropertyName,
- List<VariableDeclaration>? hoistedExpressions}) {
+ List<VariableDeclaration>? hoistedExpressions,
+ ObjectAccessTarget? target}) {
// ignore: unnecessary_null_comparison
assert(isExpressionInvocation != null);
// ignore: unnecessary_null_comparison
assert(isImplicitCall != null);
- ObjectAccessTarget target = findInterfaceMember(
- receiverType, name, fileOffset,
+ target ??= findInterfaceMember(receiverType, name, fileOffset,
instrumented: true,
includeExtensionMethods: true,
callSiteAccessKind: CallSiteAccessKind.methodInvocation);
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 112db68..4ff2181 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -655,6 +655,12 @@
NeverValueWarning/analyzerCode: Fail
NeverValueWarning/example: Fail
NewAsSelector/analyzerCode: Fail
+NoAugmentSuperInvokeTarget/analyzerCode: Fail
+NoAugmentSuperInvokeTarget/example: Fail
+NoAugmentSuperReadTarget/analyzerCode: Fail
+NoAugmentSuperReadTarget/example: Fail
+NoAugmentSuperWriteTarget/analyzerCode: Fail
+NoAugmentSuperWriteTarget/example: Fail
NoFormals/example: Fail
NoSuchNamedParameter/example: Fail
NoUnnamedConstructorInObject/analyzerCode: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 0939eac..ce469c1 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -5647,3 +5647,12 @@
MixinApplicationNoConcreteMemberContext:
problemMessage: "This is the super-access that doesn't have a concrete target."
severity: CONTEXT
+
+NoAugmentSuperReadTarget:
+ problemMessage: "Cannot read from 'augment super'."
+
+NoAugmentSuperWriteTarget:
+ problemMessage: "Cannot write to 'augment super'."
+
+NoAugmentSuperInvokeTarget:
+ problemMessage: "Cannot call 'augment super'."
diff --git a/pkg/front_end/testcases/macros/augment_concrete.dart b/pkg/front_end/testcases/macros/augment_concrete.dart
index 821e483..e2a8250 100644
--- a/pkg/front_end/testcases/macros/augment_concrete.dart
+++ b/pkg/front_end/testcases/macros/augment_concrete.dart
@@ -27,5 +27,6 @@
topLevelMethod();
new Class().instanceMethod();
Class.staticMethod();
+ externalTopLevelMethod();
new Class().externalInstanceMethod();
}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/macros/augment_concrete.dart.strong.expect b/pkg/front_end/testcases/macros/augment_concrete.dart.strong.expect
index 83a035a..0beaa60 100644
--- a/pkg/front_end/testcases/macros/augment_concrete.dart.strong.expect
+++ b/pkg/front_end/testcases/macros/augment_concrete.dart.strong.expect
@@ -10,10 +10,14 @@
: super core::Object::•()
;
method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ instanceMethod() → void {
+ this.{self::Class::_#instanceMethod#augment1}(){() → void};
core::print("instanceMethod augmentation 2");
+ this.{self::Class::_#instanceMethod#augment1}(){() → void};
}
static method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ staticMethod() → void {
+ self::Class::_#staticMethod#augment1();
core::print("staticMethod augmentation 2");
+ self::Class::_#staticMethod#augment1();
}
method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ externalInstanceMethod() → void {
core::print("externalInstanceMethod augmentation 2");
@@ -22,17 +26,23 @@
core::print("instanceMethod original");
}
method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#instanceMethod#augment1() → void {
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
core::print("instanceMethod augmentation 1");
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
}
static method _#staticMethod#augment0() → void {
core::print("staticMethod original");
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#staticMethod#augment1() → void {
+ self::Class::_#staticMethod#augment0();
core::print("staticMethod augmentation 1");
+ self::Class::_#staticMethod#augment0();
}
}
static method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ topLevelMethod() → void {
+ self::_#topLevelMethod#augment1();
core::print("topLevelMethod augmentation 2");
+ self::_#topLevelMethod#augment1();
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ externalTopLevelMethod() → void {
core::print("externalTopLevelMethod augmentation 1");
@@ -41,11 +51,14 @@
self::topLevelMethod();
new self::Class::•().{self::Class::instanceMethod}(){() → void};
self::Class::staticMethod();
+ self::externalTopLevelMethod();
new self::Class::•().{self::Class::externalInstanceMethod}(){() → void};
}
static method _#topLevelMethod#augment0() → void {
core::print("topLevelMethod original");
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#topLevelMethod#augment1() → void {
+ self::_#topLevelMethod#augment0();
core::print("topLevelMethod augmentation 1");
+ self::_#topLevelMethod#augment0();
}
diff --git a/pkg/front_end/testcases/macros/augment_concrete.dart.strong.transformed.expect b/pkg/front_end/testcases/macros/augment_concrete.dart.strong.transformed.expect
index 83a035a..0beaa60 100644
--- a/pkg/front_end/testcases/macros/augment_concrete.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/macros/augment_concrete.dart.strong.transformed.expect
@@ -10,10 +10,14 @@
: super core::Object::•()
;
method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ instanceMethod() → void {
+ this.{self::Class::_#instanceMethod#augment1}(){() → void};
core::print("instanceMethod augmentation 2");
+ this.{self::Class::_#instanceMethod#augment1}(){() → void};
}
static method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ staticMethod() → void {
+ self::Class::_#staticMethod#augment1();
core::print("staticMethod augmentation 2");
+ self::Class::_#staticMethod#augment1();
}
method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ externalInstanceMethod() → void {
core::print("externalInstanceMethod augmentation 2");
@@ -22,17 +26,23 @@
core::print("instanceMethod original");
}
method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#instanceMethod#augment1() → void {
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
core::print("instanceMethod augmentation 1");
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
}
static method _#staticMethod#augment0() → void {
core::print("staticMethod original");
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#staticMethod#augment1() → void {
+ self::Class::_#staticMethod#augment0();
core::print("staticMethod augmentation 1");
+ self::Class::_#staticMethod#augment0();
}
}
static method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ topLevelMethod() → void {
+ self::_#topLevelMethod#augment1();
core::print("topLevelMethod augmentation 2");
+ self::_#topLevelMethod#augment1();
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ externalTopLevelMethod() → void {
core::print("externalTopLevelMethod augmentation 1");
@@ -41,11 +51,14 @@
self::topLevelMethod();
new self::Class::•().{self::Class::instanceMethod}(){() → void};
self::Class::staticMethod();
+ self::externalTopLevelMethod();
new self::Class::•().{self::Class::externalInstanceMethod}(){() → void};
}
static method _#topLevelMethod#augment0() → void {
core::print("topLevelMethod original");
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#topLevelMethod#augment1() → void {
+ self::_#topLevelMethod#augment0();
core::print("topLevelMethod augmentation 1");
+ self::_#topLevelMethod#augment0();
}
diff --git a/pkg/front_end/testcases/macros/augment_concrete.dart.weak.expect b/pkg/front_end/testcases/macros/augment_concrete.dart.weak.expect
index 83a035a..0beaa60 100644
--- a/pkg/front_end/testcases/macros/augment_concrete.dart.weak.expect
+++ b/pkg/front_end/testcases/macros/augment_concrete.dart.weak.expect
@@ -10,10 +10,14 @@
: super core::Object::•()
;
method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ instanceMethod() → void {
+ this.{self::Class::_#instanceMethod#augment1}(){() → void};
core::print("instanceMethod augmentation 2");
+ this.{self::Class::_#instanceMethod#augment1}(){() → void};
}
static method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ staticMethod() → void {
+ self::Class::_#staticMethod#augment1();
core::print("staticMethod augmentation 2");
+ self::Class::_#staticMethod#augment1();
}
method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ externalInstanceMethod() → void {
core::print("externalInstanceMethod augmentation 2");
@@ -22,17 +26,23 @@
core::print("instanceMethod original");
}
method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#instanceMethod#augment1() → void {
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
core::print("instanceMethod augmentation 1");
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
}
static method _#staticMethod#augment0() → void {
core::print("staticMethod original");
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#staticMethod#augment1() → void {
+ self::Class::_#staticMethod#augment0();
core::print("staticMethod augmentation 1");
+ self::Class::_#staticMethod#augment0();
}
}
static method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ topLevelMethod() → void {
+ self::_#topLevelMethod#augment1();
core::print("topLevelMethod augmentation 2");
+ self::_#topLevelMethod#augment1();
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ externalTopLevelMethod() → void {
core::print("externalTopLevelMethod augmentation 1");
@@ -41,11 +51,14 @@
self::topLevelMethod();
new self::Class::•().{self::Class::instanceMethod}(){() → void};
self::Class::staticMethod();
+ self::externalTopLevelMethod();
new self::Class::•().{self::Class::externalInstanceMethod}(){() → void};
}
static method _#topLevelMethod#augment0() → void {
core::print("topLevelMethod original");
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#topLevelMethod#augment1() → void {
+ self::_#topLevelMethod#augment0();
core::print("topLevelMethod augmentation 1");
+ self::_#topLevelMethod#augment0();
}
diff --git a/pkg/front_end/testcases/macros/augment_concrete.dart.weak.modular.expect b/pkg/front_end/testcases/macros/augment_concrete.dart.weak.modular.expect
index 83a035a..0beaa60 100644
--- a/pkg/front_end/testcases/macros/augment_concrete.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/macros/augment_concrete.dart.weak.modular.expect
@@ -10,10 +10,14 @@
: super core::Object::•()
;
method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ instanceMethod() → void {
+ this.{self::Class::_#instanceMethod#augment1}(){() → void};
core::print("instanceMethod augmentation 2");
+ this.{self::Class::_#instanceMethod#augment1}(){() → void};
}
static method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ staticMethod() → void {
+ self::Class::_#staticMethod#augment1();
core::print("staticMethod augmentation 2");
+ self::Class::_#staticMethod#augment1();
}
method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ externalInstanceMethod() → void {
core::print("externalInstanceMethod augmentation 2");
@@ -22,17 +26,23 @@
core::print("instanceMethod original");
}
method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#instanceMethod#augment1() → void {
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
core::print("instanceMethod augmentation 1");
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
}
static method _#staticMethod#augment0() → void {
core::print("staticMethod original");
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#staticMethod#augment1() → void {
+ self::Class::_#staticMethod#augment0();
core::print("staticMethod augmentation 1");
+ self::Class::_#staticMethod#augment0();
}
}
static method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ topLevelMethod() → void {
+ self::_#topLevelMethod#augment1();
core::print("topLevelMethod augmentation 2");
+ self::_#topLevelMethod#augment1();
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ externalTopLevelMethod() → void {
core::print("externalTopLevelMethod augmentation 1");
@@ -41,11 +51,14 @@
self::topLevelMethod();
new self::Class::•().{self::Class::instanceMethod}(){() → void};
self::Class::staticMethod();
+ self::externalTopLevelMethod();
new self::Class::•().{self::Class::externalInstanceMethod}(){() → void};
}
static method _#topLevelMethod#augment0() → void {
core::print("topLevelMethod original");
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#topLevelMethod#augment1() → void {
+ self::_#topLevelMethod#augment0();
core::print("topLevelMethod augmentation 1");
+ self::_#topLevelMethod#augment0();
}
diff --git a/pkg/front_end/testcases/macros/augment_concrete.dart.weak.transformed.expect b/pkg/front_end/testcases/macros/augment_concrete.dart.weak.transformed.expect
index 83a035a..0beaa60 100644
--- a/pkg/front_end/testcases/macros/augment_concrete.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/macros/augment_concrete.dart.weak.transformed.expect
@@ -10,10 +10,14 @@
: super core::Object::•()
;
method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ instanceMethod() → void {
+ this.{self::Class::_#instanceMethod#augment1}(){() → void};
core::print("instanceMethod augmentation 2");
+ this.{self::Class::_#instanceMethod#augment1}(){() → void};
}
static method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ staticMethod() → void {
+ self::Class::_#staticMethod#augment1();
core::print("staticMethod augmentation 2");
+ self::Class::_#staticMethod#augment1();
}
method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ externalInstanceMethod() → void {
core::print("externalInstanceMethod augmentation 2");
@@ -22,17 +26,23 @@
core::print("instanceMethod original");
}
method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#instanceMethod#augment1() → void {
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
core::print("instanceMethod augmentation 1");
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
}
static method _#staticMethod#augment0() → void {
core::print("staticMethod original");
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#staticMethod#augment1() → void {
+ self::Class::_#staticMethod#augment0();
core::print("staticMethod augmentation 1");
+ self::Class::_#staticMethod#augment0();
}
}
static method /* from org-dartlang-testcase:///augment_concrete_lib2.dart */ topLevelMethod() → void {
+ self::_#topLevelMethod#augment1();
core::print("topLevelMethod augmentation 2");
+ self::_#topLevelMethod#augment1();
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ externalTopLevelMethod() → void {
core::print("externalTopLevelMethod augmentation 1");
@@ -41,11 +51,14 @@
self::topLevelMethod();
new self::Class::•().{self::Class::instanceMethod}(){() → void};
self::Class::staticMethod();
+ self::externalTopLevelMethod();
new self::Class::•().{self::Class::externalInstanceMethod}(){() → void};
}
static method _#topLevelMethod#augment0() → void {
core::print("topLevelMethod original");
}
static method /* from org-dartlang-testcase:///augment_concrete_lib1.dart */ _#topLevelMethod#augment1() → void {
+ self::_#topLevelMethod#augment0();
core::print("topLevelMethod augmentation 1");
+ self::_#topLevelMethod#augment0();
}
diff --git a/pkg/front_end/testcases/macros/augment_concrete_lib1.dart b/pkg/front_end/testcases/macros/augment_concrete_lib1.dart
index e036435..bd7d76f 100644
--- a/pkg/front_end/testcases/macros/augment_concrete_lib1.dart
+++ b/pkg/front_end/testcases/macros/augment_concrete_lib1.dart
@@ -3,7 +3,9 @@
// BSD-style license that can be found in the LICENSE file.
augment void topLevelMethod() {
+ augment super();
print('topLevelMethod augmentation 1');
+ augment super();
}
augment void externalTopLevelMethod() {
@@ -12,10 +14,14 @@
augment class Class {
augment void instanceMethod() {
+ augment super();
print('instanceMethod augmentation 1');
+ augment super();
}
augment static void staticMethod() {
+ augment super();
print('staticMethod augmentation 1');
+ augment super();
}
}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/macros/augment_concrete_lib2.dart b/pkg/front_end/testcases/macros/augment_concrete_lib2.dart
index de1bc9b..c8773b1 100644
--- a/pkg/front_end/testcases/macros/augment_concrete_lib2.dart
+++ b/pkg/front_end/testcases/macros/augment_concrete_lib2.dart
@@ -3,16 +3,22 @@
// BSD-style license that can be found in the LICENSE file.
augment void topLevelMethod() {
+ augment super();
print('topLevelMethod augmentation 2');
+ augment super();
}
augment class Class {
augment void instanceMethod() {
+ augment super();
print('instanceMethod augmentation 2');
+ augment super();
}
augment static void staticMethod() {
+ augment super();
print('staticMethod augmentation 2');
+ augment super();
}
augment void externalInstanceMethod() {
diff --git a/pkg/front_end/testcases/macros/augment_super.dart b/pkg/front_end/testcases/macros/augment_super.dart
index ff7d4a8..267e840 100644
--- a/pkg/front_end/testcases/macros/augment_super.dart
+++ b/pkg/front_end/testcases/macros/augment_super.dart
@@ -8,12 +8,16 @@
void topLevelMethodErrors() {}
List<int> get topLevelProperty => [42];
void set topLevelProperty(List<int> value) {}
+List<int>? get nullableTopLevelProperty => [42];
+void set nullableTopLevelProperty(List<int>? value) {}
class Class {
void instanceMethod() {}
void instanceMethodErrors() {}
int get instanceProperty => 42;
void set instanceProperty(int value) {}
+ int? get nullableInstanceProperty => 42;
+ void set nullableInstanceProperty(int? value) {}
}
main() {}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.strong.expect b/pkg/front_end/testcases/macros/augment_super.dart.strong.expect
index fa16fcc..7942619 100644
--- a/pkg/front_end/testcases/macros/augment_super.dart.strong.expect
+++ b/pkg/front_end/testcases/macros/augment_super.dart.strong.expect
@@ -2,73 +2,93 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:10:3: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:12:3: Error: Undefined name 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
-// augment super = value;
-// ^
+// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: Cannot read from 'augment super'.
+// augment super; // Error
+// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: Cannot call 'augment super'.
+// augment super(); // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:40:3: Error: Cannot read from 'augment super'.
+// augment super ??= value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:44:3: Error: 'augment super' is only allowed in member augmentations.
// augment super(); // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:45:3: Error: 'augment super' is only allowed in member augmentations.
// augment super; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:27:3: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:46:3: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:47:3: Error: Undefined name 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:37:5: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:57:5: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:58:5: Error: The getter 'augment' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
-// augment super++;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:62:5: Error: Cannot write to 'augment super'.
+// augment super++; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
-// --augment super;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:63:7: Error: Cannot write to 'augment super'.
+// --augment super; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
-// augment super = value;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:64:5: Error: Cannot write to 'augment super'.
+// augment super += 1; // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:70:5: Error: Cannot read from 'augment super'.
+// augment super; // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:71:5: Error: Cannot call 'augment super'.
+// augment super(); // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:75:19: Error: Cannot write to 'augment super'.
+// augment super ??= 1; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:84:5: Error: 'augment super' is only allowed in member augmentations.
// augment super(); // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:85:5: Error: 'augment super' is only allowed in member augmentations.
// augment super; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:54:5: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:86:5: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:87:5: Error: The getter 'augment' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
// augment; // Error
@@ -84,86 +104,112 @@
: super core::Object::•()
;
method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethod() → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
+ this.{self::Class::_#instanceMethod#augment0}{() → void};
}
method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethodErrors() → void {
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:58:5: Error: The getter 'augment' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
augment; // Error
^^^^^^^" in this{<unresolved>}.augment;
}
get /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty() → core::int {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
- augment super++;
- ^" in null as{ForNonNullableByDefault} dynamic;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
- --augment super;
- ^" in null as{ForNonNullableByDefault} dynamic;
- return (null as{ForNonNullableByDefault} dynamic){dynamic}.unary-() as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:62:5: Error: Cannot write to 'augment super'.
+ augment super++; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:63:7: Error: Cannot write to 'augment super'.
+ --augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:64:5: Error: Cannot write to 'augment super'.
+ augment super += 1; // Error
+ ^";
+ return this.{self::Class::_#instanceProperty#augment0}{core::int}.{core::int::unary-}(){() → core::int};
}
set /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty(core::int value) → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
- augment super = value;
- ^";
+ this.{self::Class::_#instanceProperty#augment0} = value;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:70:5: Error: Cannot read from 'augment super'.
+ augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:71:5: Error: Cannot call 'augment super'.
+ augment super(); // Error
+ ^";
+ }
+ get /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableInstanceProperty() → core::int? {
+ this.{self::Class::_#nullableInstanceProperty#augment0}{core::int?} == null ?{invalid-type} invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:75:19: Error: Cannot write to 'augment super'.
+ augment super ??= 1; // Error
+ ^" : null;
+ return this.{self::Class::_#nullableInstanceProperty#augment0}{core::int?};
+ }
+ set /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableInstanceProperty(core::int? value) → void {
+ this.{self::Class::_#nullableInstanceProperty#augment0} = value;
}
method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedInstanceMethod() → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:84:5: Error: 'augment super' is only allowed in member augmentations.
augment super(); // Error
^^^^^^^";
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:85:5: Error: 'augment super' is only allowed in member augmentations.
augment super; // Error
^^^^^^^";
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:87:5: Error: The getter 'augment' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
augment; // Error
^^^^^^^" in this{<unresolved>}.augment;
}
method _#instanceMethod#augment0() → void {}
- method _#instanceMethodErrors#augment0() → void {}
get _#instanceProperty#augment0() → core::int
return 42;
+ get _#nullableInstanceProperty#augment0() → core::int?
+ return 42;
set _#instanceProperty#augment0(core::int value) → void {}
+ set _#nullableInstanceProperty#augment0(core::int? value) → void {}
}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethod() → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ self::_#topLevelMethod#augment0();
+ #C1;
}
static method topLevelMethodErrors() → void {}
static get /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty() → core::List<core::int> {
return block {
- final core::List<core::int> #t1 = <core::int>[];
- for (final has-declared-initializer dynamic #t2 in (null as{ForNonNullableByDefault} dynamic) as{TypeError,ForDynamic,ForNonNullableByDefault} core::Iterable<dynamic>) {
- final core::int #t3 = #t2 as{TypeError,ForNonNullableByDefault} core::int;
- #t1.{core::List::add}{Invariant}(#t3){(core::int) → void};
- }
- #t1.{core::List::add}{Invariant}((null as{ForNonNullableByDefault} dynamic){dynamic}.[](0) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int){(core::int) → void};
+ final core::List<core::int> #t1 = core::List::of<core::int>(self::_#topLevelProperty#augment0);
} =>#t1;
}
static set /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty(core::List<core::int> value) → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.[]=(0, value.{core::List::[]}(1){(core::int) → core::int});
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
- augment super = value;
- ^";
+ self::_#topLevelProperty#augment0 = value;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: Cannot read from 'augment super'.
+ augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: Cannot call 'augment super'.
+ augment super(); // Error
+ ^";
+}
+static get /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableTopLevelProperty() → core::List<core::int>? {
+ return <core::int>[];
+}
+static set /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableTopLevelProperty(core::List<core::int>? value) → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:40:3: Error: Cannot read from 'augment super'.
+ augment super ??= value;
+ ^" == null ?{invalid-type} self::_#nullableTopLevelProperty#augment0 = value : null;
}
static method main() → dynamic {}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethodError() → void {
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:12:3: Error: Undefined name 'augment'.
augment; // Error
^^^^^^^";
}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedTopLevelMethod() → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:44:3: Error: 'augment super' is only allowed in member augmentations.
augment super(); // Error
^^^^^^^";
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:45:3: Error: 'augment super' is only allowed in member augmentations.
augment super; // Error
^^^^^^^";
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:47:3: Error: Undefined name 'augment'.
augment; // Error
^^^^^^^";
}
@@ -171,3 +217,8 @@
static get _#topLevelProperty#augment0() → core::List<core::int>
return <core::int>[42];
static set _#topLevelProperty#augment0(core::List<core::int> value) → void {}
+static set _#nullableTopLevelProperty#augment0(core::List<core::int>? value) → void {}
+
+constants {
+ #C1 = static-tearoff self::_#topLevelMethod#augment0
+}
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.strong.transformed.expect b/pkg/front_end/testcases/macros/augment_super.dart.strong.transformed.expect
index 7334815..189ed4b 100644
--- a/pkg/front_end/testcases/macros/augment_super.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/macros/augment_super.dart.strong.transformed.expect
@@ -2,73 +2,93 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:10:3: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:12:3: Error: Undefined name 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
-// augment super = value;
-// ^
+// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: Cannot read from 'augment super'.
+// augment super; // Error
+// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: Cannot call 'augment super'.
+// augment super(); // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:40:3: Error: Cannot read from 'augment super'.
+// augment super ??= value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:44:3: Error: 'augment super' is only allowed in member augmentations.
// augment super(); // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:45:3: Error: 'augment super' is only allowed in member augmentations.
// augment super; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:27:3: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:46:3: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:47:3: Error: Undefined name 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:37:5: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:57:5: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:58:5: Error: The getter 'augment' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
-// augment super++;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:62:5: Error: Cannot write to 'augment super'.
+// augment super++; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
-// --augment super;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:63:7: Error: Cannot write to 'augment super'.
+// --augment super; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
-// augment super = value;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:64:5: Error: Cannot write to 'augment super'.
+// augment super += 1; // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:70:5: Error: Cannot read from 'augment super'.
+// augment super; // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:71:5: Error: Cannot call 'augment super'.
+// augment super(); // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:75:19: Error: Cannot write to 'augment super'.
+// augment super ??= 1; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:84:5: Error: 'augment super' is only allowed in member augmentations.
// augment super(); // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:85:5: Error: 'augment super' is only allowed in member augmentations.
// augment super; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:54:5: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:86:5: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:87:5: Error: The getter 'augment' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
// augment; // Error
@@ -84,92 +104,112 @@
: super core::Object::•()
;
method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethod() → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
+ this.{self::Class::_#instanceMethod#augment0}{() → void};
}
method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethodErrors() → void {
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:58:5: Error: The getter 'augment' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
augment; // Error
^^^^^^^" in this{<unresolved>}.augment;
}
get /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty() → core::int {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
- augment super++;
- ^" in null as{ForNonNullableByDefault} dynamic;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
- --augment super;
- ^" in null as{ForNonNullableByDefault} dynamic;
- return (null as{ForNonNullableByDefault} dynamic){dynamic}.unary-() as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:62:5: Error: Cannot write to 'augment super'.
+ augment super++; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:63:7: Error: Cannot write to 'augment super'.
+ --augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:64:5: Error: Cannot write to 'augment super'.
+ augment super += 1; // Error
+ ^";
+ return this.{self::Class::_#instanceProperty#augment0}{core::int}.{core::int::unary-}(){() → core::int};
}
set /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty(core::int value) → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
- augment super = value;
- ^";
+ this.{self::Class::_#instanceProperty#augment0} = value;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:70:5: Error: Cannot read from 'augment super'.
+ augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:71:5: Error: Cannot call 'augment super'.
+ augment super(); // Error
+ ^";
+ }
+ get /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableInstanceProperty() → core::int? {
+ this.{self::Class::_#nullableInstanceProperty#augment0}{core::int?} == null ?{invalid-type} invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:75:19: Error: Cannot write to 'augment super'.
+ augment super ??= 1; // Error
+ ^" : null;
+ return this.{self::Class::_#nullableInstanceProperty#augment0}{core::int?};
+ }
+ set /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableInstanceProperty(core::int? value) → void {
+ this.{self::Class::_#nullableInstanceProperty#augment0} = value;
}
method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedInstanceMethod() → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:84:5: Error: 'augment super' is only allowed in member augmentations.
augment super(); // Error
^^^^^^^";
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:85:5: Error: 'augment super' is only allowed in member augmentations.
augment super; // Error
^^^^^^^";
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:87:5: Error: The getter 'augment' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
augment; // Error
^^^^^^^" in this{<unresolved>}.augment;
}
method _#instanceMethod#augment0() → void {}
- method _#instanceMethodErrors#augment0() → void {}
get _#instanceProperty#augment0() → core::int
return 42;
+ get _#nullableInstanceProperty#augment0() → core::int?
+ return 42;
set _#instanceProperty#augment0(core::int value) → void {}
+ set _#nullableInstanceProperty#augment0(core::int? value) → void {}
}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethod() → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ self::_#topLevelMethod#augment0();
+ #C1;
}
static method topLevelMethodErrors() → void {}
static get /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty() → core::List<core::int> {
return block {
- final core::List<core::int> #t1 = core::_GrowableList::•<core::int>(0);
- {
- core::Iterator<dynamic> :sync-for-iterator = ((null as{ForNonNullableByDefault} dynamic) as{TypeError,ForDynamic,ForNonNullableByDefault} core::Iterable<dynamic>).{core::Iterable::iterator}{core::Iterator<dynamic>};
- for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
- final dynamic #t2 = :sync-for-iterator.{core::Iterator::current}{dynamic};
- {
- final core::int #t3 = #t2 as{TypeError,ForNonNullableByDefault} core::int;
- #t1.{core::List::add}{Invariant}(#t3){(core::int) → void};
- }
- }
- }
- #t1.{core::List::add}{Invariant}((null as{ForNonNullableByDefault} dynamic){dynamic}.[](0) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int){(core::int) → void};
+ final core::List<core::int> #t1 = core::List::of<core::int>(self::_#topLevelProperty#augment0);
} =>#t1;
}
static set /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty(core::List<core::int> value) → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.[]=(0, value.{core::List::[]}(1){(core::int) → core::int});
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
- augment super = value;
- ^";
+ self::_#topLevelProperty#augment0 = value;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: Cannot read from 'augment super'.
+ augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: Cannot call 'augment super'.
+ augment super(); // Error
+ ^";
+}
+static get /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableTopLevelProperty() → core::List<core::int>? {
+ return core::_GrowableList::•<core::int>(0);
+}
+static set /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableTopLevelProperty(core::List<core::int>? value) → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:40:3: Error: Cannot read from 'augment super'.
+ augment super ??= value;
+ ^" == null ?{invalid-type} self::_#nullableTopLevelProperty#augment0 = value : null;
}
static method main() → dynamic {}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethodError() → void {
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:12:3: Error: Undefined name 'augment'.
augment; // Error
^^^^^^^";
}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedTopLevelMethod() → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:44:3: Error: 'augment super' is only allowed in member augmentations.
augment super(); // Error
^^^^^^^";
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:45:3: Error: 'augment super' is only allowed in member augmentations.
augment super; // Error
^^^^^^^";
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:47:3: Error: Undefined name 'augment'.
augment; // Error
^^^^^^^";
}
@@ -177,13 +217,8 @@
static get _#topLevelProperty#augment0() → core::List<core::int>
return core::_GrowableList::_literal1<core::int>(42);
static set _#topLevelProperty#augment0(core::List<core::int> value) → void {}
+static set _#nullableTopLevelProperty#augment0(core::List<core::int>? value) → void {}
-
-Extra constant evaluation status:
-Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:33:5 -> NullConstant(null)
-Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:44:13 -> NullConstant(null)
-Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:6:3 -> NullConstant(null)
-Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:16:15 -> NullConstant(null)
-Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:16:30 -> NullConstant(null)
-Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:20:3 -> NullConstant(null)
-Extra constant evaluation: evaluated: 32, effectively constant: 6
+constants {
+ #C1 = static-tearoff self::_#topLevelMethod#augment0
+}
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.textual_outline.expect b/pkg/front_end/testcases/macros/augment_super.dart.textual_outline.expect
index ba14962..5c5652e 100644
--- a/pkg/front_end/testcases/macros/augment_super.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/macros/augment_super.dart.textual_outline.expect
@@ -3,10 +3,14 @@
void topLevelMethodErrors() {}
List<int> get topLevelProperty => [42];
void set topLevelProperty(List<int> value) {}
+List<int>? get nullableTopLevelProperty => [42];
+void set nullableTopLevelProperty(List<int>? value) {}
class Class {
void instanceMethod() {}
void instanceMethodErrors() {}
int get instanceProperty => 42;
void set instanceProperty(int value) {}
+ int? get nullableInstanceProperty => 42;
+ void set nullableInstanceProperty(int? value) {}
}
main() {}
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.weak.expect b/pkg/front_end/testcases/macros/augment_super.dart.weak.expect
index fa16fcc..7942619 100644
--- a/pkg/front_end/testcases/macros/augment_super.dart.weak.expect
+++ b/pkg/front_end/testcases/macros/augment_super.dart.weak.expect
@@ -2,73 +2,93 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:10:3: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:12:3: Error: Undefined name 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
-// augment super = value;
-// ^
+// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: Cannot read from 'augment super'.
+// augment super; // Error
+// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: Cannot call 'augment super'.
+// augment super(); // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:40:3: Error: Cannot read from 'augment super'.
+// augment super ??= value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:44:3: Error: 'augment super' is only allowed in member augmentations.
// augment super(); // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:45:3: Error: 'augment super' is only allowed in member augmentations.
// augment super; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:27:3: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:46:3: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:47:3: Error: Undefined name 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:37:5: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:57:5: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:58:5: Error: The getter 'augment' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
-// augment super++;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:62:5: Error: Cannot write to 'augment super'.
+// augment super++; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
-// --augment super;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:63:7: Error: Cannot write to 'augment super'.
+// --augment super; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
-// augment super = value;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:64:5: Error: Cannot write to 'augment super'.
+// augment super += 1; // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:70:5: Error: Cannot read from 'augment super'.
+// augment super; // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:71:5: Error: Cannot call 'augment super'.
+// augment super(); // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:75:19: Error: Cannot write to 'augment super'.
+// augment super ??= 1; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:84:5: Error: 'augment super' is only allowed in member augmentations.
// augment super(); // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:85:5: Error: 'augment super' is only allowed in member augmentations.
// augment super; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:54:5: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:86:5: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:87:5: Error: The getter 'augment' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
// augment; // Error
@@ -84,86 +104,112 @@
: super core::Object::•()
;
method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethod() → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
+ this.{self::Class::_#instanceMethod#augment0}{() → void};
}
method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethodErrors() → void {
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:58:5: Error: The getter 'augment' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
augment; // Error
^^^^^^^" in this{<unresolved>}.augment;
}
get /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty() → core::int {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
- augment super++;
- ^" in null as{ForNonNullableByDefault} dynamic;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
- --augment super;
- ^" in null as{ForNonNullableByDefault} dynamic;
- return (null as{ForNonNullableByDefault} dynamic){dynamic}.unary-() as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:62:5: Error: Cannot write to 'augment super'.
+ augment super++; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:63:7: Error: Cannot write to 'augment super'.
+ --augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:64:5: Error: Cannot write to 'augment super'.
+ augment super += 1; // Error
+ ^";
+ return this.{self::Class::_#instanceProperty#augment0}{core::int}.{core::int::unary-}(){() → core::int};
}
set /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty(core::int value) → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
- augment super = value;
- ^";
+ this.{self::Class::_#instanceProperty#augment0} = value;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:70:5: Error: Cannot read from 'augment super'.
+ augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:71:5: Error: Cannot call 'augment super'.
+ augment super(); // Error
+ ^";
+ }
+ get /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableInstanceProperty() → core::int? {
+ this.{self::Class::_#nullableInstanceProperty#augment0}{core::int?} == null ?{invalid-type} invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:75:19: Error: Cannot write to 'augment super'.
+ augment super ??= 1; // Error
+ ^" : null;
+ return this.{self::Class::_#nullableInstanceProperty#augment0}{core::int?};
+ }
+ set /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableInstanceProperty(core::int? value) → void {
+ this.{self::Class::_#nullableInstanceProperty#augment0} = value;
}
method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedInstanceMethod() → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:84:5: Error: 'augment super' is only allowed in member augmentations.
augment super(); // Error
^^^^^^^";
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:85:5: Error: 'augment super' is only allowed in member augmentations.
augment super; // Error
^^^^^^^";
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:87:5: Error: The getter 'augment' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
augment; // Error
^^^^^^^" in this{<unresolved>}.augment;
}
method _#instanceMethod#augment0() → void {}
- method _#instanceMethodErrors#augment0() → void {}
get _#instanceProperty#augment0() → core::int
return 42;
+ get _#nullableInstanceProperty#augment0() → core::int?
+ return 42;
set _#instanceProperty#augment0(core::int value) → void {}
+ set _#nullableInstanceProperty#augment0(core::int? value) → void {}
}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethod() → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ self::_#topLevelMethod#augment0();
+ #C1;
}
static method topLevelMethodErrors() → void {}
static get /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty() → core::List<core::int> {
return block {
- final core::List<core::int> #t1 = <core::int>[];
- for (final has-declared-initializer dynamic #t2 in (null as{ForNonNullableByDefault} dynamic) as{TypeError,ForDynamic,ForNonNullableByDefault} core::Iterable<dynamic>) {
- final core::int #t3 = #t2 as{TypeError,ForNonNullableByDefault} core::int;
- #t1.{core::List::add}{Invariant}(#t3){(core::int) → void};
- }
- #t1.{core::List::add}{Invariant}((null as{ForNonNullableByDefault} dynamic){dynamic}.[](0) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int){(core::int) → void};
+ final core::List<core::int> #t1 = core::List::of<core::int>(self::_#topLevelProperty#augment0);
} =>#t1;
}
static set /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty(core::List<core::int> value) → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.[]=(0, value.{core::List::[]}(1){(core::int) → core::int});
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
- augment super = value;
- ^";
+ self::_#topLevelProperty#augment0 = value;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: Cannot read from 'augment super'.
+ augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: Cannot call 'augment super'.
+ augment super(); // Error
+ ^";
+}
+static get /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableTopLevelProperty() → core::List<core::int>? {
+ return <core::int>[];
+}
+static set /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableTopLevelProperty(core::List<core::int>? value) → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:40:3: Error: Cannot read from 'augment super'.
+ augment super ??= value;
+ ^" == null ?{invalid-type} self::_#nullableTopLevelProperty#augment0 = value : null;
}
static method main() → dynamic {}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethodError() → void {
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:12:3: Error: Undefined name 'augment'.
augment; // Error
^^^^^^^";
}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedTopLevelMethod() → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:44:3: Error: 'augment super' is only allowed in member augmentations.
augment super(); // Error
^^^^^^^";
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:45:3: Error: 'augment super' is only allowed in member augmentations.
augment super; // Error
^^^^^^^";
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:47:3: Error: Undefined name 'augment'.
augment; // Error
^^^^^^^";
}
@@ -171,3 +217,8 @@
static get _#topLevelProperty#augment0() → core::List<core::int>
return <core::int>[42];
static set _#topLevelProperty#augment0(core::List<core::int> value) → void {}
+static set _#nullableTopLevelProperty#augment0(core::List<core::int>? value) → void {}
+
+constants {
+ #C1 = static-tearoff self::_#topLevelMethod#augment0
+}
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.weak.modular.expect b/pkg/front_end/testcases/macros/augment_super.dart.weak.modular.expect
index fa16fcc..7942619 100644
--- a/pkg/front_end/testcases/macros/augment_super.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/macros/augment_super.dart.weak.modular.expect
@@ -2,73 +2,93 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:10:3: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:12:3: Error: Undefined name 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
-// augment super = value;
-// ^
+// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: Cannot read from 'augment super'.
+// augment super; // Error
+// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: Cannot call 'augment super'.
+// augment super(); // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:40:3: Error: Cannot read from 'augment super'.
+// augment super ??= value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:44:3: Error: 'augment super' is only allowed in member augmentations.
// augment super(); // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:45:3: Error: 'augment super' is only allowed in member augmentations.
// augment super; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:27:3: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:46:3: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:47:3: Error: Undefined name 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:37:5: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:57:5: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:58:5: Error: The getter 'augment' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
-// augment super++;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:62:5: Error: Cannot write to 'augment super'.
+// augment super++; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
-// --augment super;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:63:7: Error: Cannot write to 'augment super'.
+// --augment super; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
-// augment super = value;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:64:5: Error: Cannot write to 'augment super'.
+// augment super += 1; // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:70:5: Error: Cannot read from 'augment super'.
+// augment super; // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:71:5: Error: Cannot call 'augment super'.
+// augment super(); // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:75:19: Error: Cannot write to 'augment super'.
+// augment super ??= 1; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:84:5: Error: 'augment super' is only allowed in member augmentations.
// augment super(); // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:85:5: Error: 'augment super' is only allowed in member augmentations.
// augment super; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:54:5: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:86:5: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:87:5: Error: The getter 'augment' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
// augment; // Error
@@ -84,86 +104,112 @@
: super core::Object::•()
;
method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethod() → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
+ this.{self::Class::_#instanceMethod#augment0}{() → void};
}
method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethodErrors() → void {
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:58:5: Error: The getter 'augment' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
augment; // Error
^^^^^^^" in this{<unresolved>}.augment;
}
get /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty() → core::int {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
- augment super++;
- ^" in null as{ForNonNullableByDefault} dynamic;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
- --augment super;
- ^" in null as{ForNonNullableByDefault} dynamic;
- return (null as{ForNonNullableByDefault} dynamic){dynamic}.unary-() as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:62:5: Error: Cannot write to 'augment super'.
+ augment super++; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:63:7: Error: Cannot write to 'augment super'.
+ --augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:64:5: Error: Cannot write to 'augment super'.
+ augment super += 1; // Error
+ ^";
+ return this.{self::Class::_#instanceProperty#augment0}{core::int}.{core::int::unary-}(){() → core::int};
}
set /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty(core::int value) → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
- augment super = value;
- ^";
+ this.{self::Class::_#instanceProperty#augment0} = value;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:70:5: Error: Cannot read from 'augment super'.
+ augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:71:5: Error: Cannot call 'augment super'.
+ augment super(); // Error
+ ^";
+ }
+ get /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableInstanceProperty() → core::int? {
+ this.{self::Class::_#nullableInstanceProperty#augment0}{core::int?} == null ?{invalid-type} invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:75:19: Error: Cannot write to 'augment super'.
+ augment super ??= 1; // Error
+ ^" : null;
+ return this.{self::Class::_#nullableInstanceProperty#augment0}{core::int?};
+ }
+ set /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableInstanceProperty(core::int? value) → void {
+ this.{self::Class::_#nullableInstanceProperty#augment0} = value;
}
method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedInstanceMethod() → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:84:5: Error: 'augment super' is only allowed in member augmentations.
augment super(); // Error
^^^^^^^";
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:85:5: Error: 'augment super' is only allowed in member augmentations.
augment super; // Error
^^^^^^^";
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:87:5: Error: The getter 'augment' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
augment; // Error
^^^^^^^" in this{<unresolved>}.augment;
}
method _#instanceMethod#augment0() → void {}
- method _#instanceMethodErrors#augment0() → void {}
get _#instanceProperty#augment0() → core::int
return 42;
+ get _#nullableInstanceProperty#augment0() → core::int?
+ return 42;
set _#instanceProperty#augment0(core::int value) → void {}
+ set _#nullableInstanceProperty#augment0(core::int? value) → void {}
}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethod() → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ self::_#topLevelMethod#augment0();
+ #C1;
}
static method topLevelMethodErrors() → void {}
static get /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty() → core::List<core::int> {
return block {
- final core::List<core::int> #t1 = <core::int>[];
- for (final has-declared-initializer dynamic #t2 in (null as{ForNonNullableByDefault} dynamic) as{TypeError,ForDynamic,ForNonNullableByDefault} core::Iterable<dynamic>) {
- final core::int #t3 = #t2 as{TypeError,ForNonNullableByDefault} core::int;
- #t1.{core::List::add}{Invariant}(#t3){(core::int) → void};
- }
- #t1.{core::List::add}{Invariant}((null as{ForNonNullableByDefault} dynamic){dynamic}.[](0) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int){(core::int) → void};
+ final core::List<core::int> #t1 = core::List::of<core::int>(self::_#topLevelProperty#augment0);
} =>#t1;
}
static set /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty(core::List<core::int> value) → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.[]=(0, value.{core::List::[]}(1){(core::int) → core::int});
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
- augment super = value;
- ^";
+ self::_#topLevelProperty#augment0 = value;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: Cannot read from 'augment super'.
+ augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: Cannot call 'augment super'.
+ augment super(); // Error
+ ^";
+}
+static get /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableTopLevelProperty() → core::List<core::int>? {
+ return <core::int>[];
+}
+static set /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableTopLevelProperty(core::List<core::int>? value) → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:40:3: Error: Cannot read from 'augment super'.
+ augment super ??= value;
+ ^" == null ?{invalid-type} self::_#nullableTopLevelProperty#augment0 = value : null;
}
static method main() → dynamic {}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethodError() → void {
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:12:3: Error: Undefined name 'augment'.
augment; // Error
^^^^^^^";
}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedTopLevelMethod() → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:44:3: Error: 'augment super' is only allowed in member augmentations.
augment super(); // Error
^^^^^^^";
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:45:3: Error: 'augment super' is only allowed in member augmentations.
augment super; // Error
^^^^^^^";
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:47:3: Error: Undefined name 'augment'.
augment; // Error
^^^^^^^";
}
@@ -171,3 +217,8 @@
static get _#topLevelProperty#augment0() → core::List<core::int>
return <core::int>[42];
static set _#topLevelProperty#augment0(core::List<core::int> value) → void {}
+static set _#nullableTopLevelProperty#augment0(core::List<core::int>? value) → void {}
+
+constants {
+ #C1 = static-tearoff self::_#topLevelMethod#augment0
+}
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.weak.outline.expect b/pkg/front_end/testcases/macros/augment_super.dart.weak.outline.expect
index ac6c7af..28518f4 100644
--- a/pkg/front_end/testcases/macros/augment_super.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/macros/augment_super.dart.weak.outline.expect
@@ -15,6 +15,10 @@
;
set instanceProperty(core::int value) → void
;
+ get nullableInstanceProperty() → core::int?
+ ;
+ set nullableInstanceProperty(core::int? value) → void
+ ;
method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedInstanceMethod() → void
;
}
@@ -26,6 +30,10 @@
;
static set topLevelProperty(core::List<core::int> value) → void
;
+static get nullableTopLevelProperty() → core::List<core::int>?
+ ;
+static set nullableTopLevelProperty(core::List<core::int>? value) → void
+ ;
static method main() → dynamic
;
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethodError() → void
diff --git a/pkg/front_end/testcases/macros/augment_super.dart.weak.transformed.expect b/pkg/front_end/testcases/macros/augment_super.dart.weak.transformed.expect
index c063461..189ed4b 100644
--- a/pkg/front_end/testcases/macros/augment_super.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/macros/augment_super.dart.weak.transformed.expect
@@ -2,73 +2,93 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:10:3: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:12:3: Error: Undefined name 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
-// augment super = value;
-// ^
+// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: Cannot read from 'augment super'.
+// augment super; // Error
+// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: Cannot call 'augment super'.
+// augment super(); // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:40:3: Error: Cannot read from 'augment super'.
+// augment super ??= value;
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:44:3: Error: 'augment super' is only allowed in member augmentations.
// augment super(); // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:45:3: Error: 'augment super' is only allowed in member augmentations.
// augment super; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:27:3: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:46:3: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:47:3: Error: Undefined name 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:37:5: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:57:5: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:58:5: Error: The getter 'augment' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
// augment; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
-// augment super++;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:62:5: Error: Cannot write to 'augment super'.
+// augment super++; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
-// --augment super;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:63:7: Error: Cannot write to 'augment super'.
+// --augment super; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
-// augment super = value;
+// pkg/front_end/testcases/macros/augment_super_lib.dart:64:5: Error: Cannot write to 'augment super'.
+// augment super += 1; // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:70:5: Error: Cannot read from 'augment super'.
+// augment super; // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:71:5: Error: Cannot call 'augment super'.
+// augment super(); // Error
+// ^
+//
+// pkg/front_end/testcases/macros/augment_super_lib.dart:75:19: Error: Cannot write to 'augment super'.
+// augment super ??= 1; // Error
// ^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:84:5: Error: 'augment super' is only allowed in member augmentations.
// augment super(); // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:85:5: Error: 'augment super' is only allowed in member augmentations.
// augment super; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:54:5: Error: Can't have modifier 'augment' here.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:86:5: Error: Can't have modifier 'augment' here.
// Try removing 'augment'.
// augment int local; // Error
// ^^^^^^^
//
-// pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+// pkg/front_end/testcases/macros/augment_super_lib.dart:87:5: Error: The getter 'augment' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
// augment; // Error
@@ -84,92 +104,112 @@
: super core::Object::•()
;
method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethod() → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ this.{self::Class::_#instanceMethod#augment0}(){() → void};
+ this.{self::Class::_#instanceMethod#augment0}{() → void};
}
method /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceMethodErrors() → void {
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:38:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:58:5: Error: The getter 'augment' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
augment; // Error
^^^^^^^" in this{<unresolved>}.augment;
}
get /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty() → core::int {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:42:5: Error: Can't assign to this.
- augment super++;
- ^" in null as{ForNonNullableByDefault} dynamic;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:43:7: Error: Can't assign to this.
- --augment super;
- ^" in null as{ForNonNullableByDefault} dynamic;
- return (null as{ForNonNullableByDefault} dynamic){dynamic}.unary-() as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:62:5: Error: Cannot write to 'augment super'.
+ augment super++; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:63:7: Error: Cannot write to 'augment super'.
+ --augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:64:5: Error: Cannot write to 'augment super'.
+ augment super += 1; // Error
+ ^";
+ return this.{self::Class::_#instanceProperty#augment0}{core::int}.{core::int::unary-}(){() → core::int};
}
set /* from org-dartlang-testcase:///augment_super_lib.dart */ instanceProperty(core::int value) → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:48:19: Error: Can't assign to this.
- augment super = value;
- ^";
+ this.{self::Class::_#instanceProperty#augment0} = value;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:70:5: Error: Cannot read from 'augment super'.
+ augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:71:5: Error: Cannot call 'augment super'.
+ augment super(); // Error
+ ^";
+ }
+ get /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableInstanceProperty() → core::int? {
+ this.{self::Class::_#nullableInstanceProperty#augment0}{core::int?} == null ?{invalid-type} invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:75:19: Error: Cannot write to 'augment super'.
+ augment super ??= 1; // Error
+ ^" : null;
+ return this.{self::Class::_#nullableInstanceProperty#augment0}{core::int?};
+ }
+ set /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableInstanceProperty(core::int? value) → void {
+ this.{self::Class::_#nullableInstanceProperty#augment0} = value;
}
method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedInstanceMethod() → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:52:5: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:84:5: Error: 'augment super' is only allowed in member augmentations.
augment super(); // Error
^^^^^^^";
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:53:5: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:85:5: Error: 'augment super' is only allowed in member augmentations.
augment super; // Error
^^^^^^^";
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:55:5: Error: The getter 'augment' isn't defined for the class 'Class'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:87:5: Error: The getter 'augment' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/macros/augment_super.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'augment'.
augment; // Error
^^^^^^^" in this{<unresolved>}.augment;
}
method _#instanceMethod#augment0() → void {}
- method _#instanceMethodErrors#augment0() → void {}
get _#instanceProperty#augment0() → core::int
return 42;
+ get _#nullableInstanceProperty#augment0() → core::int?
+ return 42;
set _#instanceProperty#augment0(core::int value) → void {}
+ set _#nullableInstanceProperty#augment0(core::int? value) → void {}
}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethod() → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.call();
+ self::_#topLevelMethod#augment0();
+ #C1;
}
static method topLevelMethodErrors() → void {}
static get /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty() → core::List<core::int> {
return block {
- final core::List<core::int> #t1 = core::_GrowableList::•<core::int>(0);
- {
- core::Iterator<dynamic> :sync-for-iterator = ((null as{ForNonNullableByDefault} dynamic) as{TypeError,ForDynamic,ForNonNullableByDefault} core::Iterable<dynamic>).{core::Iterable::iterator}{core::Iterator<dynamic>};
- for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
- final dynamic #t2 = :sync-for-iterator.{core::Iterator::current}{dynamic};
- {
- final core::int #t3 = #t2 as{TypeError,ForNonNullableByDefault} core::int;
- #t1.{core::List::add}{Invariant}(#t3){(core::int) → void};
- }
- }
- }
- #t1.{core::List::add}{Invariant}((null as{ForNonNullableByDefault} dynamic){dynamic}.[](0) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int){(core::int) → void};
+ final core::List<core::int> #t1 = core::List::of<core::int>(self::_#topLevelProperty#augment0);
} =>#t1;
}
static set /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelProperty(core::List<core::int> value) → void {
- (null as{ForNonNullableByDefault} dynamic){dynamic}.[]=(0, value.{core::List::[]}(1){(core::int) → core::int});
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:21:17: Error: Can't assign to this.
- augment super = value;
- ^";
+ self::_#topLevelProperty#augment0 = value;
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: Cannot read from 'augment super'.
+ augment super; // Error
+ ^";
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: Cannot call 'augment super'.
+ augment super(); // Error
+ ^";
+}
+static get /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableTopLevelProperty() → core::List<core::int>? {
+ return core::_GrowableList::•<core::int>(0);
+}
+static set /* from org-dartlang-testcase:///augment_super_lib.dart */ nullableTopLevelProperty(core::List<core::int>? value) → void {
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:40:3: Error: Cannot read from 'augment super'.
+ augment super ??= value;
+ ^" == null ?{invalid-type} self::_#nullableTopLevelProperty#augment0 = value : null;
}
static method main() → dynamic {}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ topLevelMethodError() → void {
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:11:3: Error: Undefined name 'augment'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:12:3: Error: Undefined name 'augment'.
augment; // Error
^^^^^^^";
}
static method /* from org-dartlang-testcase:///augment_super_lib.dart */ injectedTopLevelMethod() → void {
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:25:3: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:44:3: Error: 'augment super' is only allowed in member augmentations.
augment super(); // Error
^^^^^^^";
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:26:3: Error: 'augment super' is only allowed in member augmentations.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:45:3: Error: 'augment super' is only allowed in member augmentations.
augment super; // Error
^^^^^^^";
core::int local;
- invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:28:3: Error: Undefined name 'augment'.
+ invalid-expression "pkg/front_end/testcases/macros/augment_super_lib.dart:47:3: Error: Undefined name 'augment'.
augment; // Error
^^^^^^^";
}
@@ -177,13 +217,8 @@
static get _#topLevelProperty#augment0() → core::List<core::int>
return core::_GrowableList::_literal1<core::int>(42);
static set _#topLevelProperty#augment0(core::List<core::int> value) → void {}
+static set _#nullableTopLevelProperty#augment0(core::List<core::int>? value) → void {}
-
-Extra constant evaluation status:
-Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:33:5 -> NullConstant(null)
-Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:44:13 -> NullConstant(null)
-Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:6:3 -> NullConstant(null)
-Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:16:15 -> NullConstant(null)
-Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:16:30 -> NullConstant(null)
-Evaluated: AsExpression @ org-dartlang-testcase:///augment_super_lib.dart:20:3 -> NullConstant(null)
-Extra constant evaluation: evaluated: 31, effectively constant: 6
+constants {
+ #C1 = static-tearoff self::_#topLevelMethod#augment0
+}
diff --git a/pkg/front_end/testcases/macros/augment_super_lib.dart b/pkg/front_end/testcases/macros/augment_super_lib.dart
index 4922d49..4a26be6 100644
--- a/pkg/front_end/testcases/macros/augment_super_lib.dart
+++ b/pkg/front_end/testcases/macros/augment_super_lib.dart
@@ -4,6 +4,7 @@
augment void topLevelMethod() {
augment super();
+ augment super;
}
augment void topLevelMethodError() {
@@ -11,14 +12,32 @@
augment; // Error
}
-
augment List<int> get topLevelProperty {
- return [... augment super, augment super[0]];
+ return [... augment super,
+ // TODO(johnniwinther): Support indexed access.
+ /*augment super[0]*/];
}
augment void set topLevelProperty(List<int> value) {
- augment super[0] = value[1];
+ // TODO(johnniwinther): Support indexed access.
+ //augment super[0] = value[1];
augment super = value;
+ augment super; // Error
+ augment super(); // Error
+}
+
+augment List<int>? get nullableTopLevelProperty {
+ return [
+ // TODO(johnniwinther): Support this syntax.
+ /*... ?augment super,*/
+ // TODO(johnniwinther): Support indexed access.
+ /*augment super?[0]*/];
+}
+
+augment void set nullableTopLevelProperty(List<int>? value) {
+ // TODO(johnniwinther): Support indexed access.
+ //augment super?[0] = value?[1];
+ augment super ??= value;
}
void injectedTopLevelMethod() {
@@ -31,6 +50,7 @@
augment class Class {
augment void instanceMethod() {
augment super();
+ augment super; // Error
}
augment void instanceMethodErrors() {
@@ -39,13 +59,25 @@
}
augment int get instanceProperty {
- augment super++;
- --augment super;
+ augment super++; // Error
+ --augment super; // Error
+ augment super += 1; // Error
return -augment super;
}
augment void set instanceProperty(int value) {
augment super = value;
+ augment super; // Error
+ augment super(); // Error
+ }
+
+ augment int? get nullableInstanceProperty {
+ augment super ??= 1; // Error
+ return augment super;
+ }
+
+ augment void set nullableInstanceProperty(int? value) {
+ augment super = value;
}
void injectedInstanceMethod() {
diff --git a/pkg/front_end/testcases/macros/extend_augmented.dart b/pkg/front_end/testcases/macros/extend_augmented.dart
new file mode 100644
index 0000000..00194fc
--- /dev/null
+++ b/pkg/front_end/testcases/macros/extend_augmented.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2022, 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.
+
+import augment 'extend_augmented_lib.dart';
+
+class Class {
+ void augmentedMethod() {}
+}
+
+class Subclass implements Class {
+ void augmentedMethod() {}
+}
+
+main() {
+ new Class().augmentedMethod();
+ new Subclass().augmentedMethod();
+}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/macros/extend_augmented.dart.strong.expect b/pkg/front_end/testcases/macros/extend_augmented.dart.strong.expect
new file mode 100644
index 0000000..2d9979f
--- /dev/null
+++ b/pkg/front_end/testcases/macros/extend_augmented.dart.strong.expect
@@ -0,0 +1,25 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///extend_augmented.dart";
+
+class Class extends core::Object {
+ synthetic constructor •() → self::Class
+ : super core::Object::•()
+ ;
+ method /* from org-dartlang-testcase:///extend_augmented_lib.dart */ augmentedMethod() → void {
+ this.{self::Class::_#augmentedMethod#augment0}(){() → void};
+ }
+ method _#augmentedMethod#augment0() → void {}
+}
+class Subclass extends core::Object implements self::Class {
+ synthetic constructor •() → self::Subclass
+ : super core::Object::•()
+ ;
+ method augmentedMethod() → void {}
+}
+static method main() → dynamic {
+ new self::Class::•().{self::Class::augmentedMethod}(){() → void};
+ new self::Subclass::•().{self::Subclass::augmentedMethod}(){() → void};
+}
diff --git a/pkg/front_end/testcases/macros/extend_augmented.dart.strong.transformed.expect b/pkg/front_end/testcases/macros/extend_augmented.dart.strong.transformed.expect
new file mode 100644
index 0000000..2d9979f
--- /dev/null
+++ b/pkg/front_end/testcases/macros/extend_augmented.dart.strong.transformed.expect
@@ -0,0 +1,25 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///extend_augmented.dart";
+
+class Class extends core::Object {
+ synthetic constructor •() → self::Class
+ : super core::Object::•()
+ ;
+ method /* from org-dartlang-testcase:///extend_augmented_lib.dart */ augmentedMethod() → void {
+ this.{self::Class::_#augmentedMethod#augment0}(){() → void};
+ }
+ method _#augmentedMethod#augment0() → void {}
+}
+class Subclass extends core::Object implements self::Class {
+ synthetic constructor •() → self::Subclass
+ : super core::Object::•()
+ ;
+ method augmentedMethod() → void {}
+}
+static method main() → dynamic {
+ new self::Class::•().{self::Class::augmentedMethod}(){() → void};
+ new self::Subclass::•().{self::Subclass::augmentedMethod}(){() → void};
+}
diff --git a/pkg/front_end/testcases/macros/extend_augmented.dart.textual_outline.expect b/pkg/front_end/testcases/macros/extend_augmented.dart.textual_outline.expect
new file mode 100644
index 0000000..309ada0
--- /dev/null
+++ b/pkg/front_end/testcases/macros/extend_augmented.dart.textual_outline.expect
@@ -0,0 +1,8 @@
+import augment 'extend_augmented_lib.dart';
+class Class {
+ void augmentedMethod() {}
+}
+class Subclass implements Class {
+ void augmentedMethod() {}
+}
+main() {}
diff --git a/pkg/front_end/testcases/macros/extend_augmented.dart.weak.expect b/pkg/front_end/testcases/macros/extend_augmented.dart.weak.expect
new file mode 100644
index 0000000..2d9979f
--- /dev/null
+++ b/pkg/front_end/testcases/macros/extend_augmented.dart.weak.expect
@@ -0,0 +1,25 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///extend_augmented.dart";
+
+class Class extends core::Object {
+ synthetic constructor •() → self::Class
+ : super core::Object::•()
+ ;
+ method /* from org-dartlang-testcase:///extend_augmented_lib.dart */ augmentedMethod() → void {
+ this.{self::Class::_#augmentedMethod#augment0}(){() → void};
+ }
+ method _#augmentedMethod#augment0() → void {}
+}
+class Subclass extends core::Object implements self::Class {
+ synthetic constructor •() → self::Subclass
+ : super core::Object::•()
+ ;
+ method augmentedMethod() → void {}
+}
+static method main() → dynamic {
+ new self::Class::•().{self::Class::augmentedMethod}(){() → void};
+ new self::Subclass::•().{self::Subclass::augmentedMethod}(){() → void};
+}
diff --git a/pkg/front_end/testcases/macros/extend_augmented.dart.weak.modular.expect b/pkg/front_end/testcases/macros/extend_augmented.dart.weak.modular.expect
new file mode 100644
index 0000000..2d9979f
--- /dev/null
+++ b/pkg/front_end/testcases/macros/extend_augmented.dart.weak.modular.expect
@@ -0,0 +1,25 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///extend_augmented.dart";
+
+class Class extends core::Object {
+ synthetic constructor •() → self::Class
+ : super core::Object::•()
+ ;
+ method /* from org-dartlang-testcase:///extend_augmented_lib.dart */ augmentedMethod() → void {
+ this.{self::Class::_#augmentedMethod#augment0}(){() → void};
+ }
+ method _#augmentedMethod#augment0() → void {}
+}
+class Subclass extends core::Object implements self::Class {
+ synthetic constructor •() → self::Subclass
+ : super core::Object::•()
+ ;
+ method augmentedMethod() → void {}
+}
+static method main() → dynamic {
+ new self::Class::•().{self::Class::augmentedMethod}(){() → void};
+ new self::Subclass::•().{self::Subclass::augmentedMethod}(){() → void};
+}
diff --git a/pkg/front_end/testcases/macros/extend_augmented.dart.weak.outline.expect b/pkg/front_end/testcases/macros/extend_augmented.dart.weak.outline.expect
new file mode 100644
index 0000000..9784599
--- /dev/null
+++ b/pkg/front_end/testcases/macros/extend_augmented.dart.weak.outline.expect
@@ -0,0 +1,20 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///extend_augmented.dart";
+
+class Class extends core::Object {
+ synthetic constructor •() → self::Class
+ ;
+ method augmentedMethod() → void
+ ;
+}
+class Subclass extends core::Object implements self::Class {
+ synthetic constructor •() → self::Subclass
+ ;
+ method augmentedMethod() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/macros/extend_augmented.dart.weak.transformed.expect b/pkg/front_end/testcases/macros/extend_augmented.dart.weak.transformed.expect
new file mode 100644
index 0000000..2d9979f
--- /dev/null
+++ b/pkg/front_end/testcases/macros/extend_augmented.dart.weak.transformed.expect
@@ -0,0 +1,25 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///extend_augmented.dart";
+
+class Class extends core::Object {
+ synthetic constructor •() → self::Class
+ : super core::Object::•()
+ ;
+ method /* from org-dartlang-testcase:///extend_augmented_lib.dart */ augmentedMethod() → void {
+ this.{self::Class::_#augmentedMethod#augment0}(){() → void};
+ }
+ method _#augmentedMethod#augment0() → void {}
+}
+class Subclass extends core::Object implements self::Class {
+ synthetic constructor •() → self::Subclass
+ : super core::Object::•()
+ ;
+ method augmentedMethod() → void {}
+}
+static method main() → dynamic {
+ new self::Class::•().{self::Class::augmentedMethod}(){() → void};
+ new self::Subclass::•().{self::Subclass::augmentedMethod}(){() → void};
+}
diff --git a/pkg/front_end/testcases/macros/extend_augmented_lib.dart b/pkg/front_end/testcases/macros/extend_augmented_lib.dart
new file mode 100644
index 0000000..07979a6
--- /dev/null
+++ b/pkg/front_end/testcases/macros/extend_augmented_lib.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2022, 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.
+
+augment class Class {
+ augment void augmentedMethod() {
+ augment super();
+ }
+}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status
index d19b28b..b9079b7 100644
--- a/pkg/front_end/testcases/textual_outline.status
+++ b/pkg/front_end/testcases/textual_outline.status
@@ -115,6 +115,7 @@
macros/augment_concrete: FormatterCrash
macros/augment_super: FormatterCrash
macros/class_members: FormatterCrash
+macros/extend_augmented: FormatterCrash
macros/inject_constructor: FormatterCrash
macros/macro_class: FormatterCrash
macros/multiple_imports: FormatterCrash
diff --git a/pkg/kernel/binary.md b/pkg/kernel/binary.md
index db38412..46ecd90 100644
--- a/pkg/kernel/binary.md
+++ b/pkg/kernel/binary.md
@@ -437,7 +437,7 @@
Byte stubKind; // Index into the ProcedureStubKind enum above.
UInt flags (isStatic, isAbstract, isExternal, isConst,
isRedirectingFactory, isExtensionMember,
- isNonNullableByDefault, isSynthetic);
+ isNonNullableByDefault, isSynthetic, isInternalImplementation);
Name name;
List<Expression> annotations;
MemberReference stubTarget; // May be NullReference.
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index ae11a58..e8a0d0e 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -2003,6 +2003,13 @@
bool get isNonNullableByDefault;
void set isNonNullableByDefault(bool value);
+ /// If `true` this procedure is not part of the interface but only part of the
+ /// class members.
+ ///
+ /// This is `true` for instance for augmented procedures and synthesized
+ /// fields added for the late lowering.
+ bool get isInternalImplementation => false;
+
/// The function signature and body of the procedure or constructor, or `null`
/// if this is a field.
FunctionNode? get function => null;
@@ -2247,11 +2254,12 @@
/// Whether the field is declared with the `late` keyword.
bool get isLate => flags & FlagLate != 0;
- // If `true` this field is not part of the interface but only part of the
- // class members.
- //
- // This is `true` for instance for synthesized fields added for the late
- // lowering.
+ /// If `true` this field is not part of the interface but only part of the
+ /// class members.
+ ///
+ /// This is `true` for instance for synthesized fields added for the late
+ /// lowering.
+ @override
bool get isInternalImplementation => flags & FlagInternalImplementation != 0;
void set isCovariantByDeclaration(bool value) {
@@ -3039,6 +3047,7 @@
static const int FlagExtensionMember = 1 << 5;
static const int FlagNonNullableByDefault = 1 << 6;
static const int FlagSynthetic = 1 << 7;
+ static const int FlagInternalImplementation = 1 << 8;
bool get isStatic => flags & FlagStatic != 0;
@@ -3093,6 +3102,19 @@
bool get isNoSuchMethodForwarder =>
stubKind == ProcedureStubKind.NoSuchMethodForwarder;
+ /// If `true` this procedure is not part of the interface but only part of the
+ /// class members.
+ ///
+ /// This is `true` for instance for augmented procedures.
+ @override
+ bool get isInternalImplementation => flags & FlagInternalImplementation != 0;
+
+ void set isInternalImplementation(bool value) {
+ flags = value
+ ? (flags | FlagInternalImplementation)
+ : (flags & ~FlagInternalImplementation);
+ }
+
@override
bool get isExtensionMember => flags & FlagExtensionMember != 0;
@@ -4377,11 +4399,13 @@
}
}
-/// An property read of an instance getter or field with a statically known
+/// A property read of an instance getter or field with a statically known
/// interface target.
class InstanceGet extends Expression {
final InstanceAccessKind kind;
Expression receiver;
+
+ // TODO(johnniwinther): Can we pull this from the [interfaceTarget] instead?
Name name;
/// The static type of result of the property read.
@@ -4542,6 +4566,8 @@
class InstanceTearOff extends Expression {
final InstanceAccessKind kind;
Expression receiver;
+
+ // TODO(johnniwinther): Can we pull this from the [interfaceTarget] instead?
Name name;
/// The static type of result of the tear-off.
@@ -4715,6 +4741,8 @@
class InstanceSet extends Expression {
final InstanceAccessKind kind;
Expression receiver;
+
+ // TODO(johnniwinther): Can we pull this from the [interfaceTarget] instead?
Name name;
Expression value;
@@ -5624,6 +5652,7 @@
@override
Expression receiver;
+ // TODO(johnniwinther): Can we pull this from the [interfaceTarget] instead?
@override
Name name;
diff --git a/pkg/kernel/lib/verifier.dart b/pkg/kernel/lib/verifier.dart
index a02eb0b..20c670e 100644
--- a/pkg/kernel/lib/verifier.dart
+++ b/pkg/kernel/lib/verifier.dart
@@ -954,6 +954,50 @@
super.visitTypedefTearOffConstant(node);
undeclareTypeParameters(node.parameters);
}
+
+ @override
+ void visitInstanceInvocation(InstanceInvocation node) {
+ if (node.name != node.interfaceTarget.name) {
+ problem(
+ node,
+ "Instance invocation with name '${node.name}' has a "
+ "target with name '${node.interfaceTarget.name}'.");
+ }
+ super.visitInstanceInvocation(node);
+ }
+
+ @override
+ void visitInstanceGet(InstanceGet node) {
+ if (node.name != node.interfaceTarget.name) {
+ problem(
+ node,
+ "Instance get with name '${node.name}' has a "
+ "target with name '${node.interfaceTarget.name}'.");
+ }
+ super.visitInstanceGet(node);
+ }
+
+ @override
+ void visitInstanceTearOff(InstanceTearOff node) {
+ if (node.name != node.interfaceTarget.name) {
+ problem(
+ node,
+ "Instance tear-off with name '${node.name}' has a "
+ "target with name '${node.interfaceTarget.name}'.");
+ }
+ super.visitInstanceTearOff(node);
+ }
+
+ @override
+ void visitInstanceSet(InstanceSet node) {
+ if (node.name != node.interfaceTarget.name) {
+ problem(
+ node,
+ "Instance set with name '${node.name}' has a "
+ "target with name '${node.interfaceTarget.name}'.");
+ }
+ super.visitInstanceSet(node);
+ }
}
void verifyGetStaticType(TypeEnvironment env, Component component) {
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.h b/runtime/vm/compiler/frontend/kernel_translation_helper.h
index 65690a1..e8067f4 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.h
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.h
@@ -590,6 +590,7 @@
kRedirectingFactory = 1 << 4,
kExtensionMember = 1 << 5,
kSyntheticProcedure = 1 << 7,
+ kInternalImplementation = 1 << 8,
};
explicit ProcedureHelper(KernelReaderHelper* helper)
@@ -609,6 +610,9 @@
bool IsExternal() const { return (flags_ & kExternal) != 0; }
bool IsConst() const { return (flags_ & kConst) != 0; }
bool IsSynthetic() const { return (flags_ & kSyntheticProcedure) != 0; }
+ bool IsInternalImplementation() const {
+ return (flags_ & kInternalImplementation) != 0;
+ }
bool IsForwardingStub() const {
return stub_kind_ == kAbstractForwardingStubKind ||
stub_kind_ == kConcreteForwardingStubKind;