diff --git a/pkg/_js_interop_checks/lib/src/transformations/static_interop_mock_validator.dart b/pkg/_js_interop_checks/lib/src/transformations/static_interop_mock_validator.dart index c5ceee005b2..cb003d4c9d5 100644 --- a/pkg/_js_interop_checks/lib/src/transformations/static_interop_mock_validator.dart +++ b/pkg/_js_interop_checks/lib/src/transformations/static_interop_mock_validator.dart @@ -365,13 +365,13 @@ class StaticInteropMockValidator { class TypeParameterResolver extends ReplacementVisitor { @override DartType? visitTypeParameterType(TypeParameterType node, int variance) { - return node.resolveTypeParameterType; + return node.nonTypeVariableBound; } @override DartType? visitStructuralParameterType( StructuralParameterType node, int variance) { - return node.resolveTypeParameterType; + return node.nonTypeVariableBound; } DartType resolve(DartType node) { diff --git a/pkg/front_end/lib/src/fasta/kernel/exhaustiveness.dart b/pkg/front_end/lib/src/fasta/kernel/exhaustiveness.dart index dded78dba9f..d4254eb2fa4 100644 --- a/pkg/front_end/lib/src/fasta/kernel/exhaustiveness.dart +++ b/pkg/front_end/lib/src/fasta/kernel/exhaustiveness.dart @@ -248,7 +248,7 @@ class CfeTypeOperations implements TypeOperations { @override DartType? getListElementType(DartType type) { - type = type.resolveTypeParameterType; + type = type.nonTypeVariableBound; if (type is TypeDeclarationType) { List? typeArguments = _classHierarchy.getTypeArgumentsAsInstanceOf( @@ -262,7 +262,7 @@ class CfeTypeOperations implements TypeOperations { @override DartType? getListType(DartType type) { - type = type.resolveTypeParameterType; + type = type.nonTypeVariableBound; if (type is TypeDeclarationType) { return _classHierarchy.getTypeAsInstanceOf( type, _typeEnvironment.coreTypes.listClass, @@ -273,7 +273,7 @@ class CfeTypeOperations implements TypeOperations { @override DartType? getMapValueType(DartType type) { - type = type.resolveTypeParameterType; + type = type.nonTypeVariableBound; if (type is TypeDeclarationType) { List? typeArguments = _classHierarchy.getTypeArgumentsAsInstanceOf( diff --git a/pkg/front_end/lib/src/fasta/kernel/implicit_field_type.dart b/pkg/front_end/lib/src/fasta/kernel/implicit_field_type.dart index 7cc0b93e247..4988da16673 100644 --- a/pkg/front_end/lib/src/fasta/kernel/implicit_field_type.dart +++ b/pkg/front_end/lib/src/fasta/kernel/implicit_field_type.dart @@ -44,8 +44,13 @@ abstract class InferredType extends AuxiliaryType { } @override - DartType get resolveTypeParameterType { - throw unsupported("resolveTypeParameterType", charOffset ?? -1, fileUri); + DartType get nonTypeVariableBound { + throw unsupported("nonTypeVariableBound", charOffset ?? -1, fileUri); + } + + @override + bool get hasNonObjectMemberAccess { + throw unsupported("hasNonObjectMemberAccess", charOffset ?? -1, fileUri); } @override diff --git a/pkg/front_end/lib/src/fasta/kernel/implicit_type_argument.dart b/pkg/front_end/lib/src/fasta/kernel/implicit_type_argument.dart index 5bbe4729d2c..85a631fb0e8 100644 --- a/pkg/front_end/lib/src/fasta/kernel/implicit_type_argument.dart +++ b/pkg/front_end/lib/src/fasta/kernel/implicit_type_argument.dart @@ -33,8 +33,13 @@ class ImplicitTypeArgument extends AuxiliaryType { Nullability get nullability => unsupported("nullability", -1, null); @override - DartType get resolveTypeParameterType { - throw unsupported("resolveTypeParameterType", -1, null); + DartType get nonTypeVariableBound { + throw unsupported("nonTypeVariableBound", -1, null); + } + + @override + bool get hasNonObjectMemberAccess { + throw unsupported("hasNonObjectMemberAccess", -1, null); } @override 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 c23dac82738..471a7784849 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 @@ -1505,7 +1505,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase inferExpression(iterable, context, isVoidAllowed: false); DartType iterableType = iterableResult.inferredType; iterable = iterableResult.expression; - DartType inferredExpressionType = resolveTypeParameter(iterableType); + DartType inferredExpressionType = iterableType.nonTypeVariableBound; iterable = ensureAssignable( wrapType( const DynamicType(), iterableClass, libraryBuilder.nonNullable), @@ -2143,7 +2143,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase DartType spreadType = spreadResult.inferredType; inferredSpreadTypes[element.expression] = spreadType; Expression replacement = element; - DartType spreadTypeBound = resolveTypeParameter(spreadType); + DartType spreadTypeBound = spreadType.nonTypeVariableBound; DartType? spreadElementType = getSpreadElementType(spreadType, spreadTypeBound, element.isNullAware); if (spreadElementType == null) { @@ -3818,7 +3818,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase // is a function type, the original values in output are preserved. void storeSpreadMapEntryElementTypes(DartType spreadMapEntryType, bool isNullAware, List output, int offset) { - DartType typeBound = resolveTypeParameter(spreadMapEntryType); + DartType typeBound = spreadMapEntryType.nonTypeVariableBound; if (coreTypes.isNull(typeBound)) { if (isNullAware) { if (isNonNullableByDefault) { @@ -3868,7 +3868,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase spreadType, entry.isNullAware, actualTypes, length); DartType? actualKeyType = actualTypes[length]; DartType? actualValueType = actualTypes[length + 1]; - DartType spreadTypeBound = resolveTypeParameter(spreadType); + DartType spreadTypeBound = spreadType.nonTypeVariableBound; DartType? actualElementType = getSpreadElementType(spreadType, spreadTypeBound, entry.isNullAware); @@ -4815,7 +4815,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase if (member.isInstanceMember) { ObjectAccessTarget target = new ObjectAccessTarget.interfaceMember( thisType!, member, - isPotentiallyNullable: false); + hasNonObjectMemberAccess: true); Link nullAwareGuards = const Link(); Expression receiver = new ThisExpression()..fileOffset = node.fileOffset; DartType receiverType = thisType!; @@ -5378,7 +5378,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase SuperIndexSet node, DartType typeContext) { ObjectAccessTarget indexSetTarget = thisType!.classNode.isMixinDeclaration ? new ObjectAccessTarget.interfaceMember(thisType!, node.setter, - isPotentiallyNullable: false) + hasNonObjectMemberAccess: true) : new ObjectAccessTarget.superMember(thisType!, node.setter); DartType indexType = indexSetTarget.getIndexKeyType(this); @@ -5701,7 +5701,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase ObjectAccessTarget readTarget = node.getter != null ? (thisType!.classNode.isMixinDeclaration ? new ObjectAccessTarget.interfaceMember(thisType!, node.getter!, - isPotentiallyNullable: false) + hasNonObjectMemberAccess: true) : new ObjectAccessTarget.superMember(thisType!, node.getter!)) : const ObjectAccessTarget.missing(); @@ -5713,7 +5713,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase ObjectAccessTarget writeTarget = node.setter != null ? (thisType!.classNode.isMixinDeclaration ? new ObjectAccessTarget.interfaceMember(thisType!, node.setter!, - isPotentiallyNullable: false) + hasNonObjectMemberAccess: true) : new ObjectAccessTarget.superMember(thisType!, node.setter!)) : const ObjectAccessTarget.missing(); @@ -7157,7 +7157,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase CompoundSuperIndexSet node, DartType typeContext) { ObjectAccessTarget readTarget = thisType!.classNode.isMixinDeclaration ? new ObjectAccessTarget.interfaceMember(thisType!, node.getter, - isPotentiallyNullable: false) + hasNonObjectMemberAccess: true) : new ObjectAccessTarget.superMember(thisType!, node.getter); DartType readType = readTarget.getReturnType(this); @@ -7204,7 +7204,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase } ObjectAccessTarget writeTarget = thisType!.classNode.isMixinDeclaration ? new ObjectAccessTarget.interfaceMember(thisType!, node.setter, - isPotentiallyNullable: false) + hasNonObjectMemberAccess: true) : new ObjectAccessTarget.superMember(thisType!, node.setter); DartType writeIndexType = writeTarget.getIndexKeyType(this); @@ -7538,7 +7538,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase ObjectAccessTarget target = new ObjectAccessTarget.interfaceMember( thisType!, member, - isPotentiallyNullable: false); + hasNonObjectMemberAccess: true); if (target.isInstanceMember || target.isObjectMember) { if (instrumentation != null && receiverType == const DynamicType()) { instrumentation!.record(uriForInstrumentation, node.fileOffset, @@ -7792,7 +7792,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase if (member.isInstanceMember) { ObjectAccessTarget target = new ObjectAccessTarget.interfaceMember( thisType!, member, - isPotentiallyNullable: false); + hasNonObjectMemberAccess: true); Expression receiver = new ThisExpression()..fileOffset = node.fileOffset; DartType receiverType = thisType!; @@ -8193,7 +8193,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase AbstractSuperPropertySet node, DartType typeContext) { ObjectAccessTarget writeTarget = new ObjectAccessTarget.interfaceMember( thisType!, node.interfaceTarget, - isPotentiallyNullable: false); + hasNonObjectMemberAccess: true); DartType writeContext = writeTarget.getSetterType(this); writeContext = computeTypeFromSuperClass( node.interfaceTarget.enclosingClass!, writeContext); @@ -8212,7 +8212,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase ObjectAccessTarget writeTarget = thisType!.classNode.isMixinDeclaration ? new ObjectAccessTarget.interfaceMember( thisType!, node.interfaceTarget, - isPotentiallyNullable: false) + hasNonObjectMemberAccess: true) : new ObjectAccessTarget.superMember(thisType!, node.interfaceTarget); DartType writeContext = writeTarget.getSetterType(this); writeContext = computeTypeFromSuperClass( @@ -10448,12 +10448,12 @@ class InferenceVisitorImpl extends InferenceVisitorBase break; case ObjectAccessTargetKind.recordNamed: field.recordType = - node.requiredType.resolveTypeParameterType as RecordType; + node.requiredType.nonTypeVariableBound as RecordType; field.accessKind = ObjectAccessKind.RecordNamed; break; case ObjectAccessTargetKind.recordIndexed: field.recordType = - node.requiredType.resolveTypeParameterType as RecordType; + node.requiredType.nonTypeVariableBound as RecordType; field.accessKind = ObjectAccessKind.RecordIndexed; field.recordFieldIndex = fieldTarget.recordFieldIndex!; break; @@ -10860,7 +10860,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase if (node.needsCheck) { node.lookupType = requiredType; } else { - DartType resolvedType = matchedValueType.resolveTypeParameterType; + DartType resolvedType = matchedValueType.nonTypeVariableBound; if (resolvedType is RecordType) { node.lookupType = resolvedType; } else { diff --git a/pkg/front_end/lib/src/fasta/type_inference/inference_visitor_base.dart b/pkg/front_end/lib/src/fasta/type_inference/inference_visitor_base.dart index 710376d86be..f7591d04750 100644 --- a/pkg/front_end/lib/src/fasta/type_inference/inference_visitor_base.dart +++ b/pkg/front_end/lib/src/fasta/type_inference/inference_visitor_base.dart @@ -966,8 +966,7 @@ abstract class InferenceVisitorBase implements InferenceVisitor { ObjectAccessTarget? _findExtensionTypeMember(DartType receiverType, ExtensionType extensionType, Name name, int fileOffset, - {required bool isSetter, - required bool isReceiverTypePotentiallyNullable}) { + {required bool isSetter, required bool hasNonObjectMemberAccess}) { ClassMember? classMember = _getExtensionTypeMember( extensionType.extensionTypeDeclaration, name, isSetter); if (classMember == null) { @@ -978,7 +977,7 @@ abstract class InferenceVisitorBase implements InferenceVisitor { member.stubKind == ProcedureStubKind.RepresentationField) { return new ObjectAccessTarget.extensionTypeRepresentation( receiverType, extensionType, member, - isPotentiallyNullable: isReceiverTypePotentiallyNullable); + hasNonObjectMemberAccess: hasNonObjectMemberAccess); } if (member.isExtensionTypeMember) { ExtensionTypeDeclarationBuilder extensionTypeDeclarationBuilder = @@ -993,10 +992,10 @@ abstract class InferenceVisitorBase implements InferenceVisitor { kind, hierarchyBuilder.getTypeArgumentsAsInstanceOf( extensionType, extensionTypeDeclaration)!, - isPotentiallyNullable: isReceiverTypePotentiallyNullable); + hasNonObjectMemberAccess: hasNonObjectMemberAccess); } else { return new ObjectAccessTarget.interfaceMember(receiverType, member, - isPotentiallyNullable: isReceiverTypePotentiallyNullable); + hasNonObjectMemberAccess: hasNonObjectMemberAccess); } } @@ -1184,12 +1183,12 @@ abstract class InferenceVisitorBase implements InferenceVisitor { bool includeExtensionMethods = false}) { assert(isKnown(receiverType)); - DartType receiverBound = resolveTypeParameter(receiverType); + DartType receiverBound = receiverType.nonTypeVariableBound; - bool isReceiverTypePotentiallyNullable = isNonNullableByDefault && - receiverType.isPotentiallyNullable && + bool hasNonObjectMemberAccess = !isNonNullableByDefault || + receiverType.hasNonObjectMemberAccess || // Calls to `==` are always on a non-null receiver. - name != equalsName; + name == equalsName; Class classNode = receiverBound is InterfaceType ? receiverBound.classNode @@ -1200,12 +1199,11 @@ abstract class InferenceVisitorBase implements InferenceVisitor { name: name, classNode: classNode, receiverBound: receiverBound, - isReceiverTypePotentiallyNullable: - isReceiverTypePotentiallyNullable, + hasNonObjectMemberAccess: hasNonObjectMemberAccess, isSetter: isSetter, fileOffset: fileOffset); - if (isReceiverTypePotentiallyNullable) { + if (!hasNonObjectMemberAccess) { Member? member = _getInterfaceMember(coreTypes.objectClass, name, isSetter); if (member != null) { @@ -1246,7 +1244,7 @@ abstract class InferenceVisitorBase implements InferenceVisitor { } if (target.isMissing && includeExtensionMethods) { - if (isReceiverTypePotentiallyNullable) { + if (!hasNonObjectMemberAccess) { // When the receiver type is potentially nullable we would have found // the extension member above, if available. Therefore we know that we // are in an erroneous case and instead look up the extension member on @@ -1296,7 +1294,7 @@ abstract class InferenceVisitorBase implements InferenceVisitor { } return helper.buildProblem( errorTemplate.withArguments(name.text, - resolveTypeParameter(receiverType), isNonNullableByDefault), + receiverType.nonTypeVariableBound, isNonNullableByDefault), fileOffset, length); } @@ -1387,7 +1385,7 @@ abstract class InferenceVisitorBase implements InferenceVisitor { TypeDeclaration enclosingTypeDeclaration = interfaceMember.enclosingTypeDeclaration!; if (enclosingTypeDeclaration.typeParameters.isNotEmpty) { - receiverType = resolveTypeParameter(receiverType); + receiverType = receiverType.nonTypeVariableBound; if (receiverType is TypeDeclarationType) { List castedTypeArguments = hierarchyBuilder.getTypeArgumentsAsInstanceOf( @@ -3481,7 +3479,7 @@ abstract class InferenceVisitorBase implements InferenceVisitor { int fileOffset = expression.fileOffset; ObjectAccessTarget target = thisType!.classNode.isMixinDeclaration ? new ObjectAccessTarget.interfaceMember(thisType!, procedure, - isPotentiallyNullable: false) + hasNonObjectMemberAccess: true) : new ObjectAccessTarget.superMember(thisType!, procedure); DartType receiverType = thisType!; bool isSpecialCasedBinaryOperator = @@ -3521,7 +3519,7 @@ abstract class InferenceVisitorBase implements InferenceVisitor { Expression expression, Name name, DartType typeContext, Member member) { ObjectAccessTarget readTarget = thisType!.classNode.isMixinDeclaration ? new ObjectAccessTarget.interfaceMember(thisType!, member, - isPotentiallyNullable: false) + hasNonObjectMemberAccess: true) : new ObjectAccessTarget.superMember(thisType!, member); DartType inferredType = computeTypeFromSuperClass( member.enclosingClass!, readTarget.getGetterType(this)); @@ -3706,50 +3704,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor { return MethodContravarianceCheckKind.none; } - /// If the given [type] is a [TypeParameterType], resolve it to its bound. - @pragma("vm:prefer-inline") - DartType resolveTypeParameter(DartType type) { - if (type is InterfaceType || type is FunctionType) return type; - return _resolveTypeParameterImpl(type); - } - - /// If the given [type] is a [TypeParameterType], resolve it to its bound. - DartType _resolveTypeParameterImpl(DartType type) { - DartType? resolveOneStep(DartType type) { - if (type is TypeParameterType) { - return type.bound; - } else if (type is IntersectionType) { - return type.right; - } else { - return null; - } - } - - DartType? resolved = resolveOneStep(type); - if (resolved == null) return type; - - // Detect circularities using the tortoise-and-hare algorithm. - DartType? tortoise = resolved; - DartType? hare = resolveOneStep(tortoise); - if (hare == null) return tortoise; - while (true) { - if (identical(tortoise, hare)) { - // We found a circularity. Give up and return `dynamic`. - return const DynamicType(); - } - - // Hare takes two steps - DartType? step1 = resolveOneStep(hare!); - if (step1 == null) return hare; - DartType? step2 = resolveOneStep(step1); - if (step2 == null) return step1; - hare = step2; - - // Tortoise takes one step - tortoise = resolveOneStep(tortoise!); - } - } - DartType wrapFutureOrType(DartType type) { if (type is FutureOrType) { return type; @@ -3972,14 +3926,14 @@ abstract class InferenceVisitorBase implements InferenceVisitor { if (wrappedExpression != null) { return helper.wrapInProblem( wrappedExpression, - template.withArguments(name.text, resolveTypeParameter(receiverType), + template.withArguments(name.text, receiverType.nonTypeVariableBound, isNonNullableByDefault), fileOffset, length, context: context); } else { return helper.buildProblem( - template.withArguments(name.text, resolveTypeParameter(receiverType), + template.withArguments(name.text, receiverType.nonTypeVariableBound, isNonNullableByDefault), fileOffset, length, @@ -4208,10 +4162,7 @@ abstract class InferenceVisitorBase implements InferenceVisitor { } readResult ??= new ExpressionInferenceResult(readType, read); - if (readTarget.isNullable && - !(receiverType is ExtensionType && - propertyName.text == - receiverType.extensionTypeDeclaration.representationName)) { + if (readTarget.isNullable) { readResult = wrapExpressionInferenceResultInProblem( readResult, templateNullablePropertyAccessError.withArguments( @@ -4696,7 +4647,7 @@ class _ObjectAccessDescriptor { final Name name; final DartType receiverBound; final Class classNode; - final bool isReceiverTypePotentiallyNullable; + final bool hasNonObjectMemberAccess; final bool isSetter; final int fileOffset; @@ -4705,7 +4656,7 @@ class _ObjectAccessDescriptor { required this.name, required this.receiverBound, required this.classNode, - required this.isReceiverTypePotentiallyNullable, + required this.hasNonObjectMemberAccess, required this.isSetter, required this.fileOffset}); @@ -4722,9 +4673,9 @@ class _ObjectAccessDescriptor { if (receiverBound is InterfaceType) { // This is what happens most often: Skip the other `if`s. } else if (receiverBound is FunctionType && name == callName && !isSetter) { - return isReceiverTypePotentiallyNullable - ? new ObjectAccessTarget.nullableCallFunction(receiverType) - : new ObjectAccessTarget.callFunction(receiverType); + return hasNonObjectMemberAccess + ? new ObjectAccessTarget.callFunction(receiverType) + : new ObjectAccessTarget.nullableCallFunction(receiverType); } else if (receiverBound is NeverType) { switch (receiverBound.nullability) { case Nullability.nonNullable: @@ -4749,17 +4700,16 @@ class _ObjectAccessDescriptor { text, receiverBound.positional.length); if (index != null) { DartType fieldType = receiverBound.positional[index]; - return isReceiverTypePotentiallyNullable - ? new RecordIndexTarget.nullable(receiverBound, fieldType, index) - : new RecordIndexTarget.nonNullable( - receiverBound, fieldType, index); + return hasNonObjectMemberAccess + ? new RecordIndexTarget.nonNullable(receiverBound, fieldType, index) + : new RecordIndexTarget.nullable(receiverBound, fieldType, index); } for (NamedType field in receiverBound.named) { if (field.name == text) { - return isReceiverTypePotentiallyNullable - ? new RecordNameTarget.nullable( + return hasNonObjectMemberAccess + ? new RecordNameTarget.nonNullable( receiverBound, field.type, field.name) - : new RecordNameTarget.nonNullable( + : new RecordNameTarget.nullable( receiverBound, field.type, field.name); } } @@ -4767,7 +4717,7 @@ class _ObjectAccessDescriptor { ObjectAccessTarget? target = visitor._findExtensionTypeMember( receiverType, receiverBound, name, fileOffset, isSetter: isSetter, - isReceiverTypePotentiallyNullable: isReceiverTypePotentiallyNullable); + hasNonObjectMemberAccess: hasNonObjectMemberAccess); if (target != null) { return target; } @@ -4779,7 +4729,7 @@ class _ObjectAccessDescriptor { if (interfaceMember != null) { target = new ObjectAccessTarget.interfaceMember( receiverType, interfaceMember, - isPotentiallyNullable: isReceiverTypePotentiallyNullable); + hasNonObjectMemberAccess: hasNonObjectMemberAccess); } else if (receiverBound is DynamicType) { target = const ObjectAccessTarget.dynamic(); } else if (receiverBound is InvalidType) { @@ -4788,9 +4738,9 @@ class _ObjectAccessDescriptor { receiverBound.classNode == visitor.coreTypes.functionClass && name == callName && !isSetter) { - target = isReceiverTypePotentiallyNullable - ? new ObjectAccessTarget.nullableCallFunction(receiverType) - : new ObjectAccessTarget.callFunction(receiverType); + target = hasNonObjectMemberAccess + ? new ObjectAccessTarget.callFunction(receiverType) + : new ObjectAccessTarget.nullableCallFunction(receiverType); } else { target = const ObjectAccessTarget.missing(); } diff --git a/pkg/front_end/lib/src/fasta/type_inference/object_access_target.dart b/pkg/front_end/lib/src/fasta/type_inference/object_access_target.dart index b35f0fc4efd..3d66571b75a 100644 --- a/pkg/front_end/lib/src/fasta/type_inference/object_access_target.dart +++ b/pkg/front_end/lib/src/fasta/type_inference/object_access_target.dart @@ -104,10 +104,10 @@ abstract class ObjectAccessTarget { /// Creates an access to the instance [member]. factory ObjectAccessTarget.interfaceMember( DartType receiverType, Member member, - {required bool isPotentiallyNullable}) { - return isPotentiallyNullable - ? new InstanceAccessTarget.nullable(receiverType, member) - : new InstanceAccessTarget.nonNullable(receiverType, member); + {required bool hasNonObjectMemberAccess}) { + return hasNonObjectMemberAccess + ? new InstanceAccessTarget.nonNullable(receiverType, member) + : new InstanceAccessTarget.nullable(receiverType, member); } /// Creates an access to the super [member]. @@ -134,12 +134,12 @@ abstract class ObjectAccessTarget { Member? tearoffTarget, ClassMemberKind kind, List extensionTypeArguments, - {bool isPotentiallyNullable}) = ExtensionTypeAccessTarget; + {bool hasNonObjectMemberAccess}) = ExtensionTypeAccessTarget; /// Creates an access to the [representationField] of the [extensionType]. factory ObjectAccessTarget.extensionTypeRepresentation(DartType receiverType, ExtensionType extensionType, Procedure representationField, - {required bool isPotentiallyNullable}) = + {required bool hasNonObjectMemberAccess}) = ExtensionTypeRepresentationAccessTarget; /// Creates an access to a 'call' method on a function, i.e. a function @@ -275,8 +275,8 @@ abstract class ObjectAccessTarget { bool get isNullableExtensionTypeRepresentation => kind == ObjectAccessTargetKind.nullableExtensionTypeRepresentation; - /// Returns `true` if this is an access to an instance member on a potentially - /// nullable receiver. + /// Returns `true` if this is an *invalid* access to an instance member on a + /// potentially nullable receiver. bool get isNullable => isNullableInstanceMember || isNullableCallFunction || @@ -315,7 +315,7 @@ abstract class ObjectAccessTarget { FunctionType _getFunctionType( InferenceVisitorBase base, DartType calleeType) { - calleeType = base.resolveTypeParameter(calleeType); + calleeType = calleeType.nonTypeVariableBound; if (calleeType is FunctionType) { if (!base.isNonNullableByDefault) { calleeType = legacyErasure(calleeType); @@ -1103,10 +1103,10 @@ class ExtensionTypeAccessTarget extends ObjectAccessTarget { ExtensionTypeAccessTarget(this.receiverType, this.member, this.tearoffTarget, this.declarationMethodKind, this.receiverTypeArguments, - {bool isPotentiallyNullable = false}) - : super.internal(isPotentiallyNullable - ? ObjectAccessTargetKind.nullableExtensionTypeMember - : ObjectAccessTargetKind.extensionTypeMember); + {bool hasNonObjectMemberAccess = true}) + : super.internal(hasNonObjectMemberAccess + ? ObjectAccessTargetKind.extensionTypeMember + : ObjectAccessTargetKind.nullableExtensionTypeMember); @override FunctionType getFunctionType(InferenceVisitorBase base) { @@ -1312,10 +1312,10 @@ class ExtensionTypeRepresentationAccessTarget extends ObjectAccessTarget { ExtensionTypeRepresentationAccessTarget( this.receiverType, this.extensionType, this.representationField, - {required bool isPotentiallyNullable}) - : super.internal(isPotentiallyNullable - ? ObjectAccessTargetKind.nullableExtensionTypeRepresentation - : ObjectAccessTargetKind.extensionTypeRepresentation); + {required bool hasNonObjectMemberAccess}) + : super.internal(hasNonObjectMemberAccess + ? ObjectAccessTargetKind.extensionTypeRepresentation + : ObjectAccessTargetKind.nullableExtensionTypeRepresentation); @override DartType getBinaryOperandType(InferenceVisitorBase base) { diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_schema.dart b/pkg/front_end/lib/src/fasta/type_inference/type_schema.dart index 40e9e74b940..0deda42c295 100644 --- a/pkg/front_end/lib/src/fasta/type_inference/type_schema.dart +++ b/pkg/front_end/lib/src/fasta/type_inference/type_schema.dart @@ -58,7 +58,12 @@ class UnknownType extends AuxiliaryType { Nullability get nullability => Nullability.undetermined; @override - DartType get resolveTypeParameterType => this; + DartType get nonTypeVariableBound => this; + + @override + bool get hasNonObjectMemberAccess { + throw new UnsupportedError("${runtimeType}.hasNonObjectMemberAccess"); + } @override bool equals(Object other, Assumptions? assumptions) { diff --git a/pkg/front_end/testcases/extension_types/field_access.dart.strong.expect b/pkg/front_end/testcases/extension_types/field_access.dart.strong.expect index da941a3ec62..eefae8980e1 100644 --- a/pkg/front_end/testcases/extension_types/field_access.dart.strong.expect +++ b/pkg/front_end/testcases/extension_types/field_access.dart.strong.expect @@ -26,36 +26,26 @@ library; // var c2 = it = 42; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:24:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a1 = this.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:25:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a2 = it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:26:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b1 = this.it; // Error -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. +// pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:27:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b2 = it; // Error -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. +// pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. // Try changing the operand or remove the type arguments. // var b2 = it; // Error // ^ // +// pkg/front_end/testcases/extension_types/field_access.dart:28:19: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c1 = this.it = t; // Error, should not resolve to extension method. +// ^^ +// +// pkg/front_end/testcases/extension_types/field_access.dart:29:14: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c2 = it = t; // Error, should not resolve to extension method. +// ^^ +// // pkg/front_end/testcases/extension_types/field_access.dart:37:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T Function()'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error @@ -96,54 +86,24 @@ library; // var c2 = it = t; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:70:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a1 = this.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:71:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a2 = it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:72:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b1 = this.it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:72:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:73:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b2 = it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:73:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var b2 = it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:76:19: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var d1 = this.it(); +// pkg/front_end/testcases/extension_types/field_access.dart:74:19: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c1 = this.it = 42; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:77:14: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var d2 = it(); -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:78:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var d3 = this.it.call(); -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:79:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var d4 = it.call(); +// pkg/front_end/testcases/extension_types/field_access.dart:75:14: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c2 = it = 42; // Error, should not resolve to extension method. // ^^ // // pkg/front_end/testcases/extension_types/field_access.dart:89:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. @@ -261,24 +221,14 @@ library; // var d6 = genericFunctionInlineClass.it = () => throw ''; // Error, should // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:142:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var e1 = dynamicInlineClass.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:143:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var e2 = dynamicInlineClass.it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:143:33: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var e2 = dynamicInlineClass.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:144:31: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var e3 = dynamicInlineClass.it(); +// pkg/front_end/testcases/extension_types/field_access.dart:145:31: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var e4 = dynamicInlineClass.it = '42'; // Error, should not resolve // ^^ // // pkg/front_end/testcases/extension_types/field_access.dart:149:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. @@ -408,24 +358,24 @@ static inline-class-member method GenericInlineClass|constructor#(self::GenericInlineClass|constructor#_#new#tearOff::T% it) → self::GenericInlineClass% /* = self::GenericInlineClass|constructor#_#new#tearOff::T% */ return self::GenericInlineClass|constructor#(it); static inline-class-member method GenericInlineClass|test(lowered final self::GenericInlineClass /* = self::GenericInlineClass|test::T% */ #this, self::GenericInlineClass|test::T% t) → void { - dynamic a1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:24:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a1 = this.it; - ^^" in #this{}.it; - dynamic a2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:25:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a2 = it; - ^^" in #this{}.it; - invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. + self::GenericInlineClass|test::T% a1 = #this as{Unchecked} self::GenericInlineClass|test::T%; + self::GenericInlineClass|test::T% a2 = #this as{Unchecked} self::GenericInlineClass|test::T%; + invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. Try changing the operand or remove the type arguments. var b1 = this.it; // Error ^"; - invalid-type b2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. + invalid-type b2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. Try changing the operand or remove the type arguments. var b2 = it; // Error ^"; - self::GenericInlineClass|test::T% c1 = let final self::GenericInlineClass|test::T% #t1 = t in let final void #t2 = self::_extension#0|set#it(#this, #t1) in #t1; - self::GenericInlineClass|test::T% c2 = let final self::GenericInlineClass|test::T% #t3 = t in let final void #t4 = self::_extension#0|set#it(#this, #t3) in #t3; + self::GenericInlineClass|test::T% c1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:28:19: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c1 = this.it = t; // Error, should not resolve to extension method. + ^^" in #this{}.it = t; + self::GenericInlineClass|test::T% c2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:29:14: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c2 = it = t; // Error, should not resolve to extension method. + ^^" in #this{}.it = t; } static inline-class-member method GenericInlineClass|get#test(lowered final self::GenericInlineClass% /* = self::GenericInlineClass|get#test::T% */ #this) → (self::GenericInlineClass|get#test::T%) → void return (self::GenericInlineClass|get#test::T% t) → void => self::GenericInlineClass|test(#this, t); @@ -504,14 +454,8 @@ static inline-class-member method DynamicInlineClass|constructor#(dynamic it) static inline-class-member method DynamicInlineClass|constructor#_#new#tearOff(dynamic it) → self::DynamicInlineClass /* = dynamic */ return self::DynamicInlineClass|constructor#(it); static inline-class-member method DynamicInlineClass|test(lowered final self::DynamicInlineClass /* = dynamic */ #this) → void { - dynamic a1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:70:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a1 = this.it; - ^^" in #this{}.it; - dynamic a2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:71:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a2 = it; - ^^" in #this{}.it; + dynamic a1 = #this as{Unchecked} dynamic; + dynamic a2 = #this as{Unchecked} dynamic; invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:72:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. Try changing the operand or remove the type arguments. var b1 = this.it; // Error @@ -520,24 +464,18 @@ Try changing the operand or remove the type arguments. Try changing the operand or remove the type arguments. var b2 = it; // Error ^"; - core::int c1 = let final core::int #t5 = 42 in let final void #t6 = self::_extension#0|set#it(#this, #t5) in #t5; - core::int c2 = let final core::int #t7 = 42 in let final void #t8 = self::_extension#0|set#it(#this, #t7) in #t7; - dynamic d1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:76:19: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var d1 = this.it(); - ^^" in #this{}.it(); - dynamic d2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:77:14: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var d2 = it(); - ^^" in #this{}.it(); - dynamic d3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:78:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var d3 = this.it.call(); - ^^" in #this{}.it{dynamic}.call(); - dynamic d4 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:79:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var d4 = it.call(); - ^^" in #this{}.it{dynamic}.call(); + core::int c1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:74:19: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c1 = this.it = 42; // Error, should not resolve to extension method. + ^^" in #this{}.it = 42; + core::int c2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:75:14: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c2 = it = 42; // Error, should not resolve to extension method. + ^^" in #this{}.it = 42; + dynamic d1 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d2 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d3 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d4 = (#this as{Unchecked} dynamic){dynamic}.call(); } static inline-class-member method DynamicInlineClass|get#test(lowered final self::DynamicInlineClass /* = dynamic */ #this) → () → void return () → void => self::DynamicInlineClass|test(#this); @@ -658,19 +596,16 @@ Try correcting the name to the name of an existing setter, or defining a setter Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. var d6 = genericFunctionInlineClass.it = () => throw ''; // Error, should ^^" in genericFunctionInlineClass{}.it = () → Never => throw ""; - dynamic e1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:142:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var e1 = dynamicInlineClass.it; - ^^" in dynamicInlineClass{}.it; + dynamic e1 = dynamicInlineClass as{Unchecked} dynamic; invalid-type e2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:143:33: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. Try changing the operand or remove the type arguments. var e2 = dynamicInlineClass.it; // Error ^"; - dynamic e3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:144:31: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var e3 = dynamicInlineClass.it(); - ^^" in dynamicInlineClass{}.it(); - core::String e4 = let final core::String #t9 = "42" in let final void #t10 = self::_extension#0|set#it(dynamicInlineClass, #t9) in #t9; + dynamic e3 = (dynamicInlineClass as{Unchecked} dynamic){dynamic}.call(); + core::String e4 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:145:31: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var e4 = dynamicInlineClass.it = '42'; // Error, should not resolve + ^^" in dynamicInlineClass{}.it = "42"; core::int f1 = erroneousInlineClass as{Unchecked} core::int; invalid-type f2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:149:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. Try changing the operand or remove the type arguments. diff --git a/pkg/front_end/testcases/extension_types/field_access.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/field_access.dart.strong.transformed.expect index fc00021b589..eefae8980e1 100644 --- a/pkg/front_end/testcases/extension_types/field_access.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/extension_types/field_access.dart.strong.transformed.expect @@ -26,36 +26,26 @@ library; // var c2 = it = 42; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:24:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a1 = this.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:25:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a2 = it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:26:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b1 = this.it; // Error -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. +// pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:27:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b2 = it; // Error -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. +// pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. // Try changing the operand or remove the type arguments. // var b2 = it; // Error // ^ // +// pkg/front_end/testcases/extension_types/field_access.dart:28:19: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c1 = this.it = t; // Error, should not resolve to extension method. +// ^^ +// +// pkg/front_end/testcases/extension_types/field_access.dart:29:14: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c2 = it = t; // Error, should not resolve to extension method. +// ^^ +// // pkg/front_end/testcases/extension_types/field_access.dart:37:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T Function()'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error @@ -96,54 +86,24 @@ library; // var c2 = it = t; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:70:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a1 = this.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:71:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a2 = it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:72:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b1 = this.it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:72:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:73:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b2 = it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:73:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var b2 = it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:76:19: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var d1 = this.it(); +// pkg/front_end/testcases/extension_types/field_access.dart:74:19: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c1 = this.it = 42; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:77:14: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var d2 = it(); -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:78:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var d3 = this.it.call(); -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:79:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var d4 = it.call(); +// pkg/front_end/testcases/extension_types/field_access.dart:75:14: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c2 = it = 42; // Error, should not resolve to extension method. // ^^ // // pkg/front_end/testcases/extension_types/field_access.dart:89:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. @@ -261,24 +221,14 @@ library; // var d6 = genericFunctionInlineClass.it = () => throw ''; // Error, should // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:142:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var e1 = dynamicInlineClass.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:143:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var e2 = dynamicInlineClass.it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:143:33: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var e2 = dynamicInlineClass.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:144:31: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var e3 = dynamicInlineClass.it(); +// pkg/front_end/testcases/extension_types/field_access.dart:145:31: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var e4 = dynamicInlineClass.it = '42'; // Error, should not resolve // ^^ // // pkg/front_end/testcases/extension_types/field_access.dart:149:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. @@ -408,24 +358,24 @@ static inline-class-member method GenericInlineClass|constructor#(self::GenericInlineClass|constructor#_#new#tearOff::T% it) → self::GenericInlineClass% /* = self::GenericInlineClass|constructor#_#new#tearOff::T% */ return self::GenericInlineClass|constructor#(it); static inline-class-member method GenericInlineClass|test(lowered final self::GenericInlineClass /* = self::GenericInlineClass|test::T% */ #this, self::GenericInlineClass|test::T% t) → void { - dynamic a1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:24:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a1 = this.it; - ^^" in #this{}.it; - dynamic a2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:25:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a2 = it; - ^^" in #this{}.it; - invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. + self::GenericInlineClass|test::T% a1 = #this as{Unchecked} self::GenericInlineClass|test::T%; + self::GenericInlineClass|test::T% a2 = #this as{Unchecked} self::GenericInlineClass|test::T%; + invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. Try changing the operand or remove the type arguments. var b1 = this.it; // Error ^"; - invalid-type b2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. + invalid-type b2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. Try changing the operand or remove the type arguments. var b2 = it; // Error ^"; - self::GenericInlineClass|test::T% c1 = let final self::GenericInlineClass|test::T% #t1 = t in let final void #t2 = self::_extension#0|set#it(#this, #t1) in #t1; - self::GenericInlineClass|test::T% c2 = let final self::GenericInlineClass|test::T% #t3 = t in let final void #t4 = self::_extension#0|set#it(#this, #t3) in #t3; + self::GenericInlineClass|test::T% c1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:28:19: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c1 = this.it = t; // Error, should not resolve to extension method. + ^^" in #this{}.it = t; + self::GenericInlineClass|test::T% c2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:29:14: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c2 = it = t; // Error, should not resolve to extension method. + ^^" in #this{}.it = t; } static inline-class-member method GenericInlineClass|get#test(lowered final self::GenericInlineClass% /* = self::GenericInlineClass|get#test::T% */ #this) → (self::GenericInlineClass|get#test::T%) → void return (self::GenericInlineClass|get#test::T% t) → void => self::GenericInlineClass|test(#this, t); @@ -504,14 +454,8 @@ static inline-class-member method DynamicInlineClass|constructor#(dynamic it) static inline-class-member method DynamicInlineClass|constructor#_#new#tearOff(dynamic it) → self::DynamicInlineClass /* = dynamic */ return self::DynamicInlineClass|constructor#(it); static inline-class-member method DynamicInlineClass|test(lowered final self::DynamicInlineClass /* = dynamic */ #this) → void { - dynamic a1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:70:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a1 = this.it; - ^^" in #this{}.it; - dynamic a2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:71:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a2 = it; - ^^" in #this{}.it; + dynamic a1 = #this as{Unchecked} dynamic; + dynamic a2 = #this as{Unchecked} dynamic; invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:72:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. Try changing the operand or remove the type arguments. var b1 = this.it; // Error @@ -520,24 +464,18 @@ Try changing the operand or remove the type arguments. Try changing the operand or remove the type arguments. var b2 = it; // Error ^"; - core::int c1 = let final core::int #t5 = 42 in let final void #t6 = self::_extension#0|set#it(#this, #t5) in #t5; - core::int c2 = let final core::int #t7 = 42 in let final void #t8 = self::_extension#0|set#it(#this, #t7) in #t7; - dynamic d1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:76:19: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var d1 = this.it(); - ^^" in #this{}.it(); - dynamic d2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:77:14: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var d2 = it(); - ^^" in #this{}.it(); - dynamic d3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:78:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var d3 = this.it.call(); - ^^" in #this{}.it{dynamic}.call(); - dynamic d4 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:79:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var d4 = it.call(); - ^^" in #this{}.it{dynamic}.call(); + core::int c1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:74:19: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c1 = this.it = 42; // Error, should not resolve to extension method. + ^^" in #this{}.it = 42; + core::int c2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:75:14: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c2 = it = 42; // Error, should not resolve to extension method. + ^^" in #this{}.it = 42; + dynamic d1 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d2 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d3 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d4 = (#this as{Unchecked} dynamic){dynamic}.call(); } static inline-class-member method DynamicInlineClass|get#test(lowered final self::DynamicInlineClass /* = dynamic */ #this) → () → void return () → void => self::DynamicInlineClass|test(#this); @@ -658,19 +596,16 @@ Try correcting the name to the name of an existing setter, or defining a setter Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. var d6 = genericFunctionInlineClass.it = () => throw ''; // Error, should ^^" in genericFunctionInlineClass{}.it = () → Never => throw ""; - dynamic e1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:142:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var e1 = dynamicInlineClass.it; - ^^" in dynamicInlineClass{}.it; + dynamic e1 = dynamicInlineClass as{Unchecked} dynamic; invalid-type e2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:143:33: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. Try changing the operand or remove the type arguments. var e2 = dynamicInlineClass.it; // Error ^"; - dynamic e3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:144:31: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var e3 = dynamicInlineClass.it(); - ^^" in dynamicInlineClass{}.it(); - core::String e4 = let final core::String #t9 = "42" in let final void #t10 = self::_extension#0|set#it(dynamicInlineClass, #t9) in #t9; + dynamic e3 = (dynamicInlineClass as{Unchecked} dynamic){dynamic}.call(); + core::String e4 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:145:31: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var e4 = dynamicInlineClass.it = '42'; // Error, should not resolve + ^^" in dynamicInlineClass{}.it = "42"; core::int f1 = erroneousInlineClass as{Unchecked} core::int; invalid-type f2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:149:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. Try changing the operand or remove the type arguments. @@ -765,13 +700,3 @@ Try correcting the name to the name of an existing setter, or defining a setter } static inline-class-member method PrivateInlineClass|get#test(lowered final self2::PrivateInlineClass /* = core::int */ #this) → () → void return () → void => self2::PrivateInlineClass|test(#this); - - -Extra constant evaluation status: -Evaluated: VariableGet @ org-dartlang-testcase:///field_access.dart:74:24 -> IntConstant(42) -Evaluated: VariableGet @ org-dartlang-testcase:///field_access.dart:74:24 -> IntConstant(42) -Evaluated: VariableGet @ org-dartlang-testcase:///field_access.dart:75:19 -> IntConstant(42) -Evaluated: VariableGet @ org-dartlang-testcase:///field_access.dart:75:19 -> IntConstant(42) -Evaluated: VariableGet @ org-dartlang-testcase:///field_access.dart:145:36 -> StringConstant("42") -Evaluated: VariableGet @ org-dartlang-testcase:///field_access.dart:145:36 -> StringConstant("42") -Extra constant evaluation: evaluated: 182, effectively constant: 6 diff --git a/pkg/front_end/testcases/extension_types/field_access.dart.weak.expect b/pkg/front_end/testcases/extension_types/field_access.dart.weak.expect index da941a3ec62..eefae8980e1 100644 --- a/pkg/front_end/testcases/extension_types/field_access.dart.weak.expect +++ b/pkg/front_end/testcases/extension_types/field_access.dart.weak.expect @@ -26,36 +26,26 @@ library; // var c2 = it = 42; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:24:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a1 = this.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:25:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a2 = it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:26:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b1 = this.it; // Error -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. +// pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:27:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b2 = it; // Error -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. +// pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. // Try changing the operand or remove the type arguments. // var b2 = it; // Error // ^ // +// pkg/front_end/testcases/extension_types/field_access.dart:28:19: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c1 = this.it = t; // Error, should not resolve to extension method. +// ^^ +// +// pkg/front_end/testcases/extension_types/field_access.dart:29:14: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c2 = it = t; // Error, should not resolve to extension method. +// ^^ +// // pkg/front_end/testcases/extension_types/field_access.dart:37:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T Function()'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error @@ -96,54 +86,24 @@ library; // var c2 = it = t; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:70:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a1 = this.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:71:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a2 = it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:72:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b1 = this.it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:72:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:73:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b2 = it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:73:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var b2 = it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:76:19: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var d1 = this.it(); +// pkg/front_end/testcases/extension_types/field_access.dart:74:19: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c1 = this.it = 42; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:77:14: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var d2 = it(); -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:78:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var d3 = this.it.call(); -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:79:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var d4 = it.call(); +// pkg/front_end/testcases/extension_types/field_access.dart:75:14: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c2 = it = 42; // Error, should not resolve to extension method. // ^^ // // pkg/front_end/testcases/extension_types/field_access.dart:89:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. @@ -261,24 +221,14 @@ library; // var d6 = genericFunctionInlineClass.it = () => throw ''; // Error, should // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:142:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var e1 = dynamicInlineClass.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:143:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var e2 = dynamicInlineClass.it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:143:33: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var e2 = dynamicInlineClass.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:144:31: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var e3 = dynamicInlineClass.it(); +// pkg/front_end/testcases/extension_types/field_access.dart:145:31: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var e4 = dynamicInlineClass.it = '42'; // Error, should not resolve // ^^ // // pkg/front_end/testcases/extension_types/field_access.dart:149:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. @@ -408,24 +358,24 @@ static inline-class-member method GenericInlineClass|constructor#(self::GenericInlineClass|constructor#_#new#tearOff::T% it) → self::GenericInlineClass% /* = self::GenericInlineClass|constructor#_#new#tearOff::T% */ return self::GenericInlineClass|constructor#(it); static inline-class-member method GenericInlineClass|test(lowered final self::GenericInlineClass /* = self::GenericInlineClass|test::T% */ #this, self::GenericInlineClass|test::T% t) → void { - dynamic a1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:24:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a1 = this.it; - ^^" in #this{}.it; - dynamic a2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:25:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a2 = it; - ^^" in #this{}.it; - invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. + self::GenericInlineClass|test::T% a1 = #this as{Unchecked} self::GenericInlineClass|test::T%; + self::GenericInlineClass|test::T% a2 = #this as{Unchecked} self::GenericInlineClass|test::T%; + invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. Try changing the operand or remove the type arguments. var b1 = this.it; // Error ^"; - invalid-type b2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. + invalid-type b2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. Try changing the operand or remove the type arguments. var b2 = it; // Error ^"; - self::GenericInlineClass|test::T% c1 = let final self::GenericInlineClass|test::T% #t1 = t in let final void #t2 = self::_extension#0|set#it(#this, #t1) in #t1; - self::GenericInlineClass|test::T% c2 = let final self::GenericInlineClass|test::T% #t3 = t in let final void #t4 = self::_extension#0|set#it(#this, #t3) in #t3; + self::GenericInlineClass|test::T% c1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:28:19: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c1 = this.it = t; // Error, should not resolve to extension method. + ^^" in #this{}.it = t; + self::GenericInlineClass|test::T% c2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:29:14: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c2 = it = t; // Error, should not resolve to extension method. + ^^" in #this{}.it = t; } static inline-class-member method GenericInlineClass|get#test(lowered final self::GenericInlineClass% /* = self::GenericInlineClass|get#test::T% */ #this) → (self::GenericInlineClass|get#test::T%) → void return (self::GenericInlineClass|get#test::T% t) → void => self::GenericInlineClass|test(#this, t); @@ -504,14 +454,8 @@ static inline-class-member method DynamicInlineClass|constructor#(dynamic it) static inline-class-member method DynamicInlineClass|constructor#_#new#tearOff(dynamic it) → self::DynamicInlineClass /* = dynamic */ return self::DynamicInlineClass|constructor#(it); static inline-class-member method DynamicInlineClass|test(lowered final self::DynamicInlineClass /* = dynamic */ #this) → void { - dynamic a1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:70:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a1 = this.it; - ^^" in #this{}.it; - dynamic a2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:71:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a2 = it; - ^^" in #this{}.it; + dynamic a1 = #this as{Unchecked} dynamic; + dynamic a2 = #this as{Unchecked} dynamic; invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:72:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. Try changing the operand or remove the type arguments. var b1 = this.it; // Error @@ -520,24 +464,18 @@ Try changing the operand or remove the type arguments. Try changing the operand or remove the type arguments. var b2 = it; // Error ^"; - core::int c1 = let final core::int #t5 = 42 in let final void #t6 = self::_extension#0|set#it(#this, #t5) in #t5; - core::int c2 = let final core::int #t7 = 42 in let final void #t8 = self::_extension#0|set#it(#this, #t7) in #t7; - dynamic d1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:76:19: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var d1 = this.it(); - ^^" in #this{}.it(); - dynamic d2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:77:14: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var d2 = it(); - ^^" in #this{}.it(); - dynamic d3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:78:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var d3 = this.it.call(); - ^^" in #this{}.it{dynamic}.call(); - dynamic d4 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:79:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var d4 = it.call(); - ^^" in #this{}.it{dynamic}.call(); + core::int c1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:74:19: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c1 = this.it = 42; // Error, should not resolve to extension method. + ^^" in #this{}.it = 42; + core::int c2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:75:14: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c2 = it = 42; // Error, should not resolve to extension method. + ^^" in #this{}.it = 42; + dynamic d1 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d2 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d3 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d4 = (#this as{Unchecked} dynamic){dynamic}.call(); } static inline-class-member method DynamicInlineClass|get#test(lowered final self::DynamicInlineClass /* = dynamic */ #this) → () → void return () → void => self::DynamicInlineClass|test(#this); @@ -658,19 +596,16 @@ Try correcting the name to the name of an existing setter, or defining a setter Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. var d6 = genericFunctionInlineClass.it = () => throw ''; // Error, should ^^" in genericFunctionInlineClass{}.it = () → Never => throw ""; - dynamic e1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:142:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var e1 = dynamicInlineClass.it; - ^^" in dynamicInlineClass{}.it; + dynamic e1 = dynamicInlineClass as{Unchecked} dynamic; invalid-type e2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:143:33: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. Try changing the operand or remove the type arguments. var e2 = dynamicInlineClass.it; // Error ^"; - dynamic e3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:144:31: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var e3 = dynamicInlineClass.it(); - ^^" in dynamicInlineClass{}.it(); - core::String e4 = let final core::String #t9 = "42" in let final void #t10 = self::_extension#0|set#it(dynamicInlineClass, #t9) in #t9; + dynamic e3 = (dynamicInlineClass as{Unchecked} dynamic){dynamic}.call(); + core::String e4 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:145:31: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var e4 = dynamicInlineClass.it = '42'; // Error, should not resolve + ^^" in dynamicInlineClass{}.it = "42"; core::int f1 = erroneousInlineClass as{Unchecked} core::int; invalid-type f2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:149:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. Try changing the operand or remove the type arguments. diff --git a/pkg/front_end/testcases/extension_types/field_access.dart.weak.modular.expect b/pkg/front_end/testcases/extension_types/field_access.dart.weak.modular.expect index da941a3ec62..eefae8980e1 100644 --- a/pkg/front_end/testcases/extension_types/field_access.dart.weak.modular.expect +++ b/pkg/front_end/testcases/extension_types/field_access.dart.weak.modular.expect @@ -26,36 +26,26 @@ library; // var c2 = it = 42; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:24:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a1 = this.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:25:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a2 = it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:26:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b1 = this.it; // Error -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. +// pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:27:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b2 = it; // Error -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. +// pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. // Try changing the operand or remove the type arguments. // var b2 = it; // Error // ^ // +// pkg/front_end/testcases/extension_types/field_access.dart:28:19: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c1 = this.it = t; // Error, should not resolve to extension method. +// ^^ +// +// pkg/front_end/testcases/extension_types/field_access.dart:29:14: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c2 = it = t; // Error, should not resolve to extension method. +// ^^ +// // pkg/front_end/testcases/extension_types/field_access.dart:37:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T Function()'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error @@ -96,54 +86,24 @@ library; // var c2 = it = t; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:70:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a1 = this.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:71:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a2 = it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:72:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b1 = this.it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:72:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:73:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b2 = it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:73:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var b2 = it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:76:19: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var d1 = this.it(); +// pkg/front_end/testcases/extension_types/field_access.dart:74:19: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c1 = this.it = 42; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:77:14: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var d2 = it(); -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:78:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var d3 = this.it.call(); -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:79:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var d4 = it.call(); +// pkg/front_end/testcases/extension_types/field_access.dart:75:14: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c2 = it = 42; // Error, should not resolve to extension method. // ^^ // // pkg/front_end/testcases/extension_types/field_access.dart:89:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. @@ -261,24 +221,14 @@ library; // var d6 = genericFunctionInlineClass.it = () => throw ''; // Error, should // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:142:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var e1 = dynamicInlineClass.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:143:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var e2 = dynamicInlineClass.it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:143:33: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var e2 = dynamicInlineClass.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:144:31: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var e3 = dynamicInlineClass.it(); +// pkg/front_end/testcases/extension_types/field_access.dart:145:31: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var e4 = dynamicInlineClass.it = '42'; // Error, should not resolve // ^^ // // pkg/front_end/testcases/extension_types/field_access.dart:149:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. @@ -408,24 +358,24 @@ static inline-class-member method GenericInlineClass|constructor#(self::GenericInlineClass|constructor#_#new#tearOff::T% it) → self::GenericInlineClass% /* = self::GenericInlineClass|constructor#_#new#tearOff::T% */ return self::GenericInlineClass|constructor#(it); static inline-class-member method GenericInlineClass|test(lowered final self::GenericInlineClass /* = self::GenericInlineClass|test::T% */ #this, self::GenericInlineClass|test::T% t) → void { - dynamic a1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:24:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a1 = this.it; - ^^" in #this{}.it; - dynamic a2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:25:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a2 = it; - ^^" in #this{}.it; - invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. + self::GenericInlineClass|test::T% a1 = #this as{Unchecked} self::GenericInlineClass|test::T%; + self::GenericInlineClass|test::T% a2 = #this as{Unchecked} self::GenericInlineClass|test::T%; + invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. Try changing the operand or remove the type arguments. var b1 = this.it; // Error ^"; - invalid-type b2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. + invalid-type b2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. Try changing the operand or remove the type arguments. var b2 = it; // Error ^"; - self::GenericInlineClass|test::T% c1 = let final self::GenericInlineClass|test::T% #t1 = t in let final void #t2 = self::_extension#0|set#it(#this, #t1) in #t1; - self::GenericInlineClass|test::T% c2 = let final self::GenericInlineClass|test::T% #t3 = t in let final void #t4 = self::_extension#0|set#it(#this, #t3) in #t3; + self::GenericInlineClass|test::T% c1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:28:19: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c1 = this.it = t; // Error, should not resolve to extension method. + ^^" in #this{}.it = t; + self::GenericInlineClass|test::T% c2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:29:14: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c2 = it = t; // Error, should not resolve to extension method. + ^^" in #this{}.it = t; } static inline-class-member method GenericInlineClass|get#test(lowered final self::GenericInlineClass% /* = self::GenericInlineClass|get#test::T% */ #this) → (self::GenericInlineClass|get#test::T%) → void return (self::GenericInlineClass|get#test::T% t) → void => self::GenericInlineClass|test(#this, t); @@ -504,14 +454,8 @@ static inline-class-member method DynamicInlineClass|constructor#(dynamic it) static inline-class-member method DynamicInlineClass|constructor#_#new#tearOff(dynamic it) → self::DynamicInlineClass /* = dynamic */ return self::DynamicInlineClass|constructor#(it); static inline-class-member method DynamicInlineClass|test(lowered final self::DynamicInlineClass /* = dynamic */ #this) → void { - dynamic a1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:70:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a1 = this.it; - ^^" in #this{}.it; - dynamic a2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:71:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a2 = it; - ^^" in #this{}.it; + dynamic a1 = #this as{Unchecked} dynamic; + dynamic a2 = #this as{Unchecked} dynamic; invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:72:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. Try changing the operand or remove the type arguments. var b1 = this.it; // Error @@ -520,24 +464,18 @@ Try changing the operand or remove the type arguments. Try changing the operand or remove the type arguments. var b2 = it; // Error ^"; - core::int c1 = let final core::int #t5 = 42 in let final void #t6 = self::_extension#0|set#it(#this, #t5) in #t5; - core::int c2 = let final core::int #t7 = 42 in let final void #t8 = self::_extension#0|set#it(#this, #t7) in #t7; - dynamic d1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:76:19: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var d1 = this.it(); - ^^" in #this{}.it(); - dynamic d2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:77:14: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var d2 = it(); - ^^" in #this{}.it(); - dynamic d3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:78:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var d3 = this.it.call(); - ^^" in #this{}.it{dynamic}.call(); - dynamic d4 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:79:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var d4 = it.call(); - ^^" in #this{}.it{dynamic}.call(); + core::int c1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:74:19: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c1 = this.it = 42; // Error, should not resolve to extension method. + ^^" in #this{}.it = 42; + core::int c2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:75:14: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c2 = it = 42; // Error, should not resolve to extension method. + ^^" in #this{}.it = 42; + dynamic d1 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d2 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d3 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d4 = (#this as{Unchecked} dynamic){dynamic}.call(); } static inline-class-member method DynamicInlineClass|get#test(lowered final self::DynamicInlineClass /* = dynamic */ #this) → () → void return () → void => self::DynamicInlineClass|test(#this); @@ -658,19 +596,16 @@ Try correcting the name to the name of an existing setter, or defining a setter Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. var d6 = genericFunctionInlineClass.it = () => throw ''; // Error, should ^^" in genericFunctionInlineClass{}.it = () → Never => throw ""; - dynamic e1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:142:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var e1 = dynamicInlineClass.it; - ^^" in dynamicInlineClass{}.it; + dynamic e1 = dynamicInlineClass as{Unchecked} dynamic; invalid-type e2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:143:33: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. Try changing the operand or remove the type arguments. var e2 = dynamicInlineClass.it; // Error ^"; - dynamic e3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:144:31: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var e3 = dynamicInlineClass.it(); - ^^" in dynamicInlineClass{}.it(); - core::String e4 = let final core::String #t9 = "42" in let final void #t10 = self::_extension#0|set#it(dynamicInlineClass, #t9) in #t9; + dynamic e3 = (dynamicInlineClass as{Unchecked} dynamic){dynamic}.call(); + core::String e4 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:145:31: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var e4 = dynamicInlineClass.it = '42'; // Error, should not resolve + ^^" in dynamicInlineClass{}.it = "42"; core::int f1 = erroneousInlineClass as{Unchecked} core::int; invalid-type f2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:149:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. Try changing the operand or remove the type arguments. diff --git a/pkg/front_end/testcases/extension_types/field_access.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/field_access.dart.weak.transformed.expect index fc00021b589..eefae8980e1 100644 --- a/pkg/front_end/testcases/extension_types/field_access.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/extension_types/field_access.dart.weak.transformed.expect @@ -26,36 +26,26 @@ library; // var c2 = it = 42; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:24:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a1 = this.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:25:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a2 = it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:26:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b1 = this.it; // Error -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. +// pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:27:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b2 = it; // Error -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. +// pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. // Try changing the operand or remove the type arguments. // var b2 = it; // Error // ^ // +// pkg/front_end/testcases/extension_types/field_access.dart:28:19: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c1 = this.it = t; // Error, should not resolve to extension method. +// ^^ +// +// pkg/front_end/testcases/extension_types/field_access.dart:29:14: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c2 = it = t; // Error, should not resolve to extension method. +// ^^ +// // pkg/front_end/testcases/extension_types/field_access.dart:37:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T Function()'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error @@ -96,54 +86,24 @@ library; // var c2 = it = t; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:70:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a1 = this.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:71:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var a2 = it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:72:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b1 = this.it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:72:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var b1 = this.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:73:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var b2 = it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:73:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var b2 = it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:76:19: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var d1 = this.it(); +// pkg/front_end/testcases/extension_types/field_access.dart:74:19: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c1 = this.it = 42; // Error, should not resolve to extension method. // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:77:14: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var d2 = it(); -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:78:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var d3 = this.it.call(); -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:79:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var d4 = it.call(); +// pkg/front_end/testcases/extension_types/field_access.dart:75:14: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var c2 = it = 42; // Error, should not resolve to extension method. // ^^ // // pkg/front_end/testcases/extension_types/field_access.dart:89:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. @@ -261,24 +221,14 @@ library; // var d6 = genericFunctionInlineClass.it = () => throw ''; // Error, should // ^^ // -// pkg/front_end/testcases/extension_types/field_access.dart:142:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var e1 = dynamicInlineClass.it; -// ^^ -// -// pkg/front_end/testcases/extension_types/field_access.dart:143:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. -// var e2 = dynamicInlineClass.it; // Error -// ^^ -// // pkg/front_end/testcases/extension_types/field_access.dart:143:33: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. // Try changing the operand or remove the type arguments. // var e2 = dynamicInlineClass.it; // Error // ^ // -// pkg/front_end/testcases/extension_types/field_access.dart:144:31: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -// Try correcting the name to the name of an existing method, or defining a method named 'it'. -// var e3 = dynamicInlineClass.it(); +// pkg/front_end/testcases/extension_types/field_access.dart:145:31: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +// Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. +// var e4 = dynamicInlineClass.it = '42'; // Error, should not resolve // ^^ // // pkg/front_end/testcases/extension_types/field_access.dart:149:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. @@ -408,24 +358,24 @@ static inline-class-member method GenericInlineClass|constructor#(self::GenericInlineClass|constructor#_#new#tearOff::T% it) → self::GenericInlineClass% /* = self::GenericInlineClass|constructor#_#new#tearOff::T% */ return self::GenericInlineClass|constructor#(it); static inline-class-member method GenericInlineClass|test(lowered final self::GenericInlineClass /* = self::GenericInlineClass|test::T% */ #this, self::GenericInlineClass|test::T% t) → void { - dynamic a1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:24:19: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a1 = this.it; - ^^" in #this{}.it; - dynamic a2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:25:14: Error: The getter 'it' isn't defined for the class 'GenericInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a2 = it; - ^^" in #this{}.it; - invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. + self::GenericInlineClass|test::T% a1 = #this as{Unchecked} self::GenericInlineClass|test::T%; + self::GenericInlineClass|test::T% a2 = #this as{Unchecked} self::GenericInlineClass|test::T%; + invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:26:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. Try changing the operand or remove the type arguments. var b1 = this.it; // Error ^"; - invalid-type b2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. + invalid-type b2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:27:16: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'. Try changing the operand or remove the type arguments. var b2 = it; // Error ^"; - self::GenericInlineClass|test::T% c1 = let final self::GenericInlineClass|test::T% #t1 = t in let final void #t2 = self::_extension#0|set#it(#this, #t1) in #t1; - self::GenericInlineClass|test::T% c2 = let final self::GenericInlineClass|test::T% #t3 = t in let final void #t4 = self::_extension#0|set#it(#this, #t3) in #t3; + self::GenericInlineClass|test::T% c1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:28:19: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c1 = this.it = t; // Error, should not resolve to extension method. + ^^" in #this{}.it = t; + self::GenericInlineClass|test::T% c2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:29:14: Error: The setter 'it' isn't defined for the class 'GenericInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c2 = it = t; // Error, should not resolve to extension method. + ^^" in #this{}.it = t; } static inline-class-member method GenericInlineClass|get#test(lowered final self::GenericInlineClass% /* = self::GenericInlineClass|get#test::T% */ #this) → (self::GenericInlineClass|get#test::T%) → void return (self::GenericInlineClass|get#test::T% t) → void => self::GenericInlineClass|test(#this, t); @@ -504,14 +454,8 @@ static inline-class-member method DynamicInlineClass|constructor#(dynamic it) static inline-class-member method DynamicInlineClass|constructor#_#new#tearOff(dynamic it) → self::DynamicInlineClass /* = dynamic */ return self::DynamicInlineClass|constructor#(it); static inline-class-member method DynamicInlineClass|test(lowered final self::DynamicInlineClass /* = dynamic */ #this) → void { - dynamic a1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:70:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a1 = this.it; - ^^" in #this{}.it; - dynamic a2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:71:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var a2 = it; - ^^" in #this{}.it; + dynamic a1 = #this as{Unchecked} dynamic; + dynamic a2 = #this as{Unchecked} dynamic; invalid-type b1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:72:21: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. Try changing the operand or remove the type arguments. var b1 = this.it; // Error @@ -520,24 +464,18 @@ Try changing the operand or remove the type arguments. Try changing the operand or remove the type arguments. var b2 = it; // Error ^"; - core::int c1 = let final core::int #t5 = 42 in let final void #t6 = self::_extension#0|set#it(#this, #t5) in #t5; - core::int c2 = let final core::int #t7 = 42 in let final void #t8 = self::_extension#0|set#it(#this, #t7) in #t7; - dynamic d1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:76:19: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var d1 = this.it(); - ^^" in #this{}.it(); - dynamic d2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:77:14: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var d2 = it(); - ^^" in #this{}.it(); - dynamic d3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:78:19: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var d3 = this.it.call(); - ^^" in #this{}.it{dynamic}.call(); - dynamic d4 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:79:14: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var d4 = it.call(); - ^^" in #this{}.it{dynamic}.call(); + core::int c1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:74:19: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c1 = this.it = 42; // Error, should not resolve to extension method. + ^^" in #this{}.it = 42; + core::int c2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:75:14: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var c2 = it = 42; // Error, should not resolve to extension method. + ^^" in #this{}.it = 42; + dynamic d1 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d2 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d3 = (#this as{Unchecked} dynamic){dynamic}.call(); + dynamic d4 = (#this as{Unchecked} dynamic){dynamic}.call(); } static inline-class-member method DynamicInlineClass|get#test(lowered final self::DynamicInlineClass /* = dynamic */ #this) → () → void return () → void => self::DynamicInlineClass|test(#this); @@ -658,19 +596,16 @@ Try correcting the name to the name of an existing setter, or defining a setter Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. var d6 = genericFunctionInlineClass.it = () => throw ''; // Error, should ^^" in genericFunctionInlineClass{}.it = () → Never => throw ""; - dynamic e1 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:142:31: Error: The getter 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing getter, or defining a getter or field named 'it'. - var e1 = dynamicInlineClass.it; - ^^" in dynamicInlineClass{}.it; + dynamic e1 = dynamicInlineClass as{Unchecked} dynamic; invalid-type e2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:143:33: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'. Try changing the operand or remove the type arguments. var e2 = dynamicInlineClass.it; // Error ^"; - dynamic e3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:144:31: Error: The method 'it' isn't defined for the class 'DynamicInlineClass'. -Try correcting the name to the name of an existing method, or defining a method named 'it'. - var e3 = dynamicInlineClass.it(); - ^^" in dynamicInlineClass{}.it(); - core::String e4 = let final core::String #t9 = "42" in let final void #t10 = self::_extension#0|set#it(dynamicInlineClass, #t9) in #t9; + dynamic e3 = (dynamicInlineClass as{Unchecked} dynamic){dynamic}.call(); + core::String e4 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:145:31: Error: The setter 'it' isn't defined for the class 'DynamicInlineClass'. +Try correcting the name to the name of an existing setter, or defining a setter or field named 'it'. + var e4 = dynamicInlineClass.it = '42'; // Error, should not resolve + ^^" in dynamicInlineClass{}.it = "42"; core::int f1 = erroneousInlineClass as{Unchecked} core::int; invalid-type f2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:149:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int'. Try changing the operand or remove the type arguments. @@ -765,13 +700,3 @@ Try correcting the name to the name of an existing setter, or defining a setter } static inline-class-member method PrivateInlineClass|get#test(lowered final self2::PrivateInlineClass /* = core::int */ #this) → () → void return () → void => self2::PrivateInlineClass|test(#this); - - -Extra constant evaluation status: -Evaluated: VariableGet @ org-dartlang-testcase:///field_access.dart:74:24 -> IntConstant(42) -Evaluated: VariableGet @ org-dartlang-testcase:///field_access.dart:74:24 -> IntConstant(42) -Evaluated: VariableGet @ org-dartlang-testcase:///field_access.dart:75:19 -> IntConstant(42) -Evaluated: VariableGet @ org-dartlang-testcase:///field_access.dart:75:19 -> IntConstant(42) -Evaluated: VariableGet @ org-dartlang-testcase:///field_access.dart:145:36 -> StringConstant("42") -Evaluated: VariableGet @ org-dartlang-testcase:///field_access.dart:145:36 -> StringConstant("42") -Extra constant evaluation: evaluated: 182, effectively constant: 6 diff --git a/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart new file mode 100644 index 00000000000..26ec8b37b39 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart @@ -0,0 +1,129 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by b +// BSD-style license that can be found in the LICENSE file. + +extension type ET1(int i) { + ET1? operator +(ET1? i) => i; + int operator -() => i; + int operator [](int index) => i; + void operator []=(int index, int value) {} + void foo(int i) {} + int get getter => i; + void set setter(int value) {} +} + +extension type ET2(T t) { + ET2? operator +(ET2? t) => t; + T operator -() => t; + T operator [](int index) => t; + void operator []=(int index, T value) {} + void foo(T t) {} + T get getter => t; + void set setter(T value) {} +} + +method1(ET1 et) { + et.foo(0); // Ok + et.foo; // Ok + et.setter = et.getter; // Ok + et + et; // Ok + -et; // Ok + et[0]; // Ok + et[0] = 0; // Ok +} + +method2(ET1? et) { + et.foo(0); // Error + et.foo; // Error + et.setter = // Error + et.getter; // Error + et + et; // Error + -et; // Error + et[0]; // Error + et[0] = 0; // Error +} + +method3(S s, ET2 et) { + et.foo(s); // Ok + et.foo; // Ok + et.setter = et.getter; // Ok + et + et; // Ok + -et; // Ok + et[0]; // Ok + et[0] = s; // Ok +} + +method4(S s, ET2? et) { + et.foo(s); // Error + et.foo; // Error + et.setter = // Error + et.getter; // Error + et + et; // Error + -et; // Error + et[0]; // Error + et[0] = s; // Error +} + +method5>(S s, U et) { + et.foo(s); // Ok + et.foo; // Ok + et.setter = et.getter; // Ok + et + et; // Ok + -et; // Ok + et[0]; // Ok + et[0] = s; // Ok +} + +method6>(S s, U? et) { + et.foo(s); // Error + et.foo; // Error + et.setter = // Error + et.getter; // Error + et + et; // Error + -et; // Error + et[0]; // Error + et[0] = s; // Error +} + +method7, V extends U>(S s, V et) { + et.foo(s); // Ok + et.foo; // Ok + et.setter = et.getter; // Ok + et + et; // Ok + -et; // Ok + et[0]; // Ok + et[0] = s; // Ok +} + +method8, V extends U>(S s, V? et) { + et.foo(s); // Error + et.foo; // Error + et.setter = // Error + et.getter; // Error + et + et; // Error + -et; // Error + et[0]; // Error + et[0] = s; // Error +} + +method9, V extends U?>(S s, V et) { + et.foo(s); // Error + et.foo; // Error + et.setter = // Error + et.getter; // Error + et + et; // Error + -et; // Error + et[0]; // Error + et[0] = s; // Error +} + +method10?, V extends U>(S s, V et) { + et.foo(s); // Error + et.foo; // Error + et.setter = // Error + et.getter; // Error + et + et; // Error + -et; // Error + et[0]; // Error + et[0] = s; // Error +} diff --git a/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.strong.expect b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.strong.expect new file mode 100644 index 00000000000..160bed7fde2 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.strong.expect @@ -0,0 +1,497 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:36:6: Error: Method 'foo' cannot be called on 'ET1?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(0); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:37:6: Error: Property 'foo' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:39:6: Error: Property 'getter' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:38:6: Error: Property 'setter' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:40:6: Error: Operator '+' cannot be called on 'ET1?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:41:3: Error: Operator 'unary-' cannot be called on 'ET1?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:42:5: Error: Operator '[]' cannot be called on 'ET1?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:43:5: Error: Operator '[]=' cannot be called on 'ET1?' because it is potentially null. +// et[0] = 0; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:57:6: Error: Method 'foo' cannot be called on 'ET2?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:58:6: Error: Property 'foo' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:60:6: Error: Property 'getter' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:59:6: Error: Property 'setter' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:61:6: Error: Operator '+' cannot be called on 'ET2?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:62:3: Error: Operator 'unary-' cannot be called on 'ET2?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:63:5: Error: Operator '[]' cannot be called on 'ET2?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:64:5: Error: Operator '[]=' cannot be called on 'ET2?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:78:6: Error: Method 'foo' cannot be called on 'U?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:79:6: Error: Property 'foo' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:81:6: Error: Property 'getter' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:80:6: Error: Property 'setter' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:82:6: Error: Operator '+' cannot be called on 'U?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:83:3: Error: Operator 'unary-' cannot be called on 'U?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:84:5: Error: Operator '[]' cannot be called on 'U?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:85:5: Error: Operator '[]=' cannot be called on 'U?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:99:6: Error: Method 'foo' cannot be called on 'V?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:100:6: Error: Property 'foo' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:102:6: Error: Property 'getter' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:101:6: Error: Property 'setter' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:103:6: Error: Operator '+' cannot be called on 'V?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:104:3: Error: Operator 'unary-' cannot be called on 'V?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:105:5: Error: Operator '[]' cannot be called on 'V?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:106:5: Error: Operator '[]=' cannot be called on 'V?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:110:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:111:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:113:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:112:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:114:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:115:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:116:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:117:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:121:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:122:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:124:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:123:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:125:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:126:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:127:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:128:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. +// et[0] = s; // Error +// ^ +// +import self as self; +import "dart:core" as core; + +extension type ET1(core::int i) { + abstract inline-class-member representation-field get i() → core::int; + operator + = self::ET1|+; + operator unary- = self::ET1|unary-; + operator [] = self::ET1|[]; + operator []= = self::ET1|[]=; + method foo = self::ET1|foo; + method tearoff foo = self::ET1|get#foo; + get getter = self::ET1|get#getter; + set setter = self::ET1|set#setter; + constructor • = self::ET1|constructor#; + constructor tearoff • = self::ET1|constructor#_#new#tearOff; +} +extension type ET2(T% t) { + abstract inline-class-member representation-field get t() → T%; + operator + = self::ET2|+; + operator unary- = self::ET2|unary-; + operator [] = self::ET2|[]; + operator []= = self::ET2|[]=; + method foo = self::ET2|foo; + method tearoff foo = self::ET2|get#foo; + get getter = self::ET2|get#getter; + set setter = self::ET2|set#setter; + constructor • = self::ET2|constructor#; + constructor tearoff • = self::ET2|constructor#_#new#tearOff; +} +static inline-class-member method ET1|constructor#(core::int i) → self::ET1 /* = core::int */ { + lowered final self::ET1 /* = core::int */ #this = i; + return #this; +} +static inline-class-member method ET1|constructor#_#new#tearOff(core::int i) → self::ET1 /* = core::int */ + return self::ET1|constructor#(i); +static inline-class-member method ET1|+(lowered final self::ET1 /* = core::int */ #this, self::ET1? /* = core::int? */ i) → self::ET1? /* = core::int? */ + return i; +static inline-class-member method ET1|unary-(lowered final self::ET1 /* = core::int */ #this) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|[](lowered final self::ET1 /* = core::int */ #this, core::int index) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|[]=(lowered final self::ET1 /* = core::int */ #this, core::int index, core::int value) → void {} +static inline-class-member method ET1|foo(lowered final self::ET1 /* = core::int */ #this, core::int i) → void {} +static inline-class-member method ET1|get#foo(lowered final self::ET1 /* = core::int */ #this) → (core::int) → void + return (core::int i) → void => self::ET1|foo(#this, i); +static inline-class-member method ET1|get#getter(lowered final self::ET1 /* = core::int */ #this) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|set#setter(lowered final self::ET1 /* = core::int */ #this, core::int value) → void {} +static inline-class-member method ET2|constructor#(self::ET2|constructor#::T% t) → self::ET2 /* = self::ET2|constructor#::T% */ { + lowered final self::ET2 /* = self::ET2|constructor#::T% */ #this = t; + return #this; +} +static inline-class-member method ET2|constructor#_#new#tearOff(self::ET2|constructor#_#new#tearOff::T% t) → self::ET2% /* = self::ET2|constructor#_#new#tearOff::T% */ + return self::ET2|constructor#(t); +static inline-class-member method ET2|+(lowered final self::ET2 /* = self::ET2|+::T% */ #this, self::ET2? /* = self::ET2|+::T? */ t) → self::ET2? /* = self::ET2|+::T? */ + return t; +static inline-class-member method ET2|unary-(lowered final self::ET2 /* = self::ET2|unary-::T% */ #this) → self::ET2|unary-::T% + return #this as{Unchecked} self::ET2|unary-::T%; +static inline-class-member method ET2|[](lowered final self::ET2 /* = self::ET2|[]::T% */ #this, core::int index) → self::ET2|[]::T% + return #this as{Unchecked} self::ET2|[]::T%; +static inline-class-member method ET2|[]=(lowered final self::ET2 /* = self::ET2|[]=::T% */ #this, core::int index, self::ET2|[]=::T% value) → void {} +static inline-class-member method ET2|foo(lowered final self::ET2 /* = self::ET2|foo::T% */ #this, self::ET2|foo::T% t) → void {} +static inline-class-member method ET2|get#foo(lowered final self::ET2% /* = self::ET2|get#foo::T% */ #this) → (self::ET2|get#foo::T%) → void + return (self::ET2|get#foo::T% t) → void => self::ET2|foo(#this, t); +static inline-class-member method ET2|get#getter(lowered final self::ET2 /* = self::ET2|get#getter::T% */ #this) → self::ET2|get#getter::T% + return #this as{Unchecked} self::ET2|get#getter::T%; +static inline-class-member method ET2|set#setter(lowered final self::ET2 /* = self::ET2|set#setter::T% */ #this, self::ET2|set#setter::T% value) → void {} +static method method1(self::ET1 /* = core::int */ et) → dynamic { + self::ET1|foo(et, 0); + self::ET1|get#foo(et); + self::ET1|set#setter(et, self::ET1|get#getter(et)); + self::ET1|+(et, et); + self::ET1|unary-(et); + self::ET1|[](et, 0); + self::ET1|[]=(et, 0, 0); +} +static method method2(self::ET1? /* = core::int? */ et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:36:6: Error: Method 'foo' cannot be called on 'ET1?' because it is potentially null. +Try calling using ?. instead. + et.foo(0); // Error + ^^^" in self::ET1|foo(et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:37:6: Error: Property 'foo' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET1|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:38:6: Error: Property 'setter' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET1|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:39:6: Error: Property 'getter' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET1|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:40:6: Error: Operator '+' cannot be called on 'ET1?' because it is potentially null. + et + et; // Error + ^" in self::ET1|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:41:3: Error: Operator 'unary-' cannot be called on 'ET1?' because it is potentially null. + -et; // Error + ^" in self::ET1|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:42:5: Error: Operator '[]' cannot be called on 'ET1?' because it is potentially null. + et[0]; // Error + ^" in self::ET1|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:43:5: Error: Operator '[]=' cannot be called on 'ET1?' because it is potentially null. + et[0] = 0; // Error + ^" in self::ET1|[]=(et, 0, 0); +} +static method method3(self::method3::S% s, self::ET2 /* = self::method3::S% */ et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method4(self::method4::S% s, self::ET2? /* = self::method4::S? */ et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:57:6: Error: Method 'foo' cannot be called on 'ET2?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:58:6: Error: Property 'foo' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:59:6: Error: Property 'setter' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:60:6: Error: Property 'getter' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:61:6: Error: Operator '+' cannot be called on 'ET2?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:62:3: Error: Operator 'unary-' cannot be called on 'ET2?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:63:5: Error: Operator '[]' cannot be called on 'ET2?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:64:5: Error: Operator '[]=' cannot be called on 'ET2?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method5 /* = self::method5::S% */ = self::ET2 /* = dynamic */>(self::method5::S% s, self::method5::U% et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method6 /* = self::method6::S% */ = self::ET2 /* = dynamic */>(self::method6::S% s, self::method6::U? et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:78:6: Error: Method 'foo' cannot be called on 'U?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:79:6: Error: Property 'foo' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:80:6: Error: Property 'setter' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:81:6: Error: Property 'getter' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:82:6: Error: Operator '+' cannot be called on 'U?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:83:3: Error: Operator 'unary-' cannot be called on 'U?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:84:5: Error: Operator '[]' cannot be called on 'U?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:85:5: Error: Operator '[]=' cannot be called on 'U?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method7 /* = self::method7::S% */ = self::ET2 /* = dynamic */, V extends self::method7::U% = self::ET2 /* = dynamic */>(self::method7::S% s, self::method7::V% et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method8 /* = self::method8::S% */ = self::ET2 /* = dynamic */, V extends self::method8::U% = self::ET2 /* = dynamic */>(self::method8::S% s, self::method8::V? et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:99:6: Error: Method 'foo' cannot be called on 'V?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:100:6: Error: Property 'foo' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:101:6: Error: Property 'setter' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:102:6: Error: Property 'getter' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:103:6: Error: Operator '+' cannot be called on 'V?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:104:3: Error: Operator 'unary-' cannot be called on 'V?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:105:5: Error: Operator '[]' cannot be called on 'V?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:106:5: Error: Operator '[]=' cannot be called on 'V?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method9 /* = self::method9::S% */ = self::ET2 /* = dynamic */, V extends self::method9::U? = self::ET2? /* = dynamic */>(self::method9::S% s, self::method9::V% et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:110:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:111:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:112:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:113:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:114:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:115:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:116:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:117:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method10? /* = self::method10::S? */ = self::ET2? /* = dynamic */, V extends self::method10::U% = self::ET2? /* = dynamic */>(self::method10::S% s, self::method10::V% et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:121:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:122:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:123:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:124:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:125:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:126:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:127:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:128:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} diff --git a/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.strong.transformed.expect new file mode 100644 index 00000000000..160bed7fde2 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.strong.transformed.expect @@ -0,0 +1,497 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:36:6: Error: Method 'foo' cannot be called on 'ET1?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(0); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:37:6: Error: Property 'foo' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:39:6: Error: Property 'getter' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:38:6: Error: Property 'setter' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:40:6: Error: Operator '+' cannot be called on 'ET1?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:41:3: Error: Operator 'unary-' cannot be called on 'ET1?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:42:5: Error: Operator '[]' cannot be called on 'ET1?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:43:5: Error: Operator '[]=' cannot be called on 'ET1?' because it is potentially null. +// et[0] = 0; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:57:6: Error: Method 'foo' cannot be called on 'ET2?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:58:6: Error: Property 'foo' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:60:6: Error: Property 'getter' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:59:6: Error: Property 'setter' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:61:6: Error: Operator '+' cannot be called on 'ET2?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:62:3: Error: Operator 'unary-' cannot be called on 'ET2?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:63:5: Error: Operator '[]' cannot be called on 'ET2?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:64:5: Error: Operator '[]=' cannot be called on 'ET2?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:78:6: Error: Method 'foo' cannot be called on 'U?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:79:6: Error: Property 'foo' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:81:6: Error: Property 'getter' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:80:6: Error: Property 'setter' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:82:6: Error: Operator '+' cannot be called on 'U?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:83:3: Error: Operator 'unary-' cannot be called on 'U?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:84:5: Error: Operator '[]' cannot be called on 'U?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:85:5: Error: Operator '[]=' cannot be called on 'U?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:99:6: Error: Method 'foo' cannot be called on 'V?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:100:6: Error: Property 'foo' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:102:6: Error: Property 'getter' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:101:6: Error: Property 'setter' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:103:6: Error: Operator '+' cannot be called on 'V?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:104:3: Error: Operator 'unary-' cannot be called on 'V?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:105:5: Error: Operator '[]' cannot be called on 'V?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:106:5: Error: Operator '[]=' cannot be called on 'V?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:110:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:111:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:113:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:112:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:114:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:115:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:116:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:117:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:121:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:122:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:124:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:123:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:125:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:126:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:127:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:128:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. +// et[0] = s; // Error +// ^ +// +import self as self; +import "dart:core" as core; + +extension type ET1(core::int i) { + abstract inline-class-member representation-field get i() → core::int; + operator + = self::ET1|+; + operator unary- = self::ET1|unary-; + operator [] = self::ET1|[]; + operator []= = self::ET1|[]=; + method foo = self::ET1|foo; + method tearoff foo = self::ET1|get#foo; + get getter = self::ET1|get#getter; + set setter = self::ET1|set#setter; + constructor • = self::ET1|constructor#; + constructor tearoff • = self::ET1|constructor#_#new#tearOff; +} +extension type ET2(T% t) { + abstract inline-class-member representation-field get t() → T%; + operator + = self::ET2|+; + operator unary- = self::ET2|unary-; + operator [] = self::ET2|[]; + operator []= = self::ET2|[]=; + method foo = self::ET2|foo; + method tearoff foo = self::ET2|get#foo; + get getter = self::ET2|get#getter; + set setter = self::ET2|set#setter; + constructor • = self::ET2|constructor#; + constructor tearoff • = self::ET2|constructor#_#new#tearOff; +} +static inline-class-member method ET1|constructor#(core::int i) → self::ET1 /* = core::int */ { + lowered final self::ET1 /* = core::int */ #this = i; + return #this; +} +static inline-class-member method ET1|constructor#_#new#tearOff(core::int i) → self::ET1 /* = core::int */ + return self::ET1|constructor#(i); +static inline-class-member method ET1|+(lowered final self::ET1 /* = core::int */ #this, self::ET1? /* = core::int? */ i) → self::ET1? /* = core::int? */ + return i; +static inline-class-member method ET1|unary-(lowered final self::ET1 /* = core::int */ #this) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|[](lowered final self::ET1 /* = core::int */ #this, core::int index) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|[]=(lowered final self::ET1 /* = core::int */ #this, core::int index, core::int value) → void {} +static inline-class-member method ET1|foo(lowered final self::ET1 /* = core::int */ #this, core::int i) → void {} +static inline-class-member method ET1|get#foo(lowered final self::ET1 /* = core::int */ #this) → (core::int) → void + return (core::int i) → void => self::ET1|foo(#this, i); +static inline-class-member method ET1|get#getter(lowered final self::ET1 /* = core::int */ #this) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|set#setter(lowered final self::ET1 /* = core::int */ #this, core::int value) → void {} +static inline-class-member method ET2|constructor#(self::ET2|constructor#::T% t) → self::ET2 /* = self::ET2|constructor#::T% */ { + lowered final self::ET2 /* = self::ET2|constructor#::T% */ #this = t; + return #this; +} +static inline-class-member method ET2|constructor#_#new#tearOff(self::ET2|constructor#_#new#tearOff::T% t) → self::ET2% /* = self::ET2|constructor#_#new#tearOff::T% */ + return self::ET2|constructor#(t); +static inline-class-member method ET2|+(lowered final self::ET2 /* = self::ET2|+::T% */ #this, self::ET2? /* = self::ET2|+::T? */ t) → self::ET2? /* = self::ET2|+::T? */ + return t; +static inline-class-member method ET2|unary-(lowered final self::ET2 /* = self::ET2|unary-::T% */ #this) → self::ET2|unary-::T% + return #this as{Unchecked} self::ET2|unary-::T%; +static inline-class-member method ET2|[](lowered final self::ET2 /* = self::ET2|[]::T% */ #this, core::int index) → self::ET2|[]::T% + return #this as{Unchecked} self::ET2|[]::T%; +static inline-class-member method ET2|[]=(lowered final self::ET2 /* = self::ET2|[]=::T% */ #this, core::int index, self::ET2|[]=::T% value) → void {} +static inline-class-member method ET2|foo(lowered final self::ET2 /* = self::ET2|foo::T% */ #this, self::ET2|foo::T% t) → void {} +static inline-class-member method ET2|get#foo(lowered final self::ET2% /* = self::ET2|get#foo::T% */ #this) → (self::ET2|get#foo::T%) → void + return (self::ET2|get#foo::T% t) → void => self::ET2|foo(#this, t); +static inline-class-member method ET2|get#getter(lowered final self::ET2 /* = self::ET2|get#getter::T% */ #this) → self::ET2|get#getter::T% + return #this as{Unchecked} self::ET2|get#getter::T%; +static inline-class-member method ET2|set#setter(lowered final self::ET2 /* = self::ET2|set#setter::T% */ #this, self::ET2|set#setter::T% value) → void {} +static method method1(self::ET1 /* = core::int */ et) → dynamic { + self::ET1|foo(et, 0); + self::ET1|get#foo(et); + self::ET1|set#setter(et, self::ET1|get#getter(et)); + self::ET1|+(et, et); + self::ET1|unary-(et); + self::ET1|[](et, 0); + self::ET1|[]=(et, 0, 0); +} +static method method2(self::ET1? /* = core::int? */ et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:36:6: Error: Method 'foo' cannot be called on 'ET1?' because it is potentially null. +Try calling using ?. instead. + et.foo(0); // Error + ^^^" in self::ET1|foo(et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:37:6: Error: Property 'foo' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET1|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:38:6: Error: Property 'setter' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET1|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:39:6: Error: Property 'getter' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET1|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:40:6: Error: Operator '+' cannot be called on 'ET1?' because it is potentially null. + et + et; // Error + ^" in self::ET1|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:41:3: Error: Operator 'unary-' cannot be called on 'ET1?' because it is potentially null. + -et; // Error + ^" in self::ET1|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:42:5: Error: Operator '[]' cannot be called on 'ET1?' because it is potentially null. + et[0]; // Error + ^" in self::ET1|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:43:5: Error: Operator '[]=' cannot be called on 'ET1?' because it is potentially null. + et[0] = 0; // Error + ^" in self::ET1|[]=(et, 0, 0); +} +static method method3(self::method3::S% s, self::ET2 /* = self::method3::S% */ et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method4(self::method4::S% s, self::ET2? /* = self::method4::S? */ et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:57:6: Error: Method 'foo' cannot be called on 'ET2?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:58:6: Error: Property 'foo' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:59:6: Error: Property 'setter' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:60:6: Error: Property 'getter' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:61:6: Error: Operator '+' cannot be called on 'ET2?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:62:3: Error: Operator 'unary-' cannot be called on 'ET2?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:63:5: Error: Operator '[]' cannot be called on 'ET2?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:64:5: Error: Operator '[]=' cannot be called on 'ET2?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method5 /* = self::method5::S% */ = self::ET2 /* = dynamic */>(self::method5::S% s, self::method5::U% et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method6 /* = self::method6::S% */ = self::ET2 /* = dynamic */>(self::method6::S% s, self::method6::U? et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:78:6: Error: Method 'foo' cannot be called on 'U?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:79:6: Error: Property 'foo' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:80:6: Error: Property 'setter' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:81:6: Error: Property 'getter' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:82:6: Error: Operator '+' cannot be called on 'U?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:83:3: Error: Operator 'unary-' cannot be called on 'U?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:84:5: Error: Operator '[]' cannot be called on 'U?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:85:5: Error: Operator '[]=' cannot be called on 'U?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method7 /* = self::method7::S% */ = self::ET2 /* = dynamic */, V extends self::method7::U% = self::ET2 /* = dynamic */>(self::method7::S% s, self::method7::V% et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method8 /* = self::method8::S% */ = self::ET2 /* = dynamic */, V extends self::method8::U% = self::ET2 /* = dynamic */>(self::method8::S% s, self::method8::V? et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:99:6: Error: Method 'foo' cannot be called on 'V?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:100:6: Error: Property 'foo' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:101:6: Error: Property 'setter' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:102:6: Error: Property 'getter' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:103:6: Error: Operator '+' cannot be called on 'V?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:104:3: Error: Operator 'unary-' cannot be called on 'V?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:105:5: Error: Operator '[]' cannot be called on 'V?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:106:5: Error: Operator '[]=' cannot be called on 'V?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method9 /* = self::method9::S% */ = self::ET2 /* = dynamic */, V extends self::method9::U? = self::ET2? /* = dynamic */>(self::method9::S% s, self::method9::V% et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:110:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:111:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:112:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:113:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:114:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:115:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:116:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:117:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method10? /* = self::method10::S? */ = self::ET2? /* = dynamic */, V extends self::method10::U% = self::ET2? /* = dynamic */>(self::method10::S% s, self::method10::V% et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:121:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:122:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:123:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:124:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:125:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:126:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:127:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:128:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} diff --git a/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.textual_outline.expect new file mode 100644 index 00000000000..3a63304fdb2 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.textual_outline.expect @@ -0,0 +1,28 @@ +extension type ET1(int i) { + ET1? operator +(ET1? i) => i; + int operator -() => i; + int operator [](int index) => i; + void operator []=(int index, int value) {} + void foo(int i) {} + int get getter => i; + void set setter(int value) {} +} +extension type ET2(T t) { + ET2? operator +(ET2? t) => t; + T operator -() => t; + T operator [](int index) => t; + void operator []=(int index, T value) {} + void foo(T t) {} + T get getter => t; + void set setter(T value) {} +} +method1(ET1 et) {} +method2(ET1? et) {} +method3(S s, ET2 et) {} +method4(S s, ET2? et) {} +method5>(S s, U et) {} +method6>(S s, U? et) {} +method7, V extends U>(S s, V et) {} +method8, V extends U>(S s, V? et) {} +method9, V extends U?>(S s, V et) {} +method10?, V extends U>(S s, V et) {} diff --git a/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..d7fe2c1ba04 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.textual_outline_modelled.expect @@ -0,0 +1,28 @@ +extension type ET1(int i) { + ET1? operator +(ET1? i) => i; + int get getter => i; + int operator -() => i; + int operator [](int index) => i; + void foo(int i) {} + void operator []=(int index, int value) {} + void set setter(int value) {} +} +extension type ET2(T t) { + ET2? operator +(ET2? t) => t; + T get getter => t; + T operator -() => t; + T operator [](int index) => t; + void foo(T t) {} + void operator []=(int index, T value) {} + void set setter(T value) {} +} +method1(ET1 et) {} +method10?, V extends U>(S s, V et) {} +method2(ET1? et) {} +method3(S s, ET2 et) {} +method4(S s, ET2? et) {} +method5>(S s, U et) {} +method6>(S s, U? et) {} +method7, V extends U>(S s, V et) {} +method8, V extends U>(S s, V? et) {} +method9, V extends U?>(S s, V et) {} diff --git a/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.weak.expect b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.weak.expect new file mode 100644 index 00000000000..160bed7fde2 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.weak.expect @@ -0,0 +1,497 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:36:6: Error: Method 'foo' cannot be called on 'ET1?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(0); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:37:6: Error: Property 'foo' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:39:6: Error: Property 'getter' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:38:6: Error: Property 'setter' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:40:6: Error: Operator '+' cannot be called on 'ET1?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:41:3: Error: Operator 'unary-' cannot be called on 'ET1?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:42:5: Error: Operator '[]' cannot be called on 'ET1?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:43:5: Error: Operator '[]=' cannot be called on 'ET1?' because it is potentially null. +// et[0] = 0; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:57:6: Error: Method 'foo' cannot be called on 'ET2?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:58:6: Error: Property 'foo' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:60:6: Error: Property 'getter' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:59:6: Error: Property 'setter' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:61:6: Error: Operator '+' cannot be called on 'ET2?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:62:3: Error: Operator 'unary-' cannot be called on 'ET2?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:63:5: Error: Operator '[]' cannot be called on 'ET2?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:64:5: Error: Operator '[]=' cannot be called on 'ET2?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:78:6: Error: Method 'foo' cannot be called on 'U?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:79:6: Error: Property 'foo' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:81:6: Error: Property 'getter' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:80:6: Error: Property 'setter' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:82:6: Error: Operator '+' cannot be called on 'U?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:83:3: Error: Operator 'unary-' cannot be called on 'U?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:84:5: Error: Operator '[]' cannot be called on 'U?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:85:5: Error: Operator '[]=' cannot be called on 'U?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:99:6: Error: Method 'foo' cannot be called on 'V?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:100:6: Error: Property 'foo' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:102:6: Error: Property 'getter' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:101:6: Error: Property 'setter' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:103:6: Error: Operator '+' cannot be called on 'V?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:104:3: Error: Operator 'unary-' cannot be called on 'V?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:105:5: Error: Operator '[]' cannot be called on 'V?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:106:5: Error: Operator '[]=' cannot be called on 'V?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:110:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:111:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:113:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:112:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:114:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:115:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:116:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:117:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:121:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:122:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:124:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:123:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:125:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:126:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:127:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:128:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. +// et[0] = s; // Error +// ^ +// +import self as self; +import "dart:core" as core; + +extension type ET1(core::int i) { + abstract inline-class-member representation-field get i() → core::int; + operator + = self::ET1|+; + operator unary- = self::ET1|unary-; + operator [] = self::ET1|[]; + operator []= = self::ET1|[]=; + method foo = self::ET1|foo; + method tearoff foo = self::ET1|get#foo; + get getter = self::ET1|get#getter; + set setter = self::ET1|set#setter; + constructor • = self::ET1|constructor#; + constructor tearoff • = self::ET1|constructor#_#new#tearOff; +} +extension type ET2(T% t) { + abstract inline-class-member representation-field get t() → T%; + operator + = self::ET2|+; + operator unary- = self::ET2|unary-; + operator [] = self::ET2|[]; + operator []= = self::ET2|[]=; + method foo = self::ET2|foo; + method tearoff foo = self::ET2|get#foo; + get getter = self::ET2|get#getter; + set setter = self::ET2|set#setter; + constructor • = self::ET2|constructor#; + constructor tearoff • = self::ET2|constructor#_#new#tearOff; +} +static inline-class-member method ET1|constructor#(core::int i) → self::ET1 /* = core::int */ { + lowered final self::ET1 /* = core::int */ #this = i; + return #this; +} +static inline-class-member method ET1|constructor#_#new#tearOff(core::int i) → self::ET1 /* = core::int */ + return self::ET1|constructor#(i); +static inline-class-member method ET1|+(lowered final self::ET1 /* = core::int */ #this, self::ET1? /* = core::int? */ i) → self::ET1? /* = core::int? */ + return i; +static inline-class-member method ET1|unary-(lowered final self::ET1 /* = core::int */ #this) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|[](lowered final self::ET1 /* = core::int */ #this, core::int index) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|[]=(lowered final self::ET1 /* = core::int */ #this, core::int index, core::int value) → void {} +static inline-class-member method ET1|foo(lowered final self::ET1 /* = core::int */ #this, core::int i) → void {} +static inline-class-member method ET1|get#foo(lowered final self::ET1 /* = core::int */ #this) → (core::int) → void + return (core::int i) → void => self::ET1|foo(#this, i); +static inline-class-member method ET1|get#getter(lowered final self::ET1 /* = core::int */ #this) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|set#setter(lowered final self::ET1 /* = core::int */ #this, core::int value) → void {} +static inline-class-member method ET2|constructor#(self::ET2|constructor#::T% t) → self::ET2 /* = self::ET2|constructor#::T% */ { + lowered final self::ET2 /* = self::ET2|constructor#::T% */ #this = t; + return #this; +} +static inline-class-member method ET2|constructor#_#new#tearOff(self::ET2|constructor#_#new#tearOff::T% t) → self::ET2% /* = self::ET2|constructor#_#new#tearOff::T% */ + return self::ET2|constructor#(t); +static inline-class-member method ET2|+(lowered final self::ET2 /* = self::ET2|+::T% */ #this, self::ET2? /* = self::ET2|+::T? */ t) → self::ET2? /* = self::ET2|+::T? */ + return t; +static inline-class-member method ET2|unary-(lowered final self::ET2 /* = self::ET2|unary-::T% */ #this) → self::ET2|unary-::T% + return #this as{Unchecked} self::ET2|unary-::T%; +static inline-class-member method ET2|[](lowered final self::ET2 /* = self::ET2|[]::T% */ #this, core::int index) → self::ET2|[]::T% + return #this as{Unchecked} self::ET2|[]::T%; +static inline-class-member method ET2|[]=(lowered final self::ET2 /* = self::ET2|[]=::T% */ #this, core::int index, self::ET2|[]=::T% value) → void {} +static inline-class-member method ET2|foo(lowered final self::ET2 /* = self::ET2|foo::T% */ #this, self::ET2|foo::T% t) → void {} +static inline-class-member method ET2|get#foo(lowered final self::ET2% /* = self::ET2|get#foo::T% */ #this) → (self::ET2|get#foo::T%) → void + return (self::ET2|get#foo::T% t) → void => self::ET2|foo(#this, t); +static inline-class-member method ET2|get#getter(lowered final self::ET2 /* = self::ET2|get#getter::T% */ #this) → self::ET2|get#getter::T% + return #this as{Unchecked} self::ET2|get#getter::T%; +static inline-class-member method ET2|set#setter(lowered final self::ET2 /* = self::ET2|set#setter::T% */ #this, self::ET2|set#setter::T% value) → void {} +static method method1(self::ET1 /* = core::int */ et) → dynamic { + self::ET1|foo(et, 0); + self::ET1|get#foo(et); + self::ET1|set#setter(et, self::ET1|get#getter(et)); + self::ET1|+(et, et); + self::ET1|unary-(et); + self::ET1|[](et, 0); + self::ET1|[]=(et, 0, 0); +} +static method method2(self::ET1? /* = core::int? */ et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:36:6: Error: Method 'foo' cannot be called on 'ET1?' because it is potentially null. +Try calling using ?. instead. + et.foo(0); // Error + ^^^" in self::ET1|foo(et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:37:6: Error: Property 'foo' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET1|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:38:6: Error: Property 'setter' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET1|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:39:6: Error: Property 'getter' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET1|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:40:6: Error: Operator '+' cannot be called on 'ET1?' because it is potentially null. + et + et; // Error + ^" in self::ET1|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:41:3: Error: Operator 'unary-' cannot be called on 'ET1?' because it is potentially null. + -et; // Error + ^" in self::ET1|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:42:5: Error: Operator '[]' cannot be called on 'ET1?' because it is potentially null. + et[0]; // Error + ^" in self::ET1|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:43:5: Error: Operator '[]=' cannot be called on 'ET1?' because it is potentially null. + et[0] = 0; // Error + ^" in self::ET1|[]=(et, 0, 0); +} +static method method3(self::method3::S% s, self::ET2 /* = self::method3::S% */ et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method4(self::method4::S% s, self::ET2? /* = self::method4::S? */ et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:57:6: Error: Method 'foo' cannot be called on 'ET2?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:58:6: Error: Property 'foo' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:59:6: Error: Property 'setter' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:60:6: Error: Property 'getter' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:61:6: Error: Operator '+' cannot be called on 'ET2?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:62:3: Error: Operator 'unary-' cannot be called on 'ET2?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:63:5: Error: Operator '[]' cannot be called on 'ET2?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:64:5: Error: Operator '[]=' cannot be called on 'ET2?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method5 /* = self::method5::S% */ = self::ET2 /* = dynamic */>(self::method5::S% s, self::method5::U% et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method6 /* = self::method6::S% */ = self::ET2 /* = dynamic */>(self::method6::S% s, self::method6::U? et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:78:6: Error: Method 'foo' cannot be called on 'U?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:79:6: Error: Property 'foo' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:80:6: Error: Property 'setter' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:81:6: Error: Property 'getter' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:82:6: Error: Operator '+' cannot be called on 'U?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:83:3: Error: Operator 'unary-' cannot be called on 'U?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:84:5: Error: Operator '[]' cannot be called on 'U?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:85:5: Error: Operator '[]=' cannot be called on 'U?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method7 /* = self::method7::S% */ = self::ET2 /* = dynamic */, V extends self::method7::U% = self::ET2 /* = dynamic */>(self::method7::S% s, self::method7::V% et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method8 /* = self::method8::S% */ = self::ET2 /* = dynamic */, V extends self::method8::U% = self::ET2 /* = dynamic */>(self::method8::S% s, self::method8::V? et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:99:6: Error: Method 'foo' cannot be called on 'V?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:100:6: Error: Property 'foo' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:101:6: Error: Property 'setter' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:102:6: Error: Property 'getter' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:103:6: Error: Operator '+' cannot be called on 'V?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:104:3: Error: Operator 'unary-' cannot be called on 'V?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:105:5: Error: Operator '[]' cannot be called on 'V?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:106:5: Error: Operator '[]=' cannot be called on 'V?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method9 /* = self::method9::S% */ = self::ET2 /* = dynamic */, V extends self::method9::U? = self::ET2? /* = dynamic */>(self::method9::S% s, self::method9::V% et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:110:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:111:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:112:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:113:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:114:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:115:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:116:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:117:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method10? /* = self::method10::S? */ = self::ET2? /* = dynamic */, V extends self::method10::U% = self::ET2? /* = dynamic */>(self::method10::S% s, self::method10::V% et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:121:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:122:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:123:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:124:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:125:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:126:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:127:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:128:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} diff --git a/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.weak.modular.expect b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.weak.modular.expect new file mode 100644 index 00000000000..160bed7fde2 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.weak.modular.expect @@ -0,0 +1,497 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:36:6: Error: Method 'foo' cannot be called on 'ET1?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(0); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:37:6: Error: Property 'foo' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:39:6: Error: Property 'getter' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:38:6: Error: Property 'setter' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:40:6: Error: Operator '+' cannot be called on 'ET1?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:41:3: Error: Operator 'unary-' cannot be called on 'ET1?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:42:5: Error: Operator '[]' cannot be called on 'ET1?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:43:5: Error: Operator '[]=' cannot be called on 'ET1?' because it is potentially null. +// et[0] = 0; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:57:6: Error: Method 'foo' cannot be called on 'ET2?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:58:6: Error: Property 'foo' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:60:6: Error: Property 'getter' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:59:6: Error: Property 'setter' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:61:6: Error: Operator '+' cannot be called on 'ET2?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:62:3: Error: Operator 'unary-' cannot be called on 'ET2?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:63:5: Error: Operator '[]' cannot be called on 'ET2?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:64:5: Error: Operator '[]=' cannot be called on 'ET2?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:78:6: Error: Method 'foo' cannot be called on 'U?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:79:6: Error: Property 'foo' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:81:6: Error: Property 'getter' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:80:6: Error: Property 'setter' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:82:6: Error: Operator '+' cannot be called on 'U?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:83:3: Error: Operator 'unary-' cannot be called on 'U?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:84:5: Error: Operator '[]' cannot be called on 'U?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:85:5: Error: Operator '[]=' cannot be called on 'U?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:99:6: Error: Method 'foo' cannot be called on 'V?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:100:6: Error: Property 'foo' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:102:6: Error: Property 'getter' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:101:6: Error: Property 'setter' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:103:6: Error: Operator '+' cannot be called on 'V?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:104:3: Error: Operator 'unary-' cannot be called on 'V?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:105:5: Error: Operator '[]' cannot be called on 'V?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:106:5: Error: Operator '[]=' cannot be called on 'V?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:110:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:111:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:113:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:112:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:114:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:115:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:116:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:117:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:121:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:122:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:124:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:123:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:125:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:126:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:127:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:128:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. +// et[0] = s; // Error +// ^ +// +import self as self; +import "dart:core" as core; + +extension type ET1(core::int i) { + abstract inline-class-member representation-field get i() → core::int; + operator + = self::ET1|+; + operator unary- = self::ET1|unary-; + operator [] = self::ET1|[]; + operator []= = self::ET1|[]=; + method foo = self::ET1|foo; + method tearoff foo = self::ET1|get#foo; + get getter = self::ET1|get#getter; + set setter = self::ET1|set#setter; + constructor • = self::ET1|constructor#; + constructor tearoff • = self::ET1|constructor#_#new#tearOff; +} +extension type ET2(T% t) { + abstract inline-class-member representation-field get t() → T%; + operator + = self::ET2|+; + operator unary- = self::ET2|unary-; + operator [] = self::ET2|[]; + operator []= = self::ET2|[]=; + method foo = self::ET2|foo; + method tearoff foo = self::ET2|get#foo; + get getter = self::ET2|get#getter; + set setter = self::ET2|set#setter; + constructor • = self::ET2|constructor#; + constructor tearoff • = self::ET2|constructor#_#new#tearOff; +} +static inline-class-member method ET1|constructor#(core::int i) → self::ET1 /* = core::int */ { + lowered final self::ET1 /* = core::int */ #this = i; + return #this; +} +static inline-class-member method ET1|constructor#_#new#tearOff(core::int i) → self::ET1 /* = core::int */ + return self::ET1|constructor#(i); +static inline-class-member method ET1|+(lowered final self::ET1 /* = core::int */ #this, self::ET1? /* = core::int? */ i) → self::ET1? /* = core::int? */ + return i; +static inline-class-member method ET1|unary-(lowered final self::ET1 /* = core::int */ #this) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|[](lowered final self::ET1 /* = core::int */ #this, core::int index) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|[]=(lowered final self::ET1 /* = core::int */ #this, core::int index, core::int value) → void {} +static inline-class-member method ET1|foo(lowered final self::ET1 /* = core::int */ #this, core::int i) → void {} +static inline-class-member method ET1|get#foo(lowered final self::ET1 /* = core::int */ #this) → (core::int) → void + return (core::int i) → void => self::ET1|foo(#this, i); +static inline-class-member method ET1|get#getter(lowered final self::ET1 /* = core::int */ #this) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|set#setter(lowered final self::ET1 /* = core::int */ #this, core::int value) → void {} +static inline-class-member method ET2|constructor#(self::ET2|constructor#::T% t) → self::ET2 /* = self::ET2|constructor#::T% */ { + lowered final self::ET2 /* = self::ET2|constructor#::T% */ #this = t; + return #this; +} +static inline-class-member method ET2|constructor#_#new#tearOff(self::ET2|constructor#_#new#tearOff::T% t) → self::ET2% /* = self::ET2|constructor#_#new#tearOff::T% */ + return self::ET2|constructor#(t); +static inline-class-member method ET2|+(lowered final self::ET2 /* = self::ET2|+::T% */ #this, self::ET2? /* = self::ET2|+::T? */ t) → self::ET2? /* = self::ET2|+::T? */ + return t; +static inline-class-member method ET2|unary-(lowered final self::ET2 /* = self::ET2|unary-::T% */ #this) → self::ET2|unary-::T% + return #this as{Unchecked} self::ET2|unary-::T%; +static inline-class-member method ET2|[](lowered final self::ET2 /* = self::ET2|[]::T% */ #this, core::int index) → self::ET2|[]::T% + return #this as{Unchecked} self::ET2|[]::T%; +static inline-class-member method ET2|[]=(lowered final self::ET2 /* = self::ET2|[]=::T% */ #this, core::int index, self::ET2|[]=::T% value) → void {} +static inline-class-member method ET2|foo(lowered final self::ET2 /* = self::ET2|foo::T% */ #this, self::ET2|foo::T% t) → void {} +static inline-class-member method ET2|get#foo(lowered final self::ET2% /* = self::ET2|get#foo::T% */ #this) → (self::ET2|get#foo::T%) → void + return (self::ET2|get#foo::T% t) → void => self::ET2|foo(#this, t); +static inline-class-member method ET2|get#getter(lowered final self::ET2 /* = self::ET2|get#getter::T% */ #this) → self::ET2|get#getter::T% + return #this as{Unchecked} self::ET2|get#getter::T%; +static inline-class-member method ET2|set#setter(lowered final self::ET2 /* = self::ET2|set#setter::T% */ #this, self::ET2|set#setter::T% value) → void {} +static method method1(self::ET1 /* = core::int */ et) → dynamic { + self::ET1|foo(et, 0); + self::ET1|get#foo(et); + self::ET1|set#setter(et, self::ET1|get#getter(et)); + self::ET1|+(et, et); + self::ET1|unary-(et); + self::ET1|[](et, 0); + self::ET1|[]=(et, 0, 0); +} +static method method2(self::ET1? /* = core::int? */ et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:36:6: Error: Method 'foo' cannot be called on 'ET1?' because it is potentially null. +Try calling using ?. instead. + et.foo(0); // Error + ^^^" in self::ET1|foo(et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:37:6: Error: Property 'foo' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET1|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:38:6: Error: Property 'setter' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET1|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:39:6: Error: Property 'getter' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET1|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:40:6: Error: Operator '+' cannot be called on 'ET1?' because it is potentially null. + et + et; // Error + ^" in self::ET1|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:41:3: Error: Operator 'unary-' cannot be called on 'ET1?' because it is potentially null. + -et; // Error + ^" in self::ET1|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:42:5: Error: Operator '[]' cannot be called on 'ET1?' because it is potentially null. + et[0]; // Error + ^" in self::ET1|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:43:5: Error: Operator '[]=' cannot be called on 'ET1?' because it is potentially null. + et[0] = 0; // Error + ^" in self::ET1|[]=(et, 0, 0); +} +static method method3(self::method3::S% s, self::ET2 /* = self::method3::S% */ et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method4(self::method4::S% s, self::ET2? /* = self::method4::S? */ et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:57:6: Error: Method 'foo' cannot be called on 'ET2?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:58:6: Error: Property 'foo' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:59:6: Error: Property 'setter' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:60:6: Error: Property 'getter' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:61:6: Error: Operator '+' cannot be called on 'ET2?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:62:3: Error: Operator 'unary-' cannot be called on 'ET2?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:63:5: Error: Operator '[]' cannot be called on 'ET2?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:64:5: Error: Operator '[]=' cannot be called on 'ET2?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method5 /* = self::method5::S% */ = self::ET2 /* = dynamic */>(self::method5::S% s, self::method5::U% et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method6 /* = self::method6::S% */ = self::ET2 /* = dynamic */>(self::method6::S% s, self::method6::U? et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:78:6: Error: Method 'foo' cannot be called on 'U?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:79:6: Error: Property 'foo' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:80:6: Error: Property 'setter' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:81:6: Error: Property 'getter' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:82:6: Error: Operator '+' cannot be called on 'U?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:83:3: Error: Operator 'unary-' cannot be called on 'U?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:84:5: Error: Operator '[]' cannot be called on 'U?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:85:5: Error: Operator '[]=' cannot be called on 'U?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method7 /* = self::method7::S% */ = self::ET2 /* = dynamic */, V extends self::method7::U% = self::ET2 /* = dynamic */>(self::method7::S% s, self::method7::V% et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method8 /* = self::method8::S% */ = self::ET2 /* = dynamic */, V extends self::method8::U% = self::ET2 /* = dynamic */>(self::method8::S% s, self::method8::V? et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:99:6: Error: Method 'foo' cannot be called on 'V?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:100:6: Error: Property 'foo' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:101:6: Error: Property 'setter' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:102:6: Error: Property 'getter' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:103:6: Error: Operator '+' cannot be called on 'V?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:104:3: Error: Operator 'unary-' cannot be called on 'V?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:105:5: Error: Operator '[]' cannot be called on 'V?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:106:5: Error: Operator '[]=' cannot be called on 'V?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method9 /* = self::method9::S% */ = self::ET2 /* = dynamic */, V extends self::method9::U? = self::ET2? /* = dynamic */>(self::method9::S% s, self::method9::V% et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:110:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:111:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:112:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:113:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:114:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:115:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:116:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:117:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method10? /* = self::method10::S? */ = self::ET2? /* = dynamic */, V extends self::method10::U% = self::ET2? /* = dynamic */>(self::method10::S% s, self::method10::V% et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:121:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:122:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:123:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:124:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:125:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:126:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:127:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:128:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} diff --git a/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.weak.outline.expect new file mode 100644 index 00000000000..c50e28bf0ee --- /dev/null +++ b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.weak.outline.expect @@ -0,0 +1,90 @@ +library; +import self as self; +import "dart:core" as core; + +extension type ET1(core::int i) { + abstract inline-class-member representation-field get i() → core::int; + operator + = self::ET1|+; + operator unary- = self::ET1|unary-; + operator [] = self::ET1|[]; + operator []= = self::ET1|[]=; + method foo = self::ET1|foo; + method tearoff foo = self::ET1|get#foo; + get getter = self::ET1|get#getter; + set setter = self::ET1|set#setter; + constructor • = self::ET1|constructor#; + constructor tearoff • = self::ET1|constructor#_#new#tearOff; +} +extension type ET2(T% t) { + abstract inline-class-member representation-field get t() → T%; + operator + = self::ET2|+; + operator unary- = self::ET2|unary-; + operator [] = self::ET2|[]; + operator []= = self::ET2|[]=; + method foo = self::ET2|foo; + method tearoff foo = self::ET2|get#foo; + get getter = self::ET2|get#getter; + set setter = self::ET2|set#setter; + constructor • = self::ET2|constructor#; + constructor tearoff • = self::ET2|constructor#_#new#tearOff; +} +static inline-class-member method ET1|constructor#(core::int i) → self::ET1 /* = core::int */ + ; +static inline-class-member method ET1|constructor#_#new#tearOff(core::int i) → self::ET1 /* = core::int */ + return self::ET1|constructor#(i); +static inline-class-member method ET1|+(lowered final self::ET1 /* = core::int */ #this, self::ET1? /* = core::int? */ i) → self::ET1? /* = core::int? */ + ; +static inline-class-member method ET1|unary-(lowered final self::ET1 /* = core::int */ #this) → core::int + ; +static inline-class-member method ET1|[](lowered final self::ET1 /* = core::int */ #this, core::int index) → core::int + ; +static inline-class-member method ET1|[]=(lowered final self::ET1 /* = core::int */ #this, core::int index, core::int value) → void + ; +static inline-class-member method ET1|foo(lowered final self::ET1 /* = core::int */ #this, core::int i) → void + ; +static inline-class-member method ET1|get#foo(lowered final self::ET1 /* = core::int */ #this) → (core::int) → void + return (core::int i) → void => self::ET1|foo(#this, i); +static inline-class-member method ET1|get#getter(lowered final self::ET1 /* = core::int */ #this) → core::int + ; +static inline-class-member method ET1|set#setter(lowered final self::ET1 /* = core::int */ #this, core::int value) → void + ; +static inline-class-member method ET2|constructor#(self::ET2|constructor#::T% t) → self::ET2 /* = self::ET2|constructor#::T% */ + ; +static inline-class-member method ET2|constructor#_#new#tearOff(self::ET2|constructor#_#new#tearOff::T% t) → self::ET2% /* = self::ET2|constructor#_#new#tearOff::T% */ + return self::ET2|constructor#(t); +static inline-class-member method ET2|+(lowered final self::ET2 /* = self::ET2|+::T% */ #this, self::ET2? /* = self::ET2|+::T? */ t) → self::ET2? /* = self::ET2|+::T? */ + ; +static inline-class-member method ET2|unary-(lowered final self::ET2 /* = self::ET2|unary-::T% */ #this) → self::ET2|unary-::T% + ; +static inline-class-member method ET2|[](lowered final self::ET2 /* = self::ET2|[]::T% */ #this, core::int index) → self::ET2|[]::T% + ; +static inline-class-member method ET2|[]=(lowered final self::ET2 /* = self::ET2|[]=::T% */ #this, core::int index, self::ET2|[]=::T% value) → void + ; +static inline-class-member method ET2|foo(lowered final self::ET2 /* = self::ET2|foo::T% */ #this, self::ET2|foo::T% t) → void + ; +static inline-class-member method ET2|get#foo(lowered final self::ET2% /* = self::ET2|get#foo::T% */ #this) → (self::ET2|get#foo::T%) → void + return (self::ET2|get#foo::T% t) → void => self::ET2|foo(#this, t); +static inline-class-member method ET2|get#getter(lowered final self::ET2 /* = self::ET2|get#getter::T% */ #this) → self::ET2|get#getter::T% + ; +static inline-class-member method ET2|set#setter(lowered final self::ET2 /* = self::ET2|set#setter::T% */ #this, self::ET2|set#setter::T% value) → void + ; +static method method1(self::ET1 /* = core::int */ et) → dynamic + ; +static method method2(self::ET1? /* = core::int? */ et) → dynamic + ; +static method method3(self::method3::S% s, self::ET2 /* = self::method3::S% */ et) → dynamic + ; +static method method4(self::method4::S% s, self::ET2? /* = self::method4::S? */ et) → dynamic + ; +static method method5 /* = self::method5::S% */ = self::ET2 /* = dynamic */>(self::method5::S% s, self::method5::U% et) → dynamic + ; +static method method6 /* = self::method6::S% */ = self::ET2 /* = dynamic */>(self::method6::S% s, self::method6::U? et) → dynamic + ; +static method method7 /* = self::method7::S% */ = self::ET2 /* = dynamic */, V extends self::method7::U% = self::ET2 /* = dynamic */>(self::method7::S% s, self::method7::V% et) → dynamic + ; +static method method8 /* = self::method8::S% */ = self::ET2 /* = dynamic */, V extends self::method8::U% = self::ET2 /* = dynamic */>(self::method8::S% s, self::method8::V? et) → dynamic + ; +static method method9 /* = self::method9::S% */ = self::ET2 /* = dynamic */, V extends self::method9::U? = self::ET2? /* = dynamic */>(self::method9::S% s, self::method9::V% et) → dynamic + ; +static method method10? /* = self::method10::S? */ = self::ET2? /* = dynamic */, V extends self::method10::U% = self::ET2? /* = dynamic */>(self::method10::S% s, self::method10::V% et) → dynamic + ; diff --git a/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.weak.transformed.expect new file mode 100644 index 00000000000..160bed7fde2 --- /dev/null +++ b/pkg/front_end/testcases/extension_types/not_non_nullable_access.dart.weak.transformed.expect @@ -0,0 +1,497 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:36:6: Error: Method 'foo' cannot be called on 'ET1?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(0); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:37:6: Error: Property 'foo' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:39:6: Error: Property 'getter' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:38:6: Error: Property 'setter' cannot be accessed on 'ET1?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:40:6: Error: Operator '+' cannot be called on 'ET1?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:41:3: Error: Operator 'unary-' cannot be called on 'ET1?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:42:5: Error: Operator '[]' cannot be called on 'ET1?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:43:5: Error: Operator '[]=' cannot be called on 'ET1?' because it is potentially null. +// et[0] = 0; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:57:6: Error: Method 'foo' cannot be called on 'ET2?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:58:6: Error: Property 'foo' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:60:6: Error: Property 'getter' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:59:6: Error: Property 'setter' cannot be accessed on 'ET2?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:61:6: Error: Operator '+' cannot be called on 'ET2?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:62:3: Error: Operator 'unary-' cannot be called on 'ET2?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:63:5: Error: Operator '[]' cannot be called on 'ET2?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:64:5: Error: Operator '[]=' cannot be called on 'ET2?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:78:6: Error: Method 'foo' cannot be called on 'U?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:79:6: Error: Property 'foo' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:81:6: Error: Property 'getter' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:80:6: Error: Property 'setter' cannot be accessed on 'U?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:82:6: Error: Operator '+' cannot be called on 'U?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:83:3: Error: Operator 'unary-' cannot be called on 'U?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:84:5: Error: Operator '[]' cannot be called on 'U?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:85:5: Error: Operator '[]=' cannot be called on 'U?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:99:6: Error: Method 'foo' cannot be called on 'V?' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:100:6: Error: Property 'foo' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:102:6: Error: Property 'getter' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:101:6: Error: Property 'setter' cannot be accessed on 'V?' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:103:6: Error: Operator '+' cannot be called on 'V?' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:104:3: Error: Operator 'unary-' cannot be called on 'V?' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:105:5: Error: Operator '[]' cannot be called on 'V?' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:106:5: Error: Operator '[]=' cannot be called on 'V?' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:110:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:111:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:113:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:112:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:114:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:115:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:116:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:117:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. +// et[0] = s; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:121:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +// Try calling using ?. instead. +// et.foo(s); // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:122:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.foo; // Error +// ^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:124:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.getter; // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:123:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +// Try accessing using ?. instead. +// et.setter = // Error +// ^^^^^^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:125:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. +// et + et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:126:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. +// -et; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:127:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. +// et[0]; // Error +// ^ +// +// pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:128:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. +// et[0] = s; // Error +// ^ +// +import self as self; +import "dart:core" as core; + +extension type ET1(core::int i) { + abstract inline-class-member representation-field get i() → core::int; + operator + = self::ET1|+; + operator unary- = self::ET1|unary-; + operator [] = self::ET1|[]; + operator []= = self::ET1|[]=; + method foo = self::ET1|foo; + method tearoff foo = self::ET1|get#foo; + get getter = self::ET1|get#getter; + set setter = self::ET1|set#setter; + constructor • = self::ET1|constructor#; + constructor tearoff • = self::ET1|constructor#_#new#tearOff; +} +extension type ET2(T% t) { + abstract inline-class-member representation-field get t() → T%; + operator + = self::ET2|+; + operator unary- = self::ET2|unary-; + operator [] = self::ET2|[]; + operator []= = self::ET2|[]=; + method foo = self::ET2|foo; + method tearoff foo = self::ET2|get#foo; + get getter = self::ET2|get#getter; + set setter = self::ET2|set#setter; + constructor • = self::ET2|constructor#; + constructor tearoff • = self::ET2|constructor#_#new#tearOff; +} +static inline-class-member method ET1|constructor#(core::int i) → self::ET1 /* = core::int */ { + lowered final self::ET1 /* = core::int */ #this = i; + return #this; +} +static inline-class-member method ET1|constructor#_#new#tearOff(core::int i) → self::ET1 /* = core::int */ + return self::ET1|constructor#(i); +static inline-class-member method ET1|+(lowered final self::ET1 /* = core::int */ #this, self::ET1? /* = core::int? */ i) → self::ET1? /* = core::int? */ + return i; +static inline-class-member method ET1|unary-(lowered final self::ET1 /* = core::int */ #this) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|[](lowered final self::ET1 /* = core::int */ #this, core::int index) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|[]=(lowered final self::ET1 /* = core::int */ #this, core::int index, core::int value) → void {} +static inline-class-member method ET1|foo(lowered final self::ET1 /* = core::int */ #this, core::int i) → void {} +static inline-class-member method ET1|get#foo(lowered final self::ET1 /* = core::int */ #this) → (core::int) → void + return (core::int i) → void => self::ET1|foo(#this, i); +static inline-class-member method ET1|get#getter(lowered final self::ET1 /* = core::int */ #this) → core::int + return #this as{Unchecked} core::int; +static inline-class-member method ET1|set#setter(lowered final self::ET1 /* = core::int */ #this, core::int value) → void {} +static inline-class-member method ET2|constructor#(self::ET2|constructor#::T% t) → self::ET2 /* = self::ET2|constructor#::T% */ { + lowered final self::ET2 /* = self::ET2|constructor#::T% */ #this = t; + return #this; +} +static inline-class-member method ET2|constructor#_#new#tearOff(self::ET2|constructor#_#new#tearOff::T% t) → self::ET2% /* = self::ET2|constructor#_#new#tearOff::T% */ + return self::ET2|constructor#(t); +static inline-class-member method ET2|+(lowered final self::ET2 /* = self::ET2|+::T% */ #this, self::ET2? /* = self::ET2|+::T? */ t) → self::ET2? /* = self::ET2|+::T? */ + return t; +static inline-class-member method ET2|unary-(lowered final self::ET2 /* = self::ET2|unary-::T% */ #this) → self::ET2|unary-::T% + return #this as{Unchecked} self::ET2|unary-::T%; +static inline-class-member method ET2|[](lowered final self::ET2 /* = self::ET2|[]::T% */ #this, core::int index) → self::ET2|[]::T% + return #this as{Unchecked} self::ET2|[]::T%; +static inline-class-member method ET2|[]=(lowered final self::ET2 /* = self::ET2|[]=::T% */ #this, core::int index, self::ET2|[]=::T% value) → void {} +static inline-class-member method ET2|foo(lowered final self::ET2 /* = self::ET2|foo::T% */ #this, self::ET2|foo::T% t) → void {} +static inline-class-member method ET2|get#foo(lowered final self::ET2% /* = self::ET2|get#foo::T% */ #this) → (self::ET2|get#foo::T%) → void + return (self::ET2|get#foo::T% t) → void => self::ET2|foo(#this, t); +static inline-class-member method ET2|get#getter(lowered final self::ET2 /* = self::ET2|get#getter::T% */ #this) → self::ET2|get#getter::T% + return #this as{Unchecked} self::ET2|get#getter::T%; +static inline-class-member method ET2|set#setter(lowered final self::ET2 /* = self::ET2|set#setter::T% */ #this, self::ET2|set#setter::T% value) → void {} +static method method1(self::ET1 /* = core::int */ et) → dynamic { + self::ET1|foo(et, 0); + self::ET1|get#foo(et); + self::ET1|set#setter(et, self::ET1|get#getter(et)); + self::ET1|+(et, et); + self::ET1|unary-(et); + self::ET1|[](et, 0); + self::ET1|[]=(et, 0, 0); +} +static method method2(self::ET1? /* = core::int? */ et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:36:6: Error: Method 'foo' cannot be called on 'ET1?' because it is potentially null. +Try calling using ?. instead. + et.foo(0); // Error + ^^^" in self::ET1|foo(et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:37:6: Error: Property 'foo' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET1|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:38:6: Error: Property 'setter' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET1|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:39:6: Error: Property 'getter' cannot be accessed on 'ET1?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET1|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:40:6: Error: Operator '+' cannot be called on 'ET1?' because it is potentially null. + et + et; // Error + ^" in self::ET1|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:41:3: Error: Operator 'unary-' cannot be called on 'ET1?' because it is potentially null. + -et; // Error + ^" in self::ET1|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:42:5: Error: Operator '[]' cannot be called on 'ET1?' because it is potentially null. + et[0]; // Error + ^" in self::ET1|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:43:5: Error: Operator '[]=' cannot be called on 'ET1?' because it is potentially null. + et[0] = 0; // Error + ^" in self::ET1|[]=(et, 0, 0); +} +static method method3(self::method3::S% s, self::ET2 /* = self::method3::S% */ et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method4(self::method4::S% s, self::ET2? /* = self::method4::S? */ et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:57:6: Error: Method 'foo' cannot be called on 'ET2?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:58:6: Error: Property 'foo' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:59:6: Error: Property 'setter' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:60:6: Error: Property 'getter' cannot be accessed on 'ET2?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:61:6: Error: Operator '+' cannot be called on 'ET2?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:62:3: Error: Operator 'unary-' cannot be called on 'ET2?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:63:5: Error: Operator '[]' cannot be called on 'ET2?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:64:5: Error: Operator '[]=' cannot be called on 'ET2?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method5 /* = self::method5::S% */ = self::ET2 /* = dynamic */>(self::method5::S% s, self::method5::U% et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method6 /* = self::method6::S% */ = self::ET2 /* = dynamic */>(self::method6::S% s, self::method6::U? et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:78:6: Error: Method 'foo' cannot be called on 'U?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:79:6: Error: Property 'foo' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:80:6: Error: Property 'setter' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:81:6: Error: Property 'getter' cannot be accessed on 'U?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:82:6: Error: Operator '+' cannot be called on 'U?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:83:3: Error: Operator 'unary-' cannot be called on 'U?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:84:5: Error: Operator '[]' cannot be called on 'U?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:85:5: Error: Operator '[]=' cannot be called on 'U?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method7 /* = self::method7::S% */ = self::ET2 /* = dynamic */, V extends self::method7::U% = self::ET2 /* = dynamic */>(self::method7::S% s, self::method7::V% et) → dynamic { + self::ET2|foo(et, s); + self::ET2|get#foo(et); + self::ET2|set#setter(et, self::ET2|get#getter(et)); + self::ET2|+(et, et); + self::ET2|unary-(et); + self::ET2|[](et, 0); + self::ET2|[]=(et, 0, s); +} +static method method8 /* = self::method8::S% */ = self::ET2 /* = dynamic */, V extends self::method8::U% = self::ET2 /* = dynamic */>(self::method8::S% s, self::method8::V? et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:99:6: Error: Method 'foo' cannot be called on 'V?' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:100:6: Error: Property 'foo' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:101:6: Error: Property 'setter' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:102:6: Error: Property 'getter' cannot be accessed on 'V?' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:103:6: Error: Operator '+' cannot be called on 'V?' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:104:3: Error: Operator 'unary-' cannot be called on 'V?' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:105:5: Error: Operator '[]' cannot be called on 'V?' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:106:5: Error: Operator '[]=' cannot be called on 'V?' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method9 /* = self::method9::S% */ = self::ET2 /* = dynamic */, V extends self::method9::U? = self::ET2? /* = dynamic */>(self::method9::S% s, self::method9::V% et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:110:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:111:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:112:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:113:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:114:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:115:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:116:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:117:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} +static method method10? /* = self::method10::S? */ = self::ET2? /* = dynamic */, V extends self::method10::U% = self::ET2? /* = dynamic */>(self::method10::S% s, self::method10::V% et) → dynamic { + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:121:6: Error: Method 'foo' cannot be called on 'V' because it is potentially null. +Try calling using ?. instead. + et.foo(s); // Error + ^^^" in self::ET2|foo(et, s); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:122:6: Error: Property 'foo' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.foo; // Error + ^^^" in self::ET2|get#foo(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:123:6: Error: Property 'setter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.setter = // Error + ^^^^^^" in self::ET2|set#setter(et, invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:124:6: Error: Property 'getter' cannot be accessed on 'V' because it is potentially null. +Try accessing using ?. instead. + et.getter; // Error + ^^^^^^" in self::ET2|get#getter(et)); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:125:6: Error: Operator '+' cannot be called on 'V' because it is potentially null. + et + et; // Error + ^" in self::ET2|+(et, et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:126:3: Error: Operator 'unary-' cannot be called on 'V' because it is potentially null. + -et; // Error + ^" in self::ET2|unary-(et); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:127:5: Error: Operator '[]' cannot be called on 'V' because it is potentially null. + et[0]; // Error + ^" in self::ET2|[](et, 0); + invalid-expression "pkg/front_end/testcases/extension_types/not_non_nullable_access.dart:128:5: Error: Operator '[]=' cannot be called on 'V' because it is potentially null. + et[0] = s; // Error + ^" in self::ET2|[]=(et, 0, s); +} diff --git a/pkg/front_end/testcases/extension_types/nullable_access.dart b/pkg/front_end/testcases/extension_types/nullable_access.dart new file mode 100644 index 00000000000..d4ca2f6154c --- /dev/null +++ b/pkg/front_end/testcases/extension_types/nullable_access.dart @@ -0,0 +1,20 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by b +// BSD-style license that can be found in the LICENSE file. + +extension E on ET? { + void foo(int i) {} +} + +extension type ET(int? i) { + void foo() {} +} + +method(ET et1, ET? et2, X x1, X? x2, Y y1, Y? y2) { + et1.foo(); + et2.foo(0); + x1.foo(); + x2.foo(0); + y1.foo(0); + y2.foo(0); +} \ No newline at end of file diff --git a/pkg/front_end/testcases/extension_types/nullable_access.dart.strong.expect b/pkg/front_end/testcases/extension_types/nullable_access.dart.strong.expect new file mode 100644 index 00000000000..c347afca55d --- /dev/null +++ b/pkg/front_end/testcases/extension_types/nullable_access.dart.strong.expect @@ -0,0 +1,35 @@ +library; +import self as self; +import "dart:core" as core; + +extension E on self::ET? /* = core::int? */ { + method foo = self::E|foo; + method tearoff foo = self::E|get#foo; +} +extension type ET(core::int? i) { + abstract inline-class-member representation-field get i() → core::int?; + method foo = self::ET|foo; + method tearoff foo = self::ET|get#foo; + constructor • = self::ET|constructor#; + constructor tearoff • = self::ET|constructor#_#new#tearOff; +} +static extension-member method E|foo(lowered final self::ET? /* = core::int? */ #this, core::int i) → void {} +static extension-member method E|get#foo(lowered final self::ET? /* = core::int? */ #this) → (core::int) → void + return (core::int i) → void => self::E|foo(#this, i); +static inline-class-member method ET|constructor#(core::int? i) → self::ET /* = core::int? */ { + lowered final self::ET /* = core::int? */ #this = i; + return #this; +} +static inline-class-member method ET|constructor#_#new#tearOff(core::int? i) → self::ET /* = core::int? */ + return self::ET|constructor#(i); +static inline-class-member method ET|foo(lowered final self::ET /* = core::int? */ #this) → void {} +static inline-class-member method ET|get#foo(lowered final self::ET /* = core::int? */ #this) → () → void + return () → void => self::ET|foo(#this); +static method method(self::ET /* = core::int? */ et1, self::ET? /* = core::int? */ et2, self::method::X% x1, self::method::X? x2, self::method::Y% y1, self::method::Y? y2) → dynamic { + self::ET|foo(et1); + self::E|foo(et2, 0); + self::ET|foo(x1); + self::E|foo(x2, 0); + self::E|foo(y1, 0); + self::E|foo(y2, 0); +} diff --git a/pkg/front_end/testcases/extension_types/nullable_access.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/nullable_access.dart.strong.transformed.expect new file mode 100644 index 00000000000..c347afca55d --- /dev/null +++ b/pkg/front_end/testcases/extension_types/nullable_access.dart.strong.transformed.expect @@ -0,0 +1,35 @@ +library; +import self as self; +import "dart:core" as core; + +extension E on self::ET? /* = core::int? */ { + method foo = self::E|foo; + method tearoff foo = self::E|get#foo; +} +extension type ET(core::int? i) { + abstract inline-class-member representation-field get i() → core::int?; + method foo = self::ET|foo; + method tearoff foo = self::ET|get#foo; + constructor • = self::ET|constructor#; + constructor tearoff • = self::ET|constructor#_#new#tearOff; +} +static extension-member method E|foo(lowered final self::ET? /* = core::int? */ #this, core::int i) → void {} +static extension-member method E|get#foo(lowered final self::ET? /* = core::int? */ #this) → (core::int) → void + return (core::int i) → void => self::E|foo(#this, i); +static inline-class-member method ET|constructor#(core::int? i) → self::ET /* = core::int? */ { + lowered final self::ET /* = core::int? */ #this = i; + return #this; +} +static inline-class-member method ET|constructor#_#new#tearOff(core::int? i) → self::ET /* = core::int? */ + return self::ET|constructor#(i); +static inline-class-member method ET|foo(lowered final self::ET /* = core::int? */ #this) → void {} +static inline-class-member method ET|get#foo(lowered final self::ET /* = core::int? */ #this) → () → void + return () → void => self::ET|foo(#this); +static method method(self::ET /* = core::int? */ et1, self::ET? /* = core::int? */ et2, self::method::X% x1, self::method::X? x2, self::method::Y% y1, self::method::Y? y2) → dynamic { + self::ET|foo(et1); + self::E|foo(et2, 0); + self::ET|foo(x1); + self::E|foo(x2, 0); + self::E|foo(y1, 0); + self::E|foo(y2, 0); +} diff --git a/pkg/front_end/testcases/extension_types/nullable_access.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/nullable_access.dart.textual_outline.expect new file mode 100644 index 00000000000..114d3c14b9d --- /dev/null +++ b/pkg/front_end/testcases/extension_types/nullable_access.dart.textual_outline.expect @@ -0,0 +1,7 @@ +extension E on ET? { + void foo(int i) {} +} +extension type ET(int? i) { + void foo() {} +} +method(ET et1, ET? et2, X x1, X? x2, Y y1, Y? y2) {} diff --git a/pkg/front_end/testcases/extension_types/nullable_access.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/extension_types/nullable_access.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..114d3c14b9d --- /dev/null +++ b/pkg/front_end/testcases/extension_types/nullable_access.dart.textual_outline_modelled.expect @@ -0,0 +1,7 @@ +extension E on ET? { + void foo(int i) {} +} +extension type ET(int? i) { + void foo() {} +} +method(ET et1, ET? et2, X x1, X? x2, Y y1, Y? y2) {} diff --git a/pkg/front_end/testcases/extension_types/nullable_access.dart.weak.expect b/pkg/front_end/testcases/extension_types/nullable_access.dart.weak.expect new file mode 100644 index 00000000000..c347afca55d --- /dev/null +++ b/pkg/front_end/testcases/extension_types/nullable_access.dart.weak.expect @@ -0,0 +1,35 @@ +library; +import self as self; +import "dart:core" as core; + +extension E on self::ET? /* = core::int? */ { + method foo = self::E|foo; + method tearoff foo = self::E|get#foo; +} +extension type ET(core::int? i) { + abstract inline-class-member representation-field get i() → core::int?; + method foo = self::ET|foo; + method tearoff foo = self::ET|get#foo; + constructor • = self::ET|constructor#; + constructor tearoff • = self::ET|constructor#_#new#tearOff; +} +static extension-member method E|foo(lowered final self::ET? /* = core::int? */ #this, core::int i) → void {} +static extension-member method E|get#foo(lowered final self::ET? /* = core::int? */ #this) → (core::int) → void + return (core::int i) → void => self::E|foo(#this, i); +static inline-class-member method ET|constructor#(core::int? i) → self::ET /* = core::int? */ { + lowered final self::ET /* = core::int? */ #this = i; + return #this; +} +static inline-class-member method ET|constructor#_#new#tearOff(core::int? i) → self::ET /* = core::int? */ + return self::ET|constructor#(i); +static inline-class-member method ET|foo(lowered final self::ET /* = core::int? */ #this) → void {} +static inline-class-member method ET|get#foo(lowered final self::ET /* = core::int? */ #this) → () → void + return () → void => self::ET|foo(#this); +static method method(self::ET /* = core::int? */ et1, self::ET? /* = core::int? */ et2, self::method::X% x1, self::method::X? x2, self::method::Y% y1, self::method::Y? y2) → dynamic { + self::ET|foo(et1); + self::E|foo(et2, 0); + self::ET|foo(x1); + self::E|foo(x2, 0); + self::E|foo(y1, 0); + self::E|foo(y2, 0); +} diff --git a/pkg/front_end/testcases/extension_types/nullable_access.dart.weak.modular.expect b/pkg/front_end/testcases/extension_types/nullable_access.dart.weak.modular.expect new file mode 100644 index 00000000000..c347afca55d --- /dev/null +++ b/pkg/front_end/testcases/extension_types/nullable_access.dart.weak.modular.expect @@ -0,0 +1,35 @@ +library; +import self as self; +import "dart:core" as core; + +extension E on self::ET? /* = core::int? */ { + method foo = self::E|foo; + method tearoff foo = self::E|get#foo; +} +extension type ET(core::int? i) { + abstract inline-class-member representation-field get i() → core::int?; + method foo = self::ET|foo; + method tearoff foo = self::ET|get#foo; + constructor • = self::ET|constructor#; + constructor tearoff • = self::ET|constructor#_#new#tearOff; +} +static extension-member method E|foo(lowered final self::ET? /* = core::int? */ #this, core::int i) → void {} +static extension-member method E|get#foo(lowered final self::ET? /* = core::int? */ #this) → (core::int) → void + return (core::int i) → void => self::E|foo(#this, i); +static inline-class-member method ET|constructor#(core::int? i) → self::ET /* = core::int? */ { + lowered final self::ET /* = core::int? */ #this = i; + return #this; +} +static inline-class-member method ET|constructor#_#new#tearOff(core::int? i) → self::ET /* = core::int? */ + return self::ET|constructor#(i); +static inline-class-member method ET|foo(lowered final self::ET /* = core::int? */ #this) → void {} +static inline-class-member method ET|get#foo(lowered final self::ET /* = core::int? */ #this) → () → void + return () → void => self::ET|foo(#this); +static method method(self::ET /* = core::int? */ et1, self::ET? /* = core::int? */ et2, self::method::X% x1, self::method::X? x2, self::method::Y% y1, self::method::Y? y2) → dynamic { + self::ET|foo(et1); + self::E|foo(et2, 0); + self::ET|foo(x1); + self::E|foo(x2, 0); + self::E|foo(y1, 0); + self::E|foo(y2, 0); +} diff --git a/pkg/front_end/testcases/extension_types/nullable_access.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/nullable_access.dart.weak.outline.expect new file mode 100644 index 00000000000..12697975ebe --- /dev/null +++ b/pkg/front_end/testcases/extension_types/nullable_access.dart.weak.outline.expect @@ -0,0 +1,29 @@ +library; +import self as self; +import "dart:core" as core; + +extension E on self::ET? /* = core::int? */ { + method foo = self::E|foo; + method tearoff foo = self::E|get#foo; +} +extension type ET(core::int? i) { + abstract inline-class-member representation-field get i() → core::int?; + method foo = self::ET|foo; + method tearoff foo = self::ET|get#foo; + constructor • = self::ET|constructor#; + constructor tearoff • = self::ET|constructor#_#new#tearOff; +} +static extension-member method E|foo(lowered final self::ET? /* = core::int? */ #this, core::int i) → void + ; +static extension-member method E|get#foo(lowered final self::ET? /* = core::int? */ #this) → (core::int) → void + return (core::int i) → void => self::E|foo(#this, i); +static inline-class-member method ET|constructor#(core::int? i) → self::ET /* = core::int? */ + ; +static inline-class-member method ET|constructor#_#new#tearOff(core::int? i) → self::ET /* = core::int? */ + return self::ET|constructor#(i); +static inline-class-member method ET|foo(lowered final self::ET /* = core::int? */ #this) → void + ; +static inline-class-member method ET|get#foo(lowered final self::ET /* = core::int? */ #this) → () → void + return () → void => self::ET|foo(#this); +static method method(self::ET /* = core::int? */ et1, self::ET? /* = core::int? */ et2, self::method::X% x1, self::method::X? x2, self::method::Y% y1, self::method::Y? y2) → dynamic + ; diff --git a/pkg/front_end/testcases/extension_types/nullable_access.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/nullable_access.dart.weak.transformed.expect new file mode 100644 index 00000000000..c347afca55d --- /dev/null +++ b/pkg/front_end/testcases/extension_types/nullable_access.dart.weak.transformed.expect @@ -0,0 +1,35 @@ +library; +import self as self; +import "dart:core" as core; + +extension E on self::ET? /* = core::int? */ { + method foo = self::E|foo; + method tearoff foo = self::E|get#foo; +} +extension type ET(core::int? i) { + abstract inline-class-member representation-field get i() → core::int?; + method foo = self::ET|foo; + method tearoff foo = self::ET|get#foo; + constructor • = self::ET|constructor#; + constructor tearoff • = self::ET|constructor#_#new#tearOff; +} +static extension-member method E|foo(lowered final self::ET? /* = core::int? */ #this, core::int i) → void {} +static extension-member method E|get#foo(lowered final self::ET? /* = core::int? */ #this) → (core::int) → void + return (core::int i) → void => self::E|foo(#this, i); +static inline-class-member method ET|constructor#(core::int? i) → self::ET /* = core::int? */ { + lowered final self::ET /* = core::int? */ #this = i; + return #this; +} +static inline-class-member method ET|constructor#_#new#tearOff(core::int? i) → self::ET /* = core::int? */ + return self::ET|constructor#(i); +static inline-class-member method ET|foo(lowered final self::ET /* = core::int? */ #this) → void {} +static inline-class-member method ET|get#foo(lowered final self::ET /* = core::int? */ #this) → () → void + return () → void => self::ET|foo(#this); +static method method(self::ET /* = core::int? */ et1, self::ET? /* = core::int? */ et2, self::method::X% x1, self::method::X? x2, self::method::Y% y1, self::method::Y? y2) → dynamic { + self::ET|foo(et1); + self::E|foo(et2, 0); + self::ET|foo(x1); + self::E|foo(x2, 0); + self::E|foo(y1, 0); + self::E|foo(y2, 0); +} diff --git a/pkg/front_end/testcases/extension_types/procedures.dart.strong.expect b/pkg/front_end/testcases/extension_types/procedures.dart.strong.expect index c46d66f57f1..0a88fbc389d 100644 --- a/pkg/front_end/testcases/extension_types/procedures.dart.strong.expect +++ b/pkg/front_end/testcases/extension_types/procedures.dart.strong.expect @@ -1,37 +1,4 @@ library; -// -// Problems in library: -// -// pkg/front_end/testcases/extension_types/procedures.dart:39:18: Error: Method 'instanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localM = instanceMethod(); -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:40:18: Error: Property 'instanceMethod' cannot be accessed on 'GenericClass' because it is potentially null. -// Try accessing using ?. instead. -// var localT = instanceMethod; -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:41:18: Error: Property 'instanceGetter' cannot be accessed on 'GenericClass' because it is potentially null. -// Try accessing using ?. instead. -// var localG = instanceGetter; -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:50:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG1 = genericInstanceMethod(s); -// ^^^^^^^^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:51:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG2 = genericInstanceMethod(i); -// ^^^^^^^^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:52:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG3 = genericInstanceMethod(i); -// ^^^^^^^^^^^^^^^^^^^^^ -// import self as self; import "dart:core" as core; @@ -109,18 +76,9 @@ static inline-class-member method GenericClass|constructor#_#_#tearOff(it); static inline-class-member method GenericClass|instanceMethod(lowered final self::GenericClass /* = self::GenericClass|instanceMethod::T% */ #this) → void { self::GenericClass /* = self::GenericClass|instanceMethod::T% */ local = #this; - void localM = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:39:18: Error: Method 'instanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localM = instanceMethod(); - ^^^^^^^^^^^^^^" in self::GenericClass|instanceMethod(#this); - () → void localT = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:40:18: Error: Property 'instanceMethod' cannot be accessed on 'GenericClass' because it is potentially null. -Try accessing using ?. instead. - var localT = instanceMethod; - ^^^^^^^^^^^^^^" in self::GenericClass|get#instanceMethod(#this); - self::GenericClass|instanceMethod::T% localG = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:41:18: Error: Property 'instanceGetter' cannot be accessed on 'GenericClass' because it is potentially null. -Try accessing using ?. instead. - var localG = instanceGetter; - ^^^^^^^^^^^^^^" in self::GenericClass|get#instanceGetter(#this); + void localM = self::GenericClass|instanceMethod(#this); + () → void localT = self::GenericClass|get#instanceMethod(#this); + self::GenericClass|instanceMethod::T% localG = self::GenericClass|get#instanceGetter(#this); } static inline-class-member method GenericClass|get#instanceMethod(lowered final self::GenericClass% /* = self::GenericClass|get#instanceMethod::T% */ #this) → () → void return () → void => self::GenericClass|instanceMethod(#this); @@ -130,18 +88,9 @@ static inline-class-member method GenericClass|instanceMethod2 /* = self::GenericClass|instanceMethod2::T% */ local = #this; core::String localS = s; core::int localI = i; - core::String localG1 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:50:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG1 = genericInstanceMethod(s); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, s); - core::int localG2 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:51:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG2 = genericInstanceMethod(i); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, i); - core::num localG3 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:52:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG3 = genericInstanceMethod(i); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, i); + core::String localG1 = self::GenericClass|genericInstanceMethod(#this, s); + core::int localG2 = self::GenericClass|genericInstanceMethod(#this, i); + core::num localG3 = self::GenericClass|genericInstanceMethod(#this, i); } static inline-class-member method GenericClass|get#instanceMethod2(lowered final self::GenericClass% /* = self::GenericClass|get#instanceMethod2::T% */ #this) → (core::String, {i: core::int}) → void return (core::String s, {core::int i = #C1}) → void => self::GenericClass|instanceMethod2(#this, s, i: i); diff --git a/pkg/front_end/testcases/extension_types/procedures.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/procedures.dart.strong.transformed.expect index c46d66f57f1..0a88fbc389d 100644 --- a/pkg/front_end/testcases/extension_types/procedures.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/extension_types/procedures.dart.strong.transformed.expect @@ -1,37 +1,4 @@ library; -// -// Problems in library: -// -// pkg/front_end/testcases/extension_types/procedures.dart:39:18: Error: Method 'instanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localM = instanceMethod(); -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:40:18: Error: Property 'instanceMethod' cannot be accessed on 'GenericClass' because it is potentially null. -// Try accessing using ?. instead. -// var localT = instanceMethod; -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:41:18: Error: Property 'instanceGetter' cannot be accessed on 'GenericClass' because it is potentially null. -// Try accessing using ?. instead. -// var localG = instanceGetter; -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:50:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG1 = genericInstanceMethod(s); -// ^^^^^^^^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:51:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG2 = genericInstanceMethod(i); -// ^^^^^^^^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:52:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG3 = genericInstanceMethod(i); -// ^^^^^^^^^^^^^^^^^^^^^ -// import self as self; import "dart:core" as core; @@ -109,18 +76,9 @@ static inline-class-member method GenericClass|constructor#_#_#tearOff(it); static inline-class-member method GenericClass|instanceMethod(lowered final self::GenericClass /* = self::GenericClass|instanceMethod::T% */ #this) → void { self::GenericClass /* = self::GenericClass|instanceMethod::T% */ local = #this; - void localM = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:39:18: Error: Method 'instanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localM = instanceMethod(); - ^^^^^^^^^^^^^^" in self::GenericClass|instanceMethod(#this); - () → void localT = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:40:18: Error: Property 'instanceMethod' cannot be accessed on 'GenericClass' because it is potentially null. -Try accessing using ?. instead. - var localT = instanceMethod; - ^^^^^^^^^^^^^^" in self::GenericClass|get#instanceMethod(#this); - self::GenericClass|instanceMethod::T% localG = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:41:18: Error: Property 'instanceGetter' cannot be accessed on 'GenericClass' because it is potentially null. -Try accessing using ?. instead. - var localG = instanceGetter; - ^^^^^^^^^^^^^^" in self::GenericClass|get#instanceGetter(#this); + void localM = self::GenericClass|instanceMethod(#this); + () → void localT = self::GenericClass|get#instanceMethod(#this); + self::GenericClass|instanceMethod::T% localG = self::GenericClass|get#instanceGetter(#this); } static inline-class-member method GenericClass|get#instanceMethod(lowered final self::GenericClass% /* = self::GenericClass|get#instanceMethod::T% */ #this) → () → void return () → void => self::GenericClass|instanceMethod(#this); @@ -130,18 +88,9 @@ static inline-class-member method GenericClass|instanceMethod2 /* = self::GenericClass|instanceMethod2::T% */ local = #this; core::String localS = s; core::int localI = i; - core::String localG1 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:50:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG1 = genericInstanceMethod(s); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, s); - core::int localG2 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:51:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG2 = genericInstanceMethod(i); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, i); - core::num localG3 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:52:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG3 = genericInstanceMethod(i); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, i); + core::String localG1 = self::GenericClass|genericInstanceMethod(#this, s); + core::int localG2 = self::GenericClass|genericInstanceMethod(#this, i); + core::num localG3 = self::GenericClass|genericInstanceMethod(#this, i); } static inline-class-member method GenericClass|get#instanceMethod2(lowered final self::GenericClass% /* = self::GenericClass|get#instanceMethod2::T% */ #this) → (core::String, {i: core::int}) → void return (core::String s, {core::int i = #C1}) → void => self::GenericClass|instanceMethod2(#this, s, i: i); diff --git a/pkg/front_end/testcases/extension_types/procedures.dart.weak.expect b/pkg/front_end/testcases/extension_types/procedures.dart.weak.expect index c46d66f57f1..0a88fbc389d 100644 --- a/pkg/front_end/testcases/extension_types/procedures.dart.weak.expect +++ b/pkg/front_end/testcases/extension_types/procedures.dart.weak.expect @@ -1,37 +1,4 @@ library; -// -// Problems in library: -// -// pkg/front_end/testcases/extension_types/procedures.dart:39:18: Error: Method 'instanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localM = instanceMethod(); -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:40:18: Error: Property 'instanceMethod' cannot be accessed on 'GenericClass' because it is potentially null. -// Try accessing using ?. instead. -// var localT = instanceMethod; -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:41:18: Error: Property 'instanceGetter' cannot be accessed on 'GenericClass' because it is potentially null. -// Try accessing using ?. instead. -// var localG = instanceGetter; -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:50:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG1 = genericInstanceMethod(s); -// ^^^^^^^^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:51:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG2 = genericInstanceMethod(i); -// ^^^^^^^^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:52:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG3 = genericInstanceMethod(i); -// ^^^^^^^^^^^^^^^^^^^^^ -// import self as self; import "dart:core" as core; @@ -109,18 +76,9 @@ static inline-class-member method GenericClass|constructor#_#_#tearOff(it); static inline-class-member method GenericClass|instanceMethod(lowered final self::GenericClass /* = self::GenericClass|instanceMethod::T% */ #this) → void { self::GenericClass /* = self::GenericClass|instanceMethod::T% */ local = #this; - void localM = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:39:18: Error: Method 'instanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localM = instanceMethod(); - ^^^^^^^^^^^^^^" in self::GenericClass|instanceMethod(#this); - () → void localT = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:40:18: Error: Property 'instanceMethod' cannot be accessed on 'GenericClass' because it is potentially null. -Try accessing using ?. instead. - var localT = instanceMethod; - ^^^^^^^^^^^^^^" in self::GenericClass|get#instanceMethod(#this); - self::GenericClass|instanceMethod::T% localG = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:41:18: Error: Property 'instanceGetter' cannot be accessed on 'GenericClass' because it is potentially null. -Try accessing using ?. instead. - var localG = instanceGetter; - ^^^^^^^^^^^^^^" in self::GenericClass|get#instanceGetter(#this); + void localM = self::GenericClass|instanceMethod(#this); + () → void localT = self::GenericClass|get#instanceMethod(#this); + self::GenericClass|instanceMethod::T% localG = self::GenericClass|get#instanceGetter(#this); } static inline-class-member method GenericClass|get#instanceMethod(lowered final self::GenericClass% /* = self::GenericClass|get#instanceMethod::T% */ #this) → () → void return () → void => self::GenericClass|instanceMethod(#this); @@ -130,18 +88,9 @@ static inline-class-member method GenericClass|instanceMethod2 /* = self::GenericClass|instanceMethod2::T% */ local = #this; core::String localS = s; core::int localI = i; - core::String localG1 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:50:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG1 = genericInstanceMethod(s); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, s); - core::int localG2 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:51:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG2 = genericInstanceMethod(i); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, i); - core::num localG3 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:52:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG3 = genericInstanceMethod(i); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, i); + core::String localG1 = self::GenericClass|genericInstanceMethod(#this, s); + core::int localG2 = self::GenericClass|genericInstanceMethod(#this, i); + core::num localG3 = self::GenericClass|genericInstanceMethod(#this, i); } static inline-class-member method GenericClass|get#instanceMethod2(lowered final self::GenericClass% /* = self::GenericClass|get#instanceMethod2::T% */ #this) → (core::String, {i: core::int}) → void return (core::String s, {core::int i = #C1}) → void => self::GenericClass|instanceMethod2(#this, s, i: i); diff --git a/pkg/front_end/testcases/extension_types/procedures.dart.weak.modular.expect b/pkg/front_end/testcases/extension_types/procedures.dart.weak.modular.expect index c46d66f57f1..0a88fbc389d 100644 --- a/pkg/front_end/testcases/extension_types/procedures.dart.weak.modular.expect +++ b/pkg/front_end/testcases/extension_types/procedures.dart.weak.modular.expect @@ -1,37 +1,4 @@ library; -// -// Problems in library: -// -// pkg/front_end/testcases/extension_types/procedures.dart:39:18: Error: Method 'instanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localM = instanceMethod(); -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:40:18: Error: Property 'instanceMethod' cannot be accessed on 'GenericClass' because it is potentially null. -// Try accessing using ?. instead. -// var localT = instanceMethod; -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:41:18: Error: Property 'instanceGetter' cannot be accessed on 'GenericClass' because it is potentially null. -// Try accessing using ?. instead. -// var localG = instanceGetter; -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:50:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG1 = genericInstanceMethod(s); -// ^^^^^^^^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:51:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG2 = genericInstanceMethod(i); -// ^^^^^^^^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:52:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG3 = genericInstanceMethod(i); -// ^^^^^^^^^^^^^^^^^^^^^ -// import self as self; import "dart:core" as core; @@ -109,18 +76,9 @@ static inline-class-member method GenericClass|constructor#_#_#tearOff(it); static inline-class-member method GenericClass|instanceMethod(lowered final self::GenericClass /* = self::GenericClass|instanceMethod::T% */ #this) → void { self::GenericClass /* = self::GenericClass|instanceMethod::T% */ local = #this; - void localM = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:39:18: Error: Method 'instanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localM = instanceMethod(); - ^^^^^^^^^^^^^^" in self::GenericClass|instanceMethod(#this); - () → void localT = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:40:18: Error: Property 'instanceMethod' cannot be accessed on 'GenericClass' because it is potentially null. -Try accessing using ?. instead. - var localT = instanceMethod; - ^^^^^^^^^^^^^^" in self::GenericClass|get#instanceMethod(#this); - self::GenericClass|instanceMethod::T% localG = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:41:18: Error: Property 'instanceGetter' cannot be accessed on 'GenericClass' because it is potentially null. -Try accessing using ?. instead. - var localG = instanceGetter; - ^^^^^^^^^^^^^^" in self::GenericClass|get#instanceGetter(#this); + void localM = self::GenericClass|instanceMethod(#this); + () → void localT = self::GenericClass|get#instanceMethod(#this); + self::GenericClass|instanceMethod::T% localG = self::GenericClass|get#instanceGetter(#this); } static inline-class-member method GenericClass|get#instanceMethod(lowered final self::GenericClass% /* = self::GenericClass|get#instanceMethod::T% */ #this) → () → void return () → void => self::GenericClass|instanceMethod(#this); @@ -130,18 +88,9 @@ static inline-class-member method GenericClass|instanceMethod2 /* = self::GenericClass|instanceMethod2::T% */ local = #this; core::String localS = s; core::int localI = i; - core::String localG1 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:50:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG1 = genericInstanceMethod(s); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, s); - core::int localG2 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:51:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG2 = genericInstanceMethod(i); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, i); - core::num localG3 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:52:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG3 = genericInstanceMethod(i); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, i); + core::String localG1 = self::GenericClass|genericInstanceMethod(#this, s); + core::int localG2 = self::GenericClass|genericInstanceMethod(#this, i); + core::num localG3 = self::GenericClass|genericInstanceMethod(#this, i); } static inline-class-member method GenericClass|get#instanceMethod2(lowered final self::GenericClass% /* = self::GenericClass|get#instanceMethod2::T% */ #this) → (core::String, {i: core::int}) → void return (core::String s, {core::int i = #C1}) → void => self::GenericClass|instanceMethod2(#this, s, i: i); diff --git a/pkg/front_end/testcases/extension_types/procedures.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/procedures.dart.weak.transformed.expect index c46d66f57f1..0a88fbc389d 100644 --- a/pkg/front_end/testcases/extension_types/procedures.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/extension_types/procedures.dart.weak.transformed.expect @@ -1,37 +1,4 @@ library; -// -// Problems in library: -// -// pkg/front_end/testcases/extension_types/procedures.dart:39:18: Error: Method 'instanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localM = instanceMethod(); -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:40:18: Error: Property 'instanceMethod' cannot be accessed on 'GenericClass' because it is potentially null. -// Try accessing using ?. instead. -// var localT = instanceMethod; -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:41:18: Error: Property 'instanceGetter' cannot be accessed on 'GenericClass' because it is potentially null. -// Try accessing using ?. instead. -// var localG = instanceGetter; -// ^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:50:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG1 = genericInstanceMethod(s); -// ^^^^^^^^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:51:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG2 = genericInstanceMethod(i); -// ^^^^^^^^^^^^^^^^^^^^^ -// -// pkg/front_end/testcases/extension_types/procedures.dart:52:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -// Try calling using ?. instead. -// var localG3 = genericInstanceMethod(i); -// ^^^^^^^^^^^^^^^^^^^^^ -// import self as self; import "dart:core" as core; @@ -109,18 +76,9 @@ static inline-class-member method GenericClass|constructor#_#_#tearOff(it); static inline-class-member method GenericClass|instanceMethod(lowered final self::GenericClass /* = self::GenericClass|instanceMethod::T% */ #this) → void { self::GenericClass /* = self::GenericClass|instanceMethod::T% */ local = #this; - void localM = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:39:18: Error: Method 'instanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localM = instanceMethod(); - ^^^^^^^^^^^^^^" in self::GenericClass|instanceMethod(#this); - () → void localT = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:40:18: Error: Property 'instanceMethod' cannot be accessed on 'GenericClass' because it is potentially null. -Try accessing using ?. instead. - var localT = instanceMethod; - ^^^^^^^^^^^^^^" in self::GenericClass|get#instanceMethod(#this); - self::GenericClass|instanceMethod::T% localG = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:41:18: Error: Property 'instanceGetter' cannot be accessed on 'GenericClass' because it is potentially null. -Try accessing using ?. instead. - var localG = instanceGetter; - ^^^^^^^^^^^^^^" in self::GenericClass|get#instanceGetter(#this); + void localM = self::GenericClass|instanceMethod(#this); + () → void localT = self::GenericClass|get#instanceMethod(#this); + self::GenericClass|instanceMethod::T% localG = self::GenericClass|get#instanceGetter(#this); } static inline-class-member method GenericClass|get#instanceMethod(lowered final self::GenericClass% /* = self::GenericClass|get#instanceMethod::T% */ #this) → () → void return () → void => self::GenericClass|instanceMethod(#this); @@ -130,18 +88,9 @@ static inline-class-member method GenericClass|instanceMethod2 /* = self::GenericClass|instanceMethod2::T% */ local = #this; core::String localS = s; core::int localI = i; - core::String localG1 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:50:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG1 = genericInstanceMethod(s); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, s); - core::int localG2 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:51:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG2 = genericInstanceMethod(i); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, i); - core::num localG3 = invalid-expression "pkg/front_end/testcases/extension_types/procedures.dart:52:19: Error: Method 'genericInstanceMethod' cannot be called on 'GenericClass' because it is potentially null. -Try calling using ?. instead. - var localG3 = genericInstanceMethod(i); - ^^^^^^^^^^^^^^^^^^^^^" in self::GenericClass|genericInstanceMethod(#this, i); + core::String localG1 = self::GenericClass|genericInstanceMethod(#this, s); + core::int localG2 = self::GenericClass|genericInstanceMethod(#this, i); + core::num localG3 = self::GenericClass|genericInstanceMethod(#this, i); } static inline-class-member method GenericClass|get#instanceMethod2(lowered final self::GenericClass% /* = self::GenericClass|get#instanceMethod2::T% */ #this) → (core::String, {i: core::int}) → void return (core::String s, {core::int i = #C1}) → void => self::GenericClass|instanceMethod2(#this, s, i: i); diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart index 376d9473f29..cfd5d86acc4 100644 --- a/pkg/kernel/lib/ast.dart +++ b/pkg/kernel/lib/ast.dart @@ -4040,7 +4040,7 @@ sealed class Expression extends TreeNode { return context.typeEnvironment.coreTypes .rawType(superclass, context.nonNullable); } - DartType type = getStaticType(context).resolveTypeParameterType; + DartType type = getStaticType(context).nonTypeVariableBound; if (type is NullType) { return context.typeEnvironment.coreTypes .bottomInterfaceType(superclass, context.nullable); @@ -9798,7 +9798,7 @@ class ForInStatement extends Statement { /// type of this for-in statement is not already cached in [context]. DartType getElementTypeInternal(StaticTypeContext context) { DartType iterableType = - iterable.getStaticType(context).resolveTypeParameterType; + iterable.getStaticType(context).nonTypeVariableBound; // TODO(johnniwinther): Update this to use the type of // `iterable.iterator.current` if inference is updated accordingly. while (iterableType is TypeParameterType) { @@ -11099,8 +11099,20 @@ sealed class DartType extends Node { nullability == Nullability.undetermined; } - /// Returns the non-type parameter type bound of this type. - DartType get resolveTypeParameterType; + /// Returns the non-type variable bound of this type, taking nullability + /// into account. + /// + /// For instance in + /// + /// method() + /// + /// the non-type variable bound of `T` is `Object?`, for `S` it is `Class`, + /// and for `U` it is `Class?`. + DartType get nonTypeVariableBound; + + /// Returns `true` if members *not* declared on `Object` can be accessed on + /// a receiver of this type. + bool get hasNonObjectMemberAccess; /// Returns the type with all occurrences of [ExtensionType] replaced by their /// representations, transitively. This is the type used at runtime to @@ -11180,7 +11192,10 @@ class InvalidType extends DartType { void visitChildren(Visitor v) {} @override - DartType get resolveTypeParameterType => this; + DartType get nonTypeVariableBound => this; + + @override + bool get hasNonObjectMemberAccess => true; @override bool equals(Object other, Assumptions? assumptions) => other is InvalidType; @@ -11230,7 +11245,10 @@ class DynamicType extends DartType { void visitChildren(Visitor v) {} @override - DartType get resolveTypeParameterType => this; + DartType get nonTypeVariableBound => this; + + @override + bool get hasNonObjectMemberAccess => true; @override bool equals(Object other, Assumptions? assumptions) => other is DynamicType; @@ -11272,7 +11290,10 @@ class VoidType extends DartType { void visitChildren(Visitor v) {} @override - DartType get resolveTypeParameterType => this; + DartType get nonTypeVariableBound => this; + + @override + bool get hasNonObjectMemberAccess => false; @override bool equals(Object other, Assumptions? assumptions) => other is VoidType; @@ -11328,7 +11349,15 @@ class NeverType extends DartType { Nullability get nullability => declaredNullability; @override - DartType get resolveTypeParameterType => this; + DartType get nonTypeVariableBound => this; + + @override + bool get hasNonObjectMemberAccess => switch (declaredNullability) { + Nullability.undetermined => false, + Nullability.nullable => false, + Nullability.nonNullable => true, + Nullability.legacy => true, + }; @override int get hashCode { @@ -11386,7 +11415,10 @@ class NullType extends DartType { void visitChildren(Visitor v) {} @override - DartType get resolveTypeParameterType => this; + DartType get nonTypeVariableBound => this; + + @override + bool get hasNonObjectMemberAccess => false; @override bool equals(Object other, Assumptions? assumptions) => other is NullType; @@ -11439,7 +11471,15 @@ class InterfaceType extends TypeDeclarationType { Nullability get nullability => declaredNullability; @override - DartType get resolveTypeParameterType => this; + bool get hasNonObjectMemberAccess => switch (declaredNullability) { + Nullability.undetermined => false, + Nullability.nullable => false, + Nullability.nonNullable => true, + Nullability.legacy => true, + }; + + @override + DartType get nonTypeVariableBound => this; static List _defaultTypeArguments(Class classNode) { if (classNode.typeParameters.length == 0) { @@ -11542,7 +11582,15 @@ class FunctionType extends DartType { Nullability get nullability => declaredNullability; @override - DartType get resolveTypeParameterType => this; + DartType get nonTypeVariableBound => this; + + @override + bool get hasNonObjectMemberAccess => switch (declaredNullability) { + Nullability.undetermined => false, + Nullability.nullable => false, + Nullability.nonNullable => true, + Nullability.legacy => true, + }; @override R accept(DartTypeVisitor v) => v.visitFunctionType(this); @@ -11741,7 +11789,10 @@ class TypedefType extends DartType { Nullability get nullability => declaredNullability; @override - DartType get resolveTypeParameterType => unalias.resolveTypeParameterType; + DartType get nonTypeVariableBound => unalias.nonTypeVariableBound; + + @override + bool get hasNonObjectMemberAccess => unalias.hasNonObjectMemberAccess; @override R accept(DartTypeVisitor v) => v.visitTypedefType(this); @@ -11849,7 +11900,10 @@ class FutureOrType extends DartType { } @override - DartType get resolveTypeParameterType => this; + DartType get nonTypeVariableBound => this; + + @override + bool get hasNonObjectMemberAccess => false; @override bool equals(Object other, Assumptions? assumptions) { @@ -11957,7 +12011,17 @@ class ExtensionType extends TypeDeclarationType { } @override - DartType get resolveTypeParameterType => this; + DartType get nonTypeVariableBound => this; + + @override + bool get hasNonObjectMemberAccess => switch (declaredNullability) { + // Undetermined means that the extension type does not implement + // `Object` but is not explicitly marked as nullable. + Nullability.undetermined => true, + Nullability.nullable => false, + Nullability.nonNullable => true, + Nullability.legacy => true, + }; static List _defaultTypeArguments( ExtensionTypeDeclaration extensionTypeDeclaration) { @@ -12201,7 +12265,16 @@ class IntersectionType extends DartType { } @override - DartType get resolveTypeParameterType => right.resolveTypeParameterType; + DartType get nonTypeVariableBound { + DartType resolvedTypeParameterType = right.nonTypeVariableBound; + return resolvedTypeParameterType.withDeclaredNullability( + combineNullabilitiesForSubstitution( + resolvedTypeParameterType.nullability, declaredNullability)); + } + + @override + bool get hasNonObjectMemberAccess => + nonTypeVariableBound.hasNonObjectMemberAccess; @override R accept(DartTypeVisitor v) => v.visitIntersectionType(this); @@ -12484,7 +12557,16 @@ class TypeParameterType extends DartType { : Nullability.legacy; @override - DartType get resolveTypeParameterType => bound.resolveTypeParameterType; + DartType get nonTypeVariableBound { + DartType resolvedTypeParameterType = bound.nonTypeVariableBound; + return resolvedTypeParameterType.withDeclaredNullability( + combineNullabilitiesForSubstitution( + resolvedTypeParameterType.nullability, declaredNullability)); + } + + @override + bool get hasNonObjectMemberAccess => + nonTypeVariableBound.hasNonObjectMemberAccess; @override R accept(DartTypeVisitor v) => v.visitTypeParameterType(this); @@ -12639,7 +12721,16 @@ class StructuralParameterType extends DartType { : Nullability.legacy; @override - DartType get resolveTypeParameterType => bound.resolveTypeParameterType; + DartType get nonTypeVariableBound { + DartType resolvedTypeParameterType = bound.nonTypeVariableBound; + return resolvedTypeParameterType.withDeclaredNullability( + combineNullabilitiesForSubstitution( + resolvedTypeParameterType.nullability, declaredNullability)); + } + + @override + bool get hasNonObjectMemberAccess => + nonTypeVariableBound.hasNonObjectMemberAccess; @override R accept(DartTypeVisitor v) => v.visitStructuralParameterType(this); @@ -12786,7 +12877,15 @@ class RecordType extends DartType { Nullability get nullability => declaredNullability; @override - DartType get resolveTypeParameterType => this; + DartType get nonTypeVariableBound => this; + + @override + bool get hasNonObjectMemberAccess => switch (declaredNullability) { + Nullability.undetermined => false, + Nullability.nullable => false, + Nullability.nonNullable => true, + Nullability.legacy => true, + }; @override R accept(DartTypeVisitor v) { diff --git a/pkg/kernel/lib/naive_type_checker.dart b/pkg/kernel/lib/naive_type_checker.dart index 05d2bf711eb..6521a522f58 100644 --- a/pkg/kernel/lib/naive_type_checker.dart +++ b/pkg/kernel/lib/naive_type_checker.dart @@ -268,7 +268,7 @@ super method declares ${superParameter.type} @override void checkUnresolvedInvocation(DartType receiver, TreeNode where) { - receiver = receiver.resolveTypeParameterType; + receiver = receiver.nonTypeVariableBound; if (receiver is DynamicType) { return; diff --git a/pkg/kernel/lib/type_checker.dart b/pkg/kernel/lib/type_checker.dart index 15342e9d18c..efe9b31b29d 100644 --- a/pkg/kernel/lib/type_checker.dart +++ b/pkg/kernel/lib/type_checker.dart @@ -249,7 +249,7 @@ class TypeCheckingVisitor return Substitution.empty; // Members on Object are always accessible. } - type = type.resolveTypeParameterType; + type = type.nonTypeVariableBound; if (type is NeverType || type is NullType || type is InvalidType) { // The bottom type is a subtype of all types, so it should be allowed. return Substitution.bottomForTypeDeclaration(typeDeclaration); diff --git a/pkg/kernel/lib/type_environment.dart b/pkg/kernel/lib/type_environment.dart index 8cd514cf35c..5ec517a791d 100644 --- a/pkg/kernel/lib/type_environment.dart +++ b/pkg/kernel/lib/type_environment.dart @@ -98,7 +98,7 @@ abstract class TypeEnvironment extends Types { // // When none of these cases are applicable, we say that T does not have a // future type. - DartType resolved = t.resolveTypeParameterType; + DartType resolved = t.nonTypeVariableBound; if (resolved is TypeDeclarationType) { DartType? futureType = getTypeAsInstanceOf( resolved, coreTypes.futureClass, coreTypes, @@ -284,8 +284,8 @@ abstract class TypeEnvironment extends Types { // Otherwise the static type of e is num. return coreTypes.numNonNullableRawType; } else { - type1 = type1.resolveTypeParameterType; - type2 = type2.resolveTypeParameterType; + type1 = type1.nonTypeVariableBound; + type2 = type2.nonTypeVariableBound; if (type1 == type2) return type1;