diff --git a/pkg/_fe_analyzer_shared/analysis_options_no_lints.yaml b/pkg/_fe_analyzer_shared/analysis_options_no_lints.yaml index dcb9ebbbbe49..dd47ce52df37 100644 --- a/pkg/_fe_analyzer_shared/analysis_options_no_lints.yaml +++ b/pkg/_fe_analyzer_shared/analysis_options_no_lints.yaml @@ -20,3 +20,4 @@ analyzer: - test/inference/inferred_type_arguments/data/** - test/inference/inferred_variable_types/data/** - test/inheritance/data/** + - test/metadata/data/** diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/arguments.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/arguments.dart new file mode 100644 index 000000000000..f5c17bac7f6c --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/arguments.dart @@ -0,0 +1,49 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'expressions.dart'; +import 'proto.dart'; + +/// Superclass for named and position arguments. +// TODO(johnniwinther): Merge subclasses into one class? +sealed class Argument { + /// Returns the [Argument] corresponding to this [Argument] in + /// which all [UnresolvedIdentifier]s have been resolved within their scope. + /// + /// If this didn't create a new [Argument], `null` is returned. + Argument? resolve(); +} + +class PositionalArgument extends Argument { + final Expression expression; + + PositionalArgument(this.expression); + + @override + String toString() => 'PositionalArgument($expression)'; + + @override + Argument? resolve() { + Expression? newExpression = expression.resolve(); + return newExpression == null ? null : new PositionalArgument(newExpression); + } +} + +class NamedArgument extends Argument { + final String name; + final Expression expression; + + NamedArgument(this.name, this.expression); + + @override + String toString() => 'NamedArgument($name,$expression)'; + + @override + Argument? resolve() { + Expression? newExpression = expression.resolve(); + return newExpression == null + ? null + : new NamedArgument(name, newExpression); + } +} diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/ast.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/ast.dart new file mode 100644 index 000000000000..c6871ea2a035 --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/ast.dart @@ -0,0 +1,13 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +export 'arguments.dart'; +export 'elements.dart'; +export 'expressions.dart'; +export 'formal_parameters.dart'; +export 'proto.dart'; +export 'record_fields.dart'; +export 'references.dart'; +export 'string_literal_parts.dart'; +export 'type_annotations.dart'; diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/elements.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/elements.dart new file mode 100644 index 000000000000..1a8994bbfdc7 --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/elements.dart @@ -0,0 +1,104 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'expressions.dart'; +import 'proto.dart'; + +/// Superclass for collection elements. +sealed class Element { + /// Returns the [Element] corresponding to this [Element] in + /// which all [UnresolvedIdentifier]s have been resolved within their scope. + /// + /// If this didn't create a new [Element], `null` is returned. + Element? resolve(); +} + +class ExpressionElement extends Element { + final Expression expression; + final bool isNullAware; + + ExpressionElement(this.expression, {required this.isNullAware}); + + @override + String toString() => + 'ExpressionElement($expression,isNullAware=$isNullAware)'; + + @override + Element? resolve() { + Expression? newExpression = expression.resolve(); + return newExpression == null + ? null + : new ExpressionElement(newExpression, isNullAware: isNullAware); + } +} + +class MapEntryElement extends Element { + final Expression key; + final Expression value; + final bool isNullAwareKey; + final bool isNullAwareValue; + + MapEntryElement(this.key, this.value, + {required this.isNullAwareKey, required this.isNullAwareValue}); + + @override + String toString() => 'MapEntryElement($key,$value,' + 'isNullAwareKey=$isNullAwareValue,isNullAwareValue=$isNullAwareValue)'; + + @override + Element? resolve() { + Expression? newKey = key.resolve(); + Expression? newValue = value.resolve(); + return newKey == null && newValue == null + ? null + : new MapEntryElement(newKey ?? key, newValue ?? value, + isNullAwareKey: isNullAwareKey, isNullAwareValue: isNullAwareValue); + } +} + +class SpreadElement extends Element { + final Expression expression; + final bool isNullAware; + + SpreadElement(this.expression, {required this.isNullAware}); + + @override + String toString() => 'SpreadElement($expression,isNullAware=$isNullAware)'; + + @override + Element? resolve() { + Expression? newExpression = expression.resolve(); + return newExpression == null + ? null + : new SpreadElement(newExpression, isNullAware: isNullAware); + } +} + +class IfElement extends Element { + final Expression condition; + final Element then; + final Element? otherwise; + + IfElement(this.condition, this.then, [this.otherwise]); + + @override + String toString() => 'IfElement($condition,$then,$otherwise)'; + + @override + Element? resolve() { + Expression? newCondition = condition.resolve(); + Element? newThen = then.resolve(); + Element? newOtherwise = otherwise?.resolve(); + if (otherwise != null) { + return newCondition == null && newThen == null && newOtherwise == null + ? null + : new IfElement(newCondition ?? condition, newThen ?? then, + newOtherwise ?? otherwise); + } else { + return newCondition == null && newThen == null + ? null + : new IfElement(newCondition ?? condition, newThen ?? then); + } + } +} diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/expressions.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/expressions.dart new file mode 100644 index 000000000000..cc8f383f2e46 --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/expressions.dart @@ -0,0 +1,637 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'arguments.dart'; +import 'elements.dart'; +import 'proto.dart'; +import 'record_fields.dart'; +import 'references.dart'; +import 'string_literal_parts.dart'; +import 'type_annotations.dart'; +import 'util.dart'; + +/// Superclass for all expression nodes. +sealed class Expression { + /// Returns the [Expression] corresponding to this [Expression] in which all + /// [UnresolvedIdentifier]s have been resolved within their scope. + /// + /// If this didn't create a new [Expression], `null` is returned. + Expression? resolve(); +} + +class InvalidExpression extends Expression { + @override + String toString() => 'InvalidExpression()'; + + @override + Expression? resolve() => null; +} + +class StaticGet extends Expression { + final FieldReference reference; + + StaticGet(this.reference); + + @override + String toString() => 'StaticGet($reference)'; + + @override + Expression? resolve() => null; +} + +class FunctionTearOff extends Expression { + final FunctionReference reference; + + FunctionTearOff(this.reference); + + @override + String toString() => 'FunctionTearOff($reference)'; + + @override + Expression? resolve() => null; +} + +class ConstructorTearOff extends Expression { + final TypeAnnotation type; + final ConstructorReference reference; + + ConstructorTearOff(this.type, this.reference); + + @override + String toString() => 'ConstructorTearOff($type,$reference)'; + + @override + Expression? resolve() { + TypeAnnotation? newType = type.resolve(); + return newType == null ? null : new ConstructorTearOff(newType, reference); + } +} + +class ConstructorInvocation extends Expression { + final TypeAnnotation type; + final Reference constructor; + final List arguments; + + ConstructorInvocation(this.type, this.constructor, this.arguments); + + @override + String toString() => 'ConstructorInvocation($type,$constructor,$arguments)'; + + @override + Expression? resolve() { + TypeAnnotation? newType = type.resolve(); + List? newArguments = arguments.resolve((a) => a.resolve()); + return newType == null && newArguments == null + ? null + : new ConstructorInvocation( + newType ?? type, constructor, newArguments ?? arguments); + } +} + +class IntegerLiteral extends Expression { + final String text; + + IntegerLiteral(this.text); + + @override + String toString() => 'IntegerLiteral($text)'; + + @override + Expression? resolve() => null; +} + +class DoubleLiteral extends Expression { + final String text; + + DoubleLiteral(this.text); + + @override + String toString() => 'DoubleLiteral($text)'; + + @override + Expression? resolve() => null; +} + +class BooleanLiteral extends Expression { + final String text; + + BooleanLiteral(this.text); + + @override + String toString() => 'BooleanLiteral($text)'; + + @override + Expression? resolve() => null; +} + +class NullLiteral extends Expression { + NullLiteral(); + + @override + String toString() => 'NullLiteral()'; + + @override + Expression? resolve() => null; +} + +class SymbolLiteral extends Expression { + final List parts; + + SymbolLiteral(this.parts); + + @override + String toString() => 'SymbolLiteral($parts)'; + + @override + Expression? resolve() => null; +} + +class StringLiteral extends Expression { + final List parts; + + StringLiteral(this.parts); + + @override + String toString() => 'StringLiteral($parts)'; + + @override + Expression? resolve() { + List? newParts = parts.resolve((p) => p.resolve()); + return newParts == null ? null : new StringLiteral(newParts); + } +} + +class StringJuxtaposition extends Expression { + final List expressions; + + StringJuxtaposition(this.expressions); + + @override + String toString() => 'StringJuxtaposition($expressions)'; + + @override + Expression? resolve() { + List? newExpressions = expressions.resolve((e) => e.resolve()); + return newExpressions == null + ? null + : new StringJuxtaposition(newExpressions); + } +} + +class ImplicitInvocation extends Expression { + final Expression receiver; + final List typeArguments; + final List arguments; + + ImplicitInvocation(this.receiver, this.typeArguments, this.arguments); + + @override + String toString() => + 'ImplicitInvocation($receiver,$typeArguments,$arguments)'; + + @override + Expression? resolve() { + Expression? newReceiver = receiver.resolve(); + List? newTypeArguments = + typeArguments.resolve((t) => t.resolve()); + List? newArguments = arguments.resolve((a) => a.resolve()); + return newReceiver == null && + newTypeArguments == null && + newArguments == null + ? null + : new ImplicitInvocation(newReceiver ?? receiver, + newTypeArguments ?? typeArguments, newArguments ?? arguments); + } +} + +class StaticInvocation extends Expression { + final FunctionReference function; + final List typeArguments; + final List arguments; + + StaticInvocation(this.function, this.typeArguments, this.arguments); + + @override + String toString() => 'StaticInvocation($function,$typeArguments,$arguments)'; + + @override + Expression? resolve() { + List? newTypeArguments = + typeArguments.resolve((t) => t.resolve()); + List? newArguments = arguments.resolve((a) => a.resolve()); + return newTypeArguments == null && newArguments == null + ? null + : new StaticInvocation(function, newTypeArguments ?? typeArguments, + newArguments ?? arguments); + } +} + +class Instantiation extends Expression { + final Expression receiver; + final List typeArguments; + + Instantiation(this.receiver, this.typeArguments); + + @override + String toString() => 'Instantiation($receiver,$typeArguments)'; + + @override + Expression? resolve() { + Expression? newReceiver = receiver.resolve(); + List? newTypeArguments = + typeArguments.resolve((t) => t.resolve()); + return newReceiver == null && newTypeArguments == null + ? null + : new Instantiation( + newReceiver ?? receiver, newTypeArguments ?? typeArguments); + } +} + +class MethodInvocation extends Expression { + final Expression receiver; + final String name; + final List typeArguments; + final List arguments; + + MethodInvocation( + this.receiver, this.name, this.typeArguments, this.arguments); + + @override + String toString() => + 'MethodInvocation($receiver,$name,$typeArguments,$arguments)'; + + @override + Expression? resolve() { + Expression? newReceiver = receiver.resolve(); + List? newTypeArguments = + typeArguments.resolve((t) => t.resolve()); + List? newArguments = arguments.resolve((a) => a.resolve()); + return newReceiver == null && + newTypeArguments == null && + newArguments == null + ? null + : new MethodInvocation(newReceiver ?? receiver, name, + newTypeArguments ?? typeArguments, newArguments ?? arguments); + } +} + +class PropertyGet extends Expression { + final Expression receiver; + final String name; + + PropertyGet(this.receiver, this.name); + + @override + String toString() => 'PropertyGet($receiver,$name)'; + + @override + Expression? resolve() { + Expression? newReceiver = receiver.resolve(); + return newReceiver == null ? null : new PropertyGet(newReceiver, name); + } +} + +class NullAwarePropertyGet extends Expression { + final Expression receiver; + final String name; + + NullAwarePropertyGet(this.receiver, this.name); + + @override + String toString() => 'NullAwarePropertyGet($receiver,$name)'; + + @override + Expression? resolve() { + Expression? newReceiver = receiver.resolve(); + return newReceiver == null + ? null + : new NullAwarePropertyGet(newReceiver, name); + } +} + +class TypeLiteral extends Expression { + final TypeAnnotation typeAnnotation; + + TypeLiteral(this.typeAnnotation); + + @override + String toString() => 'TypeLiteral($typeAnnotation)'; + + @override + Expression? resolve() { + TypeAnnotation? newTypeAnnotation = typeAnnotation.resolve(); + return newTypeAnnotation == null + ? null + : new TypeLiteral(newTypeAnnotation); + } +} + +class ParenthesizedExpression extends Expression { + final Expression expression; + + ParenthesizedExpression(this.expression); + + @override + String toString() => 'ParenthesizedExpression($expression)'; + + @override + Expression? resolve() { + Expression? newExpression = expression.resolve(); + return newExpression == null + ? null + : new ParenthesizedExpression(newExpression); + } +} + +class ConditionalExpression extends Expression { + final Expression condition; + final Expression then; + final Expression otherwise; + + ConditionalExpression(this.condition, this.then, this.otherwise); + + @override + String toString() => 'ConditionalExpression($condition,$then,$otherwise)'; + + @override + Expression? resolve() { + Expression? newCondition = condition.resolve(); + Expression? newThen = then.resolve(); + Expression? newOtherwise = otherwise.resolve(); + return newCondition == null && newThen == null && newOtherwise == null + ? null + : new ConditionalExpression(newCondition ?? condition, newThen ?? then, + newOtherwise ?? otherwise); + } +} + +class ListLiteral extends Expression { + final List typeArguments; + final List elements; + + ListLiteral(this.typeArguments, this.elements); + + @override + String toString() => 'ListLiteral($typeArguments,$elements)'; + + @override + Expression? resolve() { + List? newTypeArguments = + typeArguments.resolve((t) => t.resolve()); + List? newElements = elements.resolve((e) => e.resolve()); + return newTypeArguments == null && newElements == null + ? null + : new ListLiteral( + newTypeArguments ?? typeArguments, newElements ?? elements); + } +} + +class SetOrMapLiteral extends Expression { + final List typeArguments; + final List elements; + + SetOrMapLiteral(this.typeArguments, this.elements); + + @override + String toString() => 'SetOrMapLiteral($typeArguments,$elements)'; + + @override + Expression? resolve() { + List? newTypeArguments = + typeArguments.resolve((t) => t.resolve()); + List? newElements = elements.resolve((e) => e.resolve()); + return newTypeArguments == null && newElements == null + ? null + : new SetOrMapLiteral( + newTypeArguments ?? typeArguments, newElements ?? elements); + } +} + +class RecordLiteral extends Expression { + final List fields; + + RecordLiteral(this.fields); + + @override + String toString() => 'RecordLiteral($fields)'; + + @override + Expression? resolve() { + List? newFields = fields.resolve((e) => e.resolve()); + return newFields == null ? null : new RecordLiteral(newFields); + } +} + +class IfNull extends Expression { + final Expression left; + final Expression right; + + IfNull(this.left, this.right); + + @override + String toString() => 'IfNull($left,$right)'; + + @override + Expression? resolve() { + Expression? newLeft = left.resolve(); + Expression? newRight = right.resolve(); + return newLeft == null && newRight == null + ? null + : new IfNull(newLeft ?? left, newRight ?? right); + } +} + +enum LogicalOperator { + and('&&'), + or('||'), + ; + + final String text; + + const LogicalOperator(this.text); +} + +class LogicalExpression extends Expression { + final Expression left; + final LogicalOperator operator; + final Expression right; + + LogicalExpression(this.left, this.operator, this.right); + + @override + String toString() => 'LogicalExpression($left,$operator,$right)'; + + @override + Expression? resolve() { + Expression? newLeft = left.resolve(); + Expression? newRight = right.resolve(); + return newLeft == null && newRight == null + ? null + : new LogicalExpression(newLeft ?? left, operator, newRight ?? right); + } +} + +class EqualityExpression extends Expression { + final Expression left; + final Expression right; + final bool isNotEquals; + + EqualityExpression(this.left, this.right, {required this.isNotEquals}); + + @override + String toString() => + 'EqualityExpression($left,$right,isNotEquals=$isNotEquals)'; + + @override + Expression? resolve() { + Expression? newLeft = left.resolve(); + Expression? newRight = right.resolve(); + return newLeft == null && newRight == null + ? null + : new EqualityExpression(newLeft ?? left, newRight ?? right, + isNotEquals: isNotEquals); + } +} + +enum BinaryOperator { + greaterThan('>'), + greaterThanOrEqual('>='), + lessThan('<'), + lessThanOrEqual('<='), + shiftLeft('<<'), + signedShiftRight('>>'), + unsignedShiftRight('>>>'), + plus('+'), + minus('-'), + times('*'), + divide('/'), + integerDivide('~/'), + modulo('%'), + bitwiseOr('|'), + bitwiseAnd('&'), + bitwiseXor('^'), + ; + + final String text; + + const BinaryOperator(this.text); +} + +class BinaryExpression extends Expression { + final Expression left; + final BinaryOperator operator; + final Expression right; + + BinaryExpression(this.left, this.operator, this.right); + + @override + String toString() => 'BinaryExpression($left,$operator,$right)'; + + @override + Expression? resolve() { + Expression? newLeft = left.resolve(); + Expression? newRight = right.resolve(); + return newLeft == null && newRight == null + ? null + : new BinaryExpression(newLeft ?? left, operator, newRight ?? right); + } +} + +enum UnaryOperator { + minus('-'), + bang('!'), + tilde('~'), + ; + + final String text; + + const UnaryOperator(this.text); +} + +class UnaryExpression extends Expression { + final UnaryOperator operator; + final Expression expression; + + UnaryExpression(this.operator, this.expression); + + @override + String toString() => 'UnaryExpression($operator,$expression)'; + + @override + Expression? resolve() { + Expression? newExpression = expression.resolve(); + return newExpression == null + ? null + : new UnaryExpression(operator, newExpression); + } +} + +class IsTest extends Expression { + final Expression expression; + final TypeAnnotation type; + final bool isNot; + + IsTest(this.expression, this.type, {required this.isNot}); + + @override + String toString() => 'IsTest($expression,$type,isNot=$isNot)'; + + @override + Expression? resolve() { + TypeAnnotation? newType = type.resolve(); + Expression? newExpression = expression.resolve(); + return newType == null && newExpression == null + ? null + : new IsTest(newExpression ?? expression, newType ?? type, + isNot: isNot); + } +} + +class AsExpression extends Expression { + final Expression expression; + final TypeAnnotation type; + + AsExpression(this.expression, this.type); + + @override + String toString() => 'AsExpression($expression,$type)'; + + @override + Expression? resolve() { + TypeAnnotation? newType = type.resolve(); + Expression? newExpression = expression.resolve(); + return newType == null && newExpression == null + ? null + : new AsExpression(newExpression ?? expression, newType ?? type); + } +} + +class NullCheck extends Expression { + final Expression expression; + + NullCheck(this.expression); + + @override + String toString() => 'NullCheck($expression)'; + + @override + Expression? resolve() { + Expression? newExpression = expression.resolve(); + return newExpression == null ? null : new NullCheck(newExpression); + } +} + +class UnresolvedExpression extends Expression { + final Unresolved unresolved; + + UnresolvedExpression(this.unresolved); + + @override + String toString() => 'UnresolvedExpression($unresolved)'; + + @override + Expression? resolve() { + return unresolved.resolveAsExpression(); + } +} diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/formal_parameters.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/formal_parameters.dart new file mode 100644 index 000000000000..196c3089a1f8 --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/formal_parameters.dart @@ -0,0 +1,61 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'expressions.dart'; +import 'proto.dart'; +import 'type_annotations.dart'; +import 'util.dart'; + +/// A formal parameter in a function type annotation. +// TODO(johnniwinther): Use this for function parameters if general expressions +// are supported. +class FormalParameter { + final List metadata; + final TypeAnnotation? typeAnnotation; + final String? name; + final Expression? defaultValue; + + /// `true` if this parameter occurred within `{` `}` brackets. + final bool isNamed; + + /// `true` if this parameter is required. + final bool isRequired; + + FormalParameter( + this.metadata, this.typeAnnotation, this.name, this.defaultValue, + {required this.isNamed, required this.isRequired}); + + /// Returns the [FormalParameter] corresponding to this [FormalParameter] in + /// which all [UnresolvedIdentifier]s have been resolved within their scope. + /// + /// If this didn't create a new [FormalParameter], `null` is returned. + FormalParameter? resolve() { + List? resolvedMetadata = metadata.resolve((e) => e.resolve()); + TypeAnnotation? resolvedTypeAnnotation = typeAnnotation?.resolve(); + Expression? resolvedDefaultValue = defaultValue?.resolve(); + return resolvedMetadata == null && + resolvedTypeAnnotation == null && + resolvedDefaultValue == null + ? null + : new FormalParameter( + resolvedMetadata ?? metadata, + resolvedTypeAnnotation ?? typeAnnotation, + name, + resolvedDefaultValue ?? defaultValue, + isNamed: isNamed, + isRequired: isRequired); + } + + @override + String toString() => + 'FormalParameter($metadata,$typeAnnotation,$name,$defaultValue,' + 'isNamed:$isNamed,isRequired:$isRequired)'; +} + +/// A list of parameters in `{`, `}`, or `[`, `]`. +class FormalParameterGroup { + final List formalParameters; + + FormalParameterGroup(this.formalParameters); +} diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/parser.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/parser.dart new file mode 100644 index 000000000000..bd0ba3919ef8 --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/parser.dart @@ -0,0 +1,1061 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:_fe_analyzer_shared/src/messages/codes.dart'; +import 'package:_fe_analyzer_shared/src/parser/parser.dart'; +import 'package:_fe_analyzer_shared/src/parser/quote.dart'; +import 'package:_fe_analyzer_shared/src/parser/stack_listener.dart'; +import 'package:_fe_analyzer_shared/src/scanner/token.dart'; +import 'package:_fe_analyzer_shared/src/util/null_value.dart'; +import 'package:_fe_analyzer_shared/src/util/value_kind.dart'; + +import 'arguments.dart'; +import 'elements.dart'; +import 'expressions.dart'; +import 'formal_parameters.dart'; +import 'proto.dart'; +import 'record_fields.dart'; +import 'references.dart'; +import 'scope.dart'; +import 'string_literal_parts.dart'; +import 'type_annotations.dart'; + +/// Parser listener that can create [Expression] node for metadata annotations +/// and constant expressions. +class AnnotationsListener extends StackListener { + @override + final bool isDartLibrary; + + @override + final Uri uri; + + final Scope _initialScope; + + final References _references; + + final bool delayLookup; + + AnnotationsListener(this.uri, this._initialScope, this._references, + {required this.delayLookup, required this.isDartLibrary}); + + final List _typeParameterScopes = []; + + Scope get _scope => + _typeParameterScopes.isEmpty ? _initialScope : _typeParameterScopes.last; + + @override + void beginMetadata(Token token) {} + + @override + void endMetadata(Token beginToken, Token? periodBeforeName, Token endToken) { + assert(checkState(beginToken, [ + /*arguments*/ _ValueKinds._ArgumentsOrNull, + /*suffix*/ if (periodBeforeName != null) _ValueKinds._IdentifierProto, + /*type arguments*/ _ValueKinds._TypeAnnotationsOrNull, + /*type*/ _ValueKinds._Proto, + ])); + List? arguments = pop(_NullValues.Arguments) as List?; + IdentifierProto? identifier = + periodBeforeName != null ? pop() as IdentifierProto : null; + List? typeArguments = + pop(_NullValues.TypeAnnotations) as List?; + Proto proto = pop() as Proto; + push(proto + .instantiate(typeArguments) + .apply(identifier) + .invoke(arguments) + .toExpression()); + } + + @override + void endMetadataStar(int count) { + assert(checkState(null, repeatedKind(_ValueKinds._Expression, count))); + List expressions = new List.filled(count, _dummyExpression); + while (--count >= 0) { + expressions[count] = pop() as Expression; + } + push(expressions); + } + + @override + void handleIdentifier(Token token, IdentifierContext context) { + switch (context) { + case IdentifierContext.metadataReference: + case IdentifierContext.typeReference: + case IdentifierContext.prefixedTypeReference: + case IdentifierContext.expression: + case IdentifierContext.constructorReference: + String name = token.lexeme; + if (delayLookup) { + push(new UnresolvedIdentifier(_scope, name)); + } else { + push(_scope.lookup(name)); + } + case IdentifierContext.typeVariableDeclaration: + String name = token.lexeme; + push(_typeParameterScopes.last.declareTypeParameter(name)); + case IdentifierContext.metadataContinuation: + case IdentifierContext.metadataContinuationAfterTypeArguments: + case IdentifierContext.typeReferenceContinuation: + case IdentifierContext.literalSymbol: + case IdentifierContext.expressionContinuation: + case IdentifierContext.constructorReferenceContinuation: + case IdentifierContext.constructorReferenceContinuationAfterTypeArguments: + case IdentifierContext.namedRecordFieldReference: + case IdentifierContext.namedArgumentReference: + case IdentifierContext.formalParameterDeclaration: + case IdentifierContext.recordFieldDeclaration: + push(new IdentifierProto(token.lexeme)); + default: + throw new UnsupportedError("Unsupported context $context"); + } + } + + @override + void endConstructorReference(Token start, Token? periodBeforeName, + Token endToken, ConstructorReferenceContext constructorReferenceContext) { + assert(checkState(start, [ + if (periodBeforeName != null) + /* constructor name */ _ValueKinds._IdentifierProto, + /* type arguments */ _ValueKinds._TypeAnnotationsOrNull, + /* (qualified) name before type arguments */ _ValueKinds._Proto, + ])); + IdentifierProto? constructorName = + periodBeforeName != null ? pop() as IdentifierProto : null; + List? typeArguments = + pop(_NullValues.TypeAnnotations) as List?; + Proto className = pop() as Proto; + push(className.instantiate(typeArguments).apply(constructorName)); + } + + @override + void endConstExpression(Token token) { + assert(checkState(token, [ + /* arguments */ _ValueKinds._Arguments, + /* constructor reference */ _ValueKinds._Proto, + ])); + List arguments = pop() as List; + Proto constructorReference = pop() as Proto; + push(constructorReference.invoke(arguments)); + } + + @override + void handleLiteralList( + int count, Token leftBracket, Token? constKeyword, Token rightBracket) { + assert(checkState(leftBracket, [ + ...repeatedKind(_ValueKinds._ElementOrProto, count), + _ValueKinds._TypeAnnotationsOrNull, + ])); + List elements = new List.filled(count, _dummyElement); + while (--count >= 0) { + elements[count] = _popElementOrProto(); + } + List? typeArguments = + pop(_NullValues.TypeAnnotations) as List?; + push(new ExpressionProto( + new ListLiteral(typeArguments ?? const [], elements))); + } + + Element _popElementOrProto() { + Object? element = pop(); + if (element is Element) { + return element; + } else { + return new ExpressionElement((element as Proto).toExpression(), + isNullAware: false); + } + } + + Expression _popExpression() { + return (pop() as Proto).toExpression(); + } + + Argument _popArgument() { + Object? argument = pop(); + if (argument is Argument) { + return argument; + } else { + return new PositionalArgument((argument as Proto).toExpression()); + } + } + + RecordField _popRecordField() { + Object? field = pop(); + if (field is RecordField) { + return field; + } else { + return new RecordPositionalField((field as Proto).toExpression()); + } + } + + @override + void handleLiteralSetOrMap( + int count, + Token leftBrace, + Token? constKeyword, + Token rightBrace, + bool hasSetEntry, + ) { + assert(checkState(leftBrace, [ + ...repeatedKind(_ValueKinds._ElementOrProto, count), + _ValueKinds._TypeAnnotationsOrNull, + ])); + List elements = new List.filled(count, _dummyElement); + while (--count >= 0) { + elements[count] = _popElementOrProto(); + } + List? typeArguments = + pop(_NullValues.TypeAnnotations) as List?; + push(new ExpressionProto( + new SetOrMapLiteral(typeArguments ?? const [], elements))); + } + + @override + void handleLiteralMapEntry(Token colon, Token endToken, + {Token? nullAwareKeyToken, Token? nullAwareValueToken}) { + assert(checkState(colon, [ + /* value */ _ValueKinds._Proto, + /* key */ _ValueKinds._Proto, + ])); + Expression value = _popExpression(); + Expression key = _popExpression(); + push(new MapEntryElement(key, value, + isNullAwareKey: nullAwareKeyToken != null, + isNullAwareValue: nullAwareValueToken != null)); + } + + @override + void handleSpreadExpression(Token spreadToken) { + assert(checkState(spreadToken, [ + /* expression */ _ValueKinds._Proto, + ])); + Proto expression = pop() as Proto; + push(new SpreadElement(expression.toExpression(), + isNullAware: spreadToken.lexeme == '...?')); + } + + @override + void handleNullAwareElement(Token nullAwareToken) { + assert(checkState(nullAwareToken, [ + /* expression */ _ValueKinds._Proto, + ])); + Proto expression = pop() as Proto; + push(new ExpressionElement(expression.toExpression(), isNullAware: true)); + } + + @override + void handleParenthesizedCondition(Token token, Token? case_, Token? when) { + if (case_ != null) { + throw new UnsupportedError( + "handleParenthesizedCondition($token,$case_,$when"); + } else { + assert(checkState(token, [_ValueKinds._Proto])); + } + } + + @override + void endIfControlFlow(Token token) { + assert(checkState(token, [ + /* then */ _ValueKinds._ElementOrProto, + /* condition */ _ValueKinds._Proto + ])); + Element then = _popElementOrProto(); + Expression condition = _popExpression(); + push(new IfElement(condition, then)); + } + + @override + void handleElseControlFlow(Token elseToken) { + assert(checkState(elseToken, [ + /* otherwise */ unionOfKinds([_ValueKinds._Element, _ValueKinds._Proto]), + ])); + } + + @override + void endIfElseControlFlow(Token token) { + assert(checkState(token, [ + /* otherwise */ unionOfKinds([_ValueKinds._Element, _ValueKinds._Proto]), + /* then */ unionOfKinds([_ValueKinds._Element, _ValueKinds._Proto]), + /* condition */ _ValueKinds._Proto + ])); + Element otherwise = _popElementOrProto(); + Element then = _popElementOrProto(); + Expression condition = _popExpression(); + push(new IfElement(condition, then, otherwise)); + } + + @override + void endConstLiteral(Token token) { + assert(checkState(token, [_ValueKinds._Proto])); + } + + @override + void handleNamedRecordField(Token colon) { + assert(checkState(colon, [ + /* expression */ _ValueKinds._Proto, + /* name */ _ValueKinds._IdentifierProto, + ])); + Expression expression = _popExpression(); + IdentifierProto name = pop() as IdentifierProto; + push(new RecordNamedField(name.text, expression)); + } + + @override + void endRecordLiteral(Token token, int count, Token? constKeyword) { + assert(checkState( + token, + /* fields */ repeatedKind(_ValueKinds._RecordFieldOrProto, count), + )); + List fields = new List.filled(count, _dummyRecordField); + while (--count >= 0) { + fields[count] = _popRecordField(); + } + push(new ExpressionProto(new RecordLiteral(fields))); + } + + @override + void handleEndingBinaryExpression(Token token, Token endToken) { + endBinaryExpression(token, endToken); + } + + @override + void endBinaryExpression(Token token, Token endToken) { + assert(checkState(token, [ + /* right */ _ValueKinds._Proto, + /* left */ _ValueKinds._Proto, + ])); + Proto right = pop() as Proto; + Proto left = pop() as Proto; + switch (token.lexeme) { + case '.': + IdentifierProto identifierProto = right as IdentifierProto; + push(left.apply(identifierProto)); + case '?.': + IdentifierProto identifierProto = right as IdentifierProto; + push(left.apply(identifierProto, isNullAware: true)); + case '??': + push(new ExpressionProto( + new IfNull(left.toExpression(), right.toExpression()))); + case '||': + push(new ExpressionProto(new LogicalExpression( + left.toExpression(), LogicalOperator.or, right.toExpression()))); + case '&&': + push(new ExpressionProto(new LogicalExpression( + left.toExpression(), LogicalOperator.and, right.toExpression()))); + case '==': + push(new ExpressionProto(new EqualityExpression( + left.toExpression(), right.toExpression(), + isNotEquals: false))); + case '!=': + push(new ExpressionProto(new EqualityExpression( + left.toExpression(), right.toExpression(), + isNotEquals: true))); + case '>': + push(new ExpressionProto(new BinaryExpression(left.toExpression(), + BinaryOperator.greaterThan, right.toExpression()))); + case '>=': + push(new ExpressionProto(new BinaryExpression(left.toExpression(), + BinaryOperator.greaterThanOrEqual, right.toExpression()))); + case '<': + push(new ExpressionProto(new BinaryExpression(left.toExpression(), + BinaryOperator.lessThan, right.toExpression()))); + case '<=': + push(new ExpressionProto(new BinaryExpression(left.toExpression(), + BinaryOperator.lessThanOrEqual, right.toExpression()))); + case '<<': + push(new ExpressionProto(new BinaryExpression(left.toExpression(), + BinaryOperator.shiftLeft, right.toExpression()))); + case '>>': + push(new ExpressionProto(new BinaryExpression(left.toExpression(), + BinaryOperator.signedShiftRight, right.toExpression()))); + case '>>>': + push(new ExpressionProto(new BinaryExpression(left.toExpression(), + BinaryOperator.unsignedShiftRight, right.toExpression()))); + case '+': + push(new ExpressionProto(new BinaryExpression( + left.toExpression(), BinaryOperator.plus, right.toExpression()))); + case '-': + push(new ExpressionProto(new BinaryExpression( + left.toExpression(), BinaryOperator.minus, right.toExpression()))); + case '*': + push(new ExpressionProto(new BinaryExpression( + left.toExpression(), BinaryOperator.times, right.toExpression()))); + case '/': + push(new ExpressionProto(new BinaryExpression( + left.toExpression(), BinaryOperator.divide, right.toExpression()))); + case '~/': + push(new ExpressionProto(new BinaryExpression(left.toExpression(), + BinaryOperator.integerDivide, right.toExpression()))); + case '%': + push(new ExpressionProto(new BinaryExpression( + left.toExpression(), BinaryOperator.modulo, right.toExpression()))); + case '|': + push(new ExpressionProto(new BinaryExpression(left.toExpression(), + BinaryOperator.bitwiseOr, right.toExpression()))); + case '&': + push(new ExpressionProto(new BinaryExpression(left.toExpression(), + BinaryOperator.bitwiseAnd, right.toExpression()))); + case '^': + push(new ExpressionProto(new BinaryExpression(left.toExpression(), + BinaryOperator.bitwiseXor, right.toExpression()))); + default: + throw new UnimplementedError("Binary operator '${token.lexeme}'."); + } + } + + @override + void handleIsOperator(Token isOperator, Token? not) { + assert(checkState(isOperator, [ + /* type */ _ValueKinds._TypeAnnotation, + /* expression */ _ValueKinds._Proto, + ])); + TypeAnnotation type = pop() as TypeAnnotation; + Expression expression = _popExpression(); + push(new ExpressionProto(new IsTest(expression, type, isNot: not != null))); + } + + @override + void handleAsOperator(Token operator) { + assert(checkState(operator, [ + /* type */ _ValueKinds._TypeAnnotation, + /* expression */ _ValueKinds._Proto, + ])); + TypeAnnotation type = pop() as TypeAnnotation; + Expression expression = _popExpression(); + push(new ExpressionProto(new AsExpression(expression, type))); + } + + @override + void endIsOperatorType(Token operator) { + // Do nothing. + } + + @override + void endAsOperatorType(Token operator) { + // Do nothing. + } + + @override + void handleUnaryPrefixExpression(Token token) { + assert(checkState(token, [ + /* expression */ _ValueKinds._Proto, + ])); + Expression expression = _popExpression(); + switch (token.lexeme) { + case '-': + push(new ExpressionProto( + new UnaryExpression(UnaryOperator.minus, expression))); + case '!': + push(new ExpressionProto( + new UnaryExpression(UnaryOperator.bang, expression))); + case '~': + push(new ExpressionProto( + new UnaryExpression(UnaryOperator.tilde, expression))); + default: + throw new UnimplementedError("Unary operator '${token.lexeme}'."); + } + } + + @override + void handleNonNullAssertExpression(Token bang) { + assert(checkState(bang, [ + /* expression */ _ValueKinds._Proto, + ])); + Expression expression = _popExpression(); + push(new ExpressionProto(new NullCheck(expression))); + } + + @override + void handleQualified(Token period) { + assert(checkState(period, [ + /* suffix */ _ValueKinds._IdentifierProto, + /* prefix */ _ValueKinds._Proto, + ])); + IdentifierProto suffix = pop() as IdentifierProto; + Proto prefix = pop() as Proto; + push(prefix.apply(suffix)); + } + + @override + void handleSend(Token beginToken, Token endToken) { + assert(checkState(beginToken, [ + _ValueKinds._ArgumentsOrNull, + _ValueKinds._TypeAnnotationsOrNull, + _ValueKinds._Proto, + ])); + List? arguments = pop(_NullValues.Arguments) as List?; + List? typeArguments = + pop(_NullValues.TypeAnnotations) as List?; + Proto proto = pop() as Proto; + assert(typeArguments == null || arguments != null, + 'Unexpected type argument application as send.'); + push(proto.instantiate(typeArguments).invoke(arguments)); + } + + @override + void handleNoArguments(Token token) { + push(_NullValues.Arguments); + } + + @override + void handleNamedArgument(Token colon) { + assert(checkState(colon, [ + /* expression */ _ValueKinds._Proto, + /* name */ _ValueKinds._IdentifierProto, + ])); + Expression expression = _popExpression(); + IdentifierProto name = pop() as IdentifierProto; + push(new NamedArgument(name.text, expression)); + } + + @override + void endArguments(int count, Token beginToken, Token endToken) { + assert(checkState( + beginToken, + /* arguments */ repeatedKind(_ValueKinds._ArgumentOrProto, count), + )); + List arguments = new List.filled(count, _dummyArgument); + while (--count >= 0) { + arguments[count] = _popArgument(); + } + push(arguments); + } + + @override + void handleNoTypeArguments(Token token) { + push(_NullValues.TypeAnnotations); + } + + @override + void endTypeArguments(int count, Token beginToken, Token endToken) { + assert(checkState( + beginToken, + /* type arguments */ repeatedKind(_ValueKinds._TypeAnnotation, count), + )); + List typeArguments = + new List.filled(count, _dummyTypeAnnotation); + while (--count >= 0) { + typeArguments[count] = pop() as TypeAnnotation; + } + push(typeArguments); + } + + @override + void handleType(Token beginToken, Token? questionMark) { + assert(checkState(beginToken, [ + _ValueKinds._TypeAnnotationsOrNull, + _ValueKinds._Proto, + ])); + List? typeArguments = + pop(_NullValues.TypeAnnotations) as List?; + Proto type = pop() as Proto; + TypeAnnotation typeAnnotation = + type.instantiate(typeArguments).toTypeAnnotation(); + if (questionMark != null) { + typeAnnotation = new NullableTypeAnnotation(typeAnnotation); + } + push(typeAnnotation); + } + + @override + void handleVoidKeywordWithTypeArguments(Token token) { + assert(checkState(token, [ + _ValueKinds._TypeAnnotationsOrNull, + ])); + List? typeArguments = + pop(_NullValues.TypeAnnotations) as List?; + push(new VoidProto(_references.voidReference) + .instantiate(typeArguments) + .toTypeAnnotation()); + } + + @override + void handleVoidKeyword(Token token) { + push(new VoidProto(_references.voidReference).toTypeAnnotation()); + } + + @override + void handleLiteralInt(Token token) { + push(new ExpressionProto(new IntegerLiteral(token.lexeme))); + } + + @override + void handleLiteralDouble(Token token) { + push(new ExpressionProto(new DoubleLiteral(token.lexeme))); + } + + @override + void handleLiteralBool(Token token) { + push(new ExpressionProto(new BooleanLiteral(token.lexeme))); + } + + @override + void handleLiteralNull(Token token) { + push(new ExpressionProto(new NullLiteral())); + } + + @override + void beginLiteralString(Token token) { + push(new StringPart(token.lexeme)); + } + + @override + void handleStringPart(Token token) { + push(new StringPart(token.lexeme)); + } + + @override + void endLiteralString(int interpolationCount, Token endToken) { + int count = 1 + interpolationCount * 2; + assert(checkState( + endToken, + repeatedKind( + unionOfKinds([_ValueKinds._StringPart, _ValueKinds._Proto]), + count))); + if (interpolationCount == 0) { + // TODO(johnniwinther): Use the token corresponding to [part]. + Token token = endToken; + StringPart part = pop() as StringPart; + String value = unescapeString(part.text, token, this); + push(new ExpressionProto(new StringLiteral([new StringPart(value)]))); + } else { + List objects = new List.filled(count, /* dummyValue */ null); + int index = count; + while (--index >= 0) { + objects[index] = pop(); + } + StringPart first = objects.first as StringPart; + StringPart last = objects.last as StringPart; + Quote quote = analyzeQuote(first.text); + List parts = []; + // Contains more than just \' or \". + if (first.text.length > 1) { + // TODO(johnniwinther): Use the token corresponding to [first]. + Token token = endToken; + String value = unescapeFirstStringPart(first.text, quote, token, this); + if (value.isNotEmpty) { + parts.add(new StringPart(value)); + } + } + for (int i = 1; i < objects.length - 1; i++) { + Object? object = objects[i]; + if (object is StringPart) { + if (object.text.length != 0) { + // TODO(johnniwinther): Use the token corresponding to [object]. + Token token = endToken; + String value = unescape(object.text, quote, token, this); + parts.add(new StringPart(value)); + } + } else { + parts.add(new InterpolationPart((object as Proto).toExpression())); + } + } + // Contains more than just \' or \". + if (last.text.length > 1) { + // TODO(johnniwinther): Use the token corresponding to [last]. + Token token = endToken; + String value = unescapeLastStringPart( + last.text, quote, token, token.isSynthetic, this); + if (value.isNotEmpty) { + parts.add(new StringPart(value)); + } + } + push(new ExpressionProto(new StringLiteral(parts))); + } + } + + @override + void handleStringJuxtaposition(Token startToken, int literalCount) { + assert( + checkState(startToken, repeatedKind(_ValueKinds._Proto, literalCount))); + List expressions = + new List.filled(literalCount, _dummyExpression); + while (--literalCount >= 0) { + expressions[literalCount] = _popExpression(); + } + push(new ExpressionProto(new StringJuxtaposition(expressions))); + } + + @override + void endLiteralSymbol(Token hashToken, int identifierCount) { + assert(checkState( + hashToken, + repeatedKind(_ValueKinds._IdentifierProto, identifierCount), + )); + List parts = new List.filled(identifierCount, /* dummy value */ ''); + while (--identifierCount >= 0) { + parts[identifierCount] = (pop() as IdentifierProto).text; + } + push(new ExpressionProto(new SymbolLiteral(parts))); + } + + @override + void handleTypeArgumentApplication(Token openAngleBracket) { + assert(checkState(openAngleBracket, [ + _ValueKinds._TypeAnnotations, + _ValueKinds._Proto, + ])); + List typeArguments = pop() as List; + Proto receiver = pop() as Proto; + push(receiver.instantiate(typeArguments)); + } + + @override + void endParenthesizedExpression(Token token) { + assert(checkState(token, [ + _ValueKinds._Proto, + ])); + Expression expression = _popExpression(); + push(new ExpressionProto(new ParenthesizedExpression(expression))); + } + + @override + void endConditionalExpression(Token question, Token colon, Token endToken) { + assert(checkState(question, [ + /* otherwise */ _ValueKinds._Proto, + /* then */ _ValueKinds._Proto, + /* condition */ _ValueKinds._Proto, + ])); + Expression otherwise = _popExpression(); + Expression then = _popExpression(); + Expression condition = _popExpression(); + push(new ExpressionProto( + new ConditionalExpression(condition, then, otherwise))); + } + + @override + void handleValuedFormalParameter( + Token equals, Token token, FormalParameterKind kind) { + assert(checkState(token, [ + _ValueKinds._Proto, + ])); + push(_popExpression()); + } + + @override + void handleFormalParameterWithoutValue(Token token) { + push(_NullValues.Expression); + } + + @override + void endFormalParameter( + Token? thisKeyword, + Token? superKeyword, + Token? periodAfterThisOrSuper, + Token nameToken, + Token? initializerStart, + Token? initializerEnd, + FormalParameterKind kind, + MemberKind memberKind) { + assert(checkState(nameToken, [ + _ValueKinds._ExpressionOrNull, + _ValueKinds._IdentifierProtoOrNull, + _ValueKinds._TypeAnnotationOrNull, + _ValueKinds._Expressions, + ])); + Expression? defaultValue = pop() as Expression?; + IdentifierProto? name = pop() as IdentifierProto?; + TypeAnnotation? typeAnnotation = pop() as TypeAnnotation?; + List metadata = pop() as List; + push(new FormalParameter(metadata, typeAnnotation, name?.text, defaultValue, + isNamed: kind.isNamed, isRequired: kind.isRequired)); + } + + @override + void handleNoName(Token token) { + push(_NullValues.Identifier); + } + + @override + void endOptionalFormalParameters( + int count, Token beginToken, Token endToken, MemberKind kind) { + assert(checkState( + beginToken, repeatedKind(_ValueKinds._FormalParameter, count))); + List formalParameters = + new List.filled(count, _dummyFormalParameter); + while (--count >= 0) { + formalParameters[count] = pop() as FormalParameter; + } + push(new FormalParameterGroup(formalParameters)); + } + + @override + void endFormalParameters( + int count, Token beginToken, Token endToken, MemberKind kind) { + assert(checkState( + beginToken, + repeatedKind( + unionOfKinds([ + _ValueKinds._FormalParameter, + _ValueKinds._FormalParameterGroup + ]), + count))); + List objects = new List.filled(count, /* dummy value */ null); + while (--count >= 0) { + objects[count] = pop(); + } + List formalParameters = []; + for (Object? object in objects) { + if (object is FormalParameter) { + formalParameters.add(object); + } else { + formalParameters + .addAll((object as FormalParameterGroup).formalParameters); + } + } + push(formalParameters); + } + + @override + void endTypeVariable( + Token token, int index, Token? extendsOrSuper, Token? variance) { + assert(checkState(token, [ + _ValueKinds._TypeAnnotationOrNull, + _ValueKinds._FunctionTypeParameters, + ])); + TypeAnnotation? bound = pop(_NullValues.TypeAnnotation) as TypeAnnotation?; + List functionTypeParameters = + pop() as List; + FunctionTypeParameter functionTypeParameter = functionTypeParameters[index]; + functionTypeParameter.bound = bound; + push(functionTypeParameters); + } + + @override + void handleTypeVariablesDefined(Token token, int count) { + assert(checkState( + token, + repeatedKinds([ + _ValueKinds._FunctionTypeParameter, + _ValueKinds._Expressions, + ], count))); + List functionTypeParameters = + new List.filled(count, _dummyFunctionTypeParameter); + while (--count >= 0) { + FunctionTypeParameter functionTypeParameter = + functionTypeParameters[count] = pop() as FunctionTypeParameter; + functionTypeParameter.metadata = pop() as List; + } + push(functionTypeParameters); + } + + @override + void endTypeVariables(Token beginToken, Token endToken) { + assert(checkState(beginToken, [ + _ValueKinds._FunctionTypeParameters, + ])); + } + + @override + void beginFunctionType(Token beginToken) { + _typeParameterScopes.add(new FunctionTypeParameterScope(_scope)); + } + + @override + void endFunctionType(Token functionToken, Token? questionMark) { + assert(checkState(functionToken, [ + _ValueKinds._FormalParameters, + _ValueKinds._TypeAnnotationOrNull, + _ValueKinds._FunctionTypeParametersOrNull, + ])); + _typeParameterScopes.removeLast(); + + List formalParameters = pop() as List; + TypeAnnotation? returnType = + pop(_NullValues.TypeAnnotation) as TypeAnnotation?; + List? typeParameters = + pop(_NullValues.FunctionTypeParameters) as List?; + push(new FunctionTypeAnnotation( + returnType, typeParameters ?? const [], formalParameters)); + } + + @override + void endRecordType( + Token leftBracket, Token? questionMark, int count, bool hasNamedFields) { + assert(checkState( + leftBracket, + hasNamedFields + ? [ + _ValueKinds._RecordTypeEntries, + ...repeatedKind(_ValueKinds._RecordTypeEntry, count - 1) + ] + : repeatedKind(_ValueKinds._RecordTypeEntry, count), + )); + List? named; + if (hasNamedFields) { + named = pop() as List; + count--; + } + List positional = + new List.filled(count, _dummyRecordTypeEntry); + while (--count >= 0) { + positional[count] = pop() as RecordTypeEntry; + } + push(new RecordTypeAnnotation(positional, named ?? const [])); + } + + @override + void endRecordTypeEntry() { + assert(checkState(null, [ + _ValueKinds._IdentifierProtoOrNull, + _ValueKinds._TypeAnnotation, + _ValueKinds._Expressions, + ])); + IdentifierProto? name = pop() as IdentifierProto?; + TypeAnnotation type = pop() as TypeAnnotation; + List metadata = pop() as List; + push(new RecordTypeEntry(metadata, type, name?.text)); + } + + @override + void endRecordTypeNamedFields(int count, Token leftBracket) { + assert(checkState( + leftBracket, + repeatedKind(_ValueKinds._RecordTypeEntry, count), + )); + List entries = + new List.filled(count, _dummyRecordTypeEntry); + while (--count >= 0) { + entries[count] = pop() as RecordTypeEntry; + } + push(entries); + } + + @override + void handleNoType(Token lastConsumed) { + push(_NullValues.TypeAnnotation); + } + + @override + void handleNoTypeVariables(Token token) { + push(_NullValues.FunctionTypeParameters); + } + + @override + void addProblem(Message message, int charOffset, int length, + {bool wasHandled = false, List context = const []}) { + // Don't report errors. + } + + @override + Never internalProblem(Message message, int charOffset, Uri uri) { + throw new UnimplementedError(message.problemMessage); + } +} + +enum _NullValues implements NullValue { + Arguments, + Expression, + FunctionTypeParameters, + Identifier, + TypeAnnotation, + TypeAnnotations, +} + +final Argument _dummyArgument = new PositionalArgument(new IntegerLiteral('0')); + +final RecordField _dummyRecordField = + new RecordPositionalField(_dummyExpression); + +final TypeAnnotation _dummyTypeAnnotation = new InvalidTypeAnnotation(); + +final Expression _dummyExpression = new NullLiteral(); + +final Element _dummyElement = + new ExpressionElement(_dummyExpression, isNullAware: false); + +final FormalParameter _dummyFormalParameter = new FormalParameter( + const [], null, null, null, + isNamed: false, isRequired: false); + +final FunctionTypeParameter _dummyFunctionTypeParameter = + new FunctionTypeParameter(''); + +final RecordTypeEntry _dummyRecordTypeEntry = + new RecordTypeEntry(const [], _dummyTypeAnnotation, null); + +class _ValueKinds { + static const ValueKind _Proto = const SingleValueKind(); + static const ValueKind _IdentifierProto = + const SingleValueKind(); + static const ValueKind _IdentifierProtoOrNull = + const SingleValueKind(_NullValues.Identifier); + static const ValueKind _Expression = const SingleValueKind(); + static const ValueKind _ExpressionOrNull = + const SingleValueKind(_NullValues.Expression); + static const ValueKind _Expressions = + const SingleValueKind>(); + static const ValueKind _Element = const SingleValueKind(); + static final ValueKind _ElementOrProto = + unionOfKinds([_ValueKinds._Element, _ValueKinds._Proto]); + static const ValueKind _Argument = const SingleValueKind(); + static final ValueKind _ArgumentOrProto = + unionOfKinds([_ValueKinds._Argument, _ValueKinds._Proto]); + static const ValueKind _RecordField = const SingleValueKind(); + static final ValueKind _RecordFieldOrProto = + unionOfKinds([_ValueKinds._RecordField, _ValueKinds._Proto]); + static final ValueKind _RecordTypeEntry = + const SingleValueKind(); + static final ValueKind _RecordTypeEntries = + const SingleValueKind>(); + static const ValueKind _Arguments = const SingleValueKind>(); + static const ValueKind _ArgumentsOrNull = + const SingleValueKind>(_NullValues.Arguments); + static const ValueKind _TypeAnnotation = + const SingleValueKind(); + static const ValueKind _TypeAnnotationOrNull = + const SingleValueKind(_NullValues.TypeAnnotation); + static const ValueKind _TypeAnnotations = + const SingleValueKind>(); + static const ValueKind _TypeAnnotationsOrNull = + const SingleValueKind>(_NullValues.TypeAnnotations); + static const ValueKind _StringPart = const SingleValueKind(); + static const ValueKind _FormalParameter = + const SingleValueKind(); + static const ValueKind _FormalParameters = + const SingleValueKind>(); + static const ValueKind _FormalParameterGroup = + const SingleValueKind(); + static const ValueKind _FunctionTypeParameter = + const SingleValueKind(); + static const ValueKind _FunctionTypeParameters = + const SingleValueKind>(); + static const ValueKind _FunctionTypeParametersOrNull = + const SingleValueKind>( + _NullValues.FunctionTypeParameters); +} + +/// Parses the metadata annotation beginning at [atToken]. +Expression parseAnnotation( + Token atToken, Uri fileUri, Scope scope, References references, + {required bool isDartLibrary, bool delayLookupForTesting = false}) { + AnnotationsListener listener = new AnnotationsListener( + fileUri, scope, references, + delayLookup: delayLookupForTesting, isDartLibrary: isDartLibrary); + Parser parser = new Parser(listener, useImplicitCreationExpression: false); + parser.parseMetadata(parser.syntheticPreviousToken(atToken)); + return listener.pop() as Expression; +} + +/// A [Scope] extended to include function type parameters. +class FunctionTypeParameterScope implements Scope { + final Scope parentScope; + final Map functionTypeParameterMap = {}; + + FunctionTypeParameterScope(this.parentScope); + + FunctionTypeParameter declareTypeParameter(String name) { + return functionTypeParameterMap[name] = new FunctionTypeParameter(name); + } + + @override + Proto lookup(String name) { + FunctionTypeParameter? functionTypeParameter = + functionTypeParameterMap[name]; + if (functionTypeParameter != null) { + return new FunctionTypeParameterProto(functionTypeParameter); + } + return parentScope.lookup(name); + } +} diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/proto.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/proto.dart new file mode 100644 index 000000000000..253a79cccd4d --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/proto.dart @@ -0,0 +1,1314 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'arguments.dart'; +import 'expressions.dart'; +import 'references.dart'; +import 'scope.dart'; +import 'type_annotations.dart'; +import 'util.dart'; + +/// A [Proto] represents a parsed substructure before it can be determined +/// whether is is an expression, a type annotation, or something else. +/// +/// For instance when parsing `Foo` we cannot determine what it means before +/// we have parsed what comes after `Foo`. If it is followed by `.bar` it could +/// be the class name prefix of a static field access `Foo.bar` and if it is +/// followed by `,` then it could be a type literal `Foo` as an expression. +sealed class Proto { + /// Creates the [Proto] corresponding to this [Proto] followed by [send]. + /// + /// If [send] is `null`, this corresponds to this [Proto] on its own. + /// Otherwise this corresponds to this [Proto] followed by `.` or `?.`, an + /// identifier, and optionally type arguments and/or arguments. + Proto apply(IdentifierProto? send, {bool isNullAware = false}) { + if (send == null) { + return this; + } else if (isNullAware) { + return new InstanceAccessProto(this, send.text, isNullAware: true) + .instantiate(send.typeArguments) + .invoke(send.arguments); + } else { + return access(send.text) + .instantiate(send.typeArguments) + .invoke(send.arguments); + } + } + + /// Returns the [Proto] corresponding to accessing the property [name]. + /// + /// If [name] is `null`, the [Proto] itself is returned. This functionality + /// is supported for ease of use. + Proto access(String? name); + + /// Returns the [Proto] corresponding applying [typeArguments] to it. + /// + /// If [typeArguments] is `null`, the [Proto] itself is returned. This + /// functionality is supported for ease of use. + Proto instantiate(List? typeArguments); + + /// Returns the [Proto] corresponding invoke it with [arguments]. + /// + /// If [arguments] is `null`, the [Proto] itself is returned. This + /// functionality is supported for ease of use. + Proto invoke(List? arguments); + + /// Creates the [Expression] corresponding to this [Proto]. + /// + /// This corresponding to this [Proto] occurring in an expression context + /// on its own. + Expression toExpression(); + + /// Creates the [TypeAnnotation] corresponding to this [Proto]. + /// + /// This corresponding to this [Proto] occurring in a type annotation context + /// on its own. + TypeAnnotation toTypeAnnotation(); + + /// Returns the [Proto] corresponding to this [Proto] in which all + /// [UnresolvedIdentifier]s have been resolved within their scope. + /// + /// If this didn't create a new [Proto], `null` is returned. + Proto? resolve(); +} + +/// An unresolved part of a proto, expression or type annotation. +sealed class Unresolved { + /// Returns this unresolved part as an [Expression] if it can be resolved. + Expression? resolveAsExpression(); + + /// Returns this unresolved part as a [TypeAnnotation] if it can be resolved. + TypeAnnotation? resolveAsTypeAnnotation(); +} + +/// The unresolved identifier [name] occurring in [scope]. +class UnresolvedIdentifier extends Proto implements Unresolved { + final Scope scope; + final String name; + + UnresolvedIdentifier(this.scope, this.name); + + @override + Proto access(String? name) { + if (name == null) { + return this; + } + return new UnresolvedAccess(this, name); + } + + @override + Proto instantiate(List? typeArguments) { + if (typeArguments == null) { + return this; + } + return new UnresolvedInstantiate(this, typeArguments); + } + + @override + Proto invoke(List? arguments) { + if (arguments == null) { + return this; + } + return new UnresolvedInvoke(this, arguments); + } + + @override + Expression toExpression() { + return new UnresolvedExpression(this); + } + + @override + TypeAnnotation toTypeAnnotation() { + return new UnresolvedTypeAnnotation(this); + } + + @override + String toString() => 'UnresolvedIdentifier($name)'; + + @override + Expression? resolveAsExpression() { + Proto? resolved = resolve(); + return resolved == null ? null : resolved.toExpression(); + } + + @override + TypeAnnotation? resolveAsTypeAnnotation() { + Proto? resolved = resolve(); + return resolved == null ? null : resolved.toTypeAnnotation(); + } + + @override + bool operator ==(Object other) => + identical(this, other) || + other is UnresolvedIdentifier && + runtimeType == other.runtimeType && + name == other.name; + + @override + int get hashCode => name.hashCode; + + @override + Proto? resolve() { + Proto resolved = scope.lookup(name); + return this == resolved ? null : resolved; + } +} + +/// The unresolved access to [name] on [prefix]. +class UnresolvedAccess extends Proto implements Unresolved { + final Proto prefix; + final String name; + + UnresolvedAccess(this.prefix, this.name); + + @override + Proto access(String? name) { + if (name == null) { + return this; + } + return new UnresolvedAccess(this, name); + } + + @override + Proto instantiate(List? typeArguments) { + if (typeArguments == null) { + return this; + } + return new UnresolvedInstantiate(this, typeArguments); + } + + @override + Proto invoke(List? arguments) { + if (arguments == null) { + return this; + } + return new UnresolvedInvoke(this, arguments); + } + + @override + Expression toExpression() { + return new UnresolvedExpression(this); + } + + @override + TypeAnnotation toTypeAnnotation() { + return new UnresolvedTypeAnnotation(this); + } + + @override + String toString() => 'UnresolvedAccess($prefix,$name)'; + + @override + Expression? resolveAsExpression() { + Proto? resolved = resolve(); + return resolved == null ? null : resolved.toExpression(); + } + + @override + TypeAnnotation? resolveAsTypeAnnotation() { + Proto? resolved = resolve(); + return resolved == null ? null : resolved.toTypeAnnotation(); + } + + @override + Proto? resolve() { + Proto? newPrefix = prefix.resolve(); + return newPrefix == null ? null : newPrefix.access(name); + } +} + +/// The application of [typeArguments] on [prefix]. +/// +/// The [prefix] is (partially) unresolved, so it cannot yet determined what +/// the application of [typeArguments] means. For instance `unresolved` +/// could be instantiation of the generic class `unresolved` or the +/// instantiation of the generic method `unresolved`. +class UnresolvedInstantiate extends Proto implements Unresolved { + final Proto prefix; + final List typeArguments; + + UnresolvedInstantiate(this.prefix, this.typeArguments); + + @override + Proto access(String? name) { + if (name == null) { + return this; + } + return new UnresolvedAccess(this, name); + } + + @override + Proto instantiate(List? typeArguments) { + if (typeArguments == null) { + return this; + } + return new UnresolvedInstantiate(this, typeArguments); + } + + @override + Proto invoke(List? arguments) { + if (arguments == null) { + return this; + } + return new UnresolvedInvoke(this, arguments); + } + + @override + Expression toExpression() { + return new UnresolvedExpression(this); + } + + @override + TypeAnnotation toTypeAnnotation() { + return new UnresolvedTypeAnnotation(this); + } + + @override + String toString() => 'UnresolvedInstantiate($prefix,$typeArguments)'; + + @override + Expression? resolveAsExpression() { + Proto? resolved = resolve(); + return resolved == null ? null : resolved.toExpression(); + } + + @override + TypeAnnotation? resolveAsTypeAnnotation() { + Proto? resolved = resolve(); + return resolved == null ? null : resolved.toTypeAnnotation(); + } + + @override + Proto? resolve() { + Proto? newPrefix = prefix.resolve(); + List? newTypeArguments = + typeArguments.resolve((t) => t.resolve()); + + return newPrefix == null && newTypeArguments == null + ? null + : (newPrefix ?? prefix).instantiate(newTypeArguments ?? typeArguments); + } +} + +/// The invocation of [arguments] on [prefix]. +/// +/// The [prefix] is (partially) unresolved, so it cannot yet determined what +/// the invocation of [arguments] means. For instance `unresolved(0)` +/// could be the constructor invocation of the unnamed constructor of the class +/// `unresolved` or the invocation of the method `unresolved`. +class UnresolvedInvoke extends Proto implements Unresolved { + final Proto prefix; + final List arguments; + + UnresolvedInvoke(this.prefix, this.arguments); + + @override + Proto access(String? name) { + if (name == null) { + return this; + } + return new UnresolvedAccess(this, name); + } + + @override + Proto instantiate(List? typeArguments) { + if (typeArguments == null) { + return this; + } + return new UnresolvedInstantiate(this, typeArguments); + } + + @override + Proto invoke(List? arguments) { + if (arguments == null) { + return this; + } + return new UnresolvedInvoke(this, arguments); + } + + @override + Expression toExpression() { + return new UnresolvedExpression(this); + } + + @override + TypeAnnotation toTypeAnnotation() { + return new UnresolvedTypeAnnotation(this); + } + + @override + String toString() => 'UnresolvedInvoke($prefix,$arguments)'; + + @override + Expression? resolveAsExpression() { + Proto? resolved = resolve(); + return resolved == null ? null : resolved.toExpression(); + } + + @override + TypeAnnotation? resolveAsTypeAnnotation() { + Proto? resolved = resolve(); + return resolved == null ? null : resolved.toTypeAnnotation(); + } + + @override + Proto? resolve() { + Proto? newPrefix = prefix.resolve(); + List? newArguments = arguments.resolve((a) => a.resolve()); + return newPrefix == null && newArguments == null + ? null + : (newPrefix ?? prefix).invoke(newArguments ?? arguments); + } +} + +/// A [reference] to a class. +/// +/// The [Proto] includes the [scope] of the class, which is used to resolve +/// access to constructors and static members on the class. +class ClassProto extends Proto { + final ClassReference reference; + final TypeDeclarationScope scope; + + ClassProto(this.reference, this.scope); + + @override + String toString() => 'ClassProto($reference)'; + + @override + Proto access(String? name) { + if (name == null) { + return this; + } + if (name == 'new') { + name = ''; + } + return scope.lookup(name); + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments != null + ? new GenericClassProto(reference, scope, typeArguments) + : this; + } + + @override + Proto invoke(List? arguments) { + return arguments != null ? access('new').invoke(arguments) : this; + } + + @override + Expression toExpression() { + return new TypeLiteral(toTypeAnnotation()); + } + + @override + TypeAnnotation toTypeAnnotation() => new NamedTypeAnnotation(reference); + + @override + Proto? resolve() => null; +} + +/// A [reference] to an extension +/// +/// The [Proto] includes the [scope] of the extension, which is used to resolve +/// access to static members on the extension. +class ExtensionProto extends Proto { + final ExtensionReference reference; + final TypeDeclarationScope scope; + + ExtensionProto(this.reference, this.scope); + + @override + String toString() => 'ExtensionProto($reference)'; + + @override + Proto access(String? name) { + if (name == null) { + return this; + } + if (name == 'new') { + name = ''; + } + return scope.lookup(name); + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments != null + ? new InvalidInstantiationProto(this, typeArguments) + : this; + } + + @override + Proto invoke(List? arguments) { + return arguments != null + ? new InvalidInvocationProto(this, const [], arguments) + : this; + } + + @override + Expression toExpression() { + return new InvalidExpression(); + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + Proto? resolve() => null; +} + +/// A [reference] to a class instantiated with [typeArguments]. +/// +/// The [Proto] includes the [scope] of the class, which is used to resolve +/// access to constructors on the class. +class GenericClassProto extends Proto { + final ClassReference reference; + final TypeDeclarationScope scope; + final List typeArguments; + + GenericClassProto(this.reference, this.scope, this.typeArguments); + + @override + String toString() => 'GenericClassProto($reference,$typeArguments)'; + + @override + Proto access(String? name) { + if (name == null) { + return this; + } + if (name == 'new') { + name = ''; + } + return scope.lookup(name, typeArguments); + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments != null + ? throw new UnimplementedError('GenericClassProto.instantiate') + : this; + } + + @override + Proto invoke(List? arguments) { + return arguments != null ? access('new').invoke(arguments) : this; + } + + @override + Expression toExpression() { + return new TypeLiteral(toTypeAnnotation()); + } + + @override + TypeAnnotation toTypeAnnotation() => + new NamedTypeAnnotation(reference, typeArguments); + + @override + Proto? resolve() { + List? newTypeArguments = + typeArguments.resolve((a) => a.resolve()); + return newTypeArguments == null + ? null + : new GenericClassProto(reference, scope, newTypeArguments); + } +} + +/// A [reference] to a typedef. +/// +/// The [Proto] includes the [scope] of the typedef, which is used to resolve +/// access to constructors through the typedef. +class TypedefProto extends Proto { + final TypedefReference reference; + final TypeDeclarationScope scope; + + TypedefProto(this.reference, this.scope); + + @override + String toString() => 'TypedefProto($reference)'; + + @override + Proto access(String? name) { + if (name == null) { + return this; + } + if (name == 'new') { + name = ''; + } + return scope.lookup(name); + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments != null + ? new GenericTypedefProto(reference, scope, typeArguments) + : this; + } + + @override + Proto invoke(List? arguments) { + return arguments != null ? access('new').invoke(arguments) : this; + } + + @override + Expression toExpression() { + return new TypeLiteral(toTypeAnnotation()); + } + + @override + TypeAnnotation toTypeAnnotation() => new NamedTypeAnnotation(reference); + + @override + Proto? resolve() => null; +} + +/// A [reference] to a typedef instantiated with [typeArguments]. +/// +/// The [Proto] includes the [scope] of the typedef, which is used to resolve +/// access to constructors through the typedef. +class GenericTypedefProto extends Proto { + final TypedefReference reference; + final TypeDeclarationScope scope; + final List typeArguments; + + GenericTypedefProto(this.reference, this.scope, this.typeArguments); + + @override + String toString() => 'GenericTypedefProto($reference,$typeArguments)'; + + @override + Proto access(String? name) { + if (name == null) { + return this; + } + if (name == 'new') { + name = ''; + } + return scope.lookup(name, typeArguments); + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments != null + ? throw new UnimplementedError('GenericTypedefProto.instantiate') + : this; + } + + @override + Proto invoke(List? arguments) { + return arguments != null ? access('new').invoke(arguments) : this; + } + + @override + Expression toExpression() { + return new TypeLiteral(toTypeAnnotation()); + } + + @override + TypeAnnotation toTypeAnnotation() => + new NamedTypeAnnotation(reference, typeArguments); + + @override + Proto? resolve() { + List? newTypeArguments = + typeArguments.resolve((a) => a.resolve()); + return newTypeArguments == null + ? null + : new GenericTypedefProto(reference, scope, newTypeArguments); + } +} + +/// A [reference] to a `void`. +class VoidProto extends Proto { + final Reference reference; + + VoidProto(this.reference); + + @override + Expression toExpression() { + return new TypeLiteral(toTypeAnnotation()); + } + + @override + TypeAnnotation toTypeAnnotation() => new VoidTypeAnnotation(reference); + + @override + Proto access(String? name) { + return name == null ? this : new InvalidAccessProto(this, name); + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments == null + ? this + : new InvalidInstantiationProto(this, typeArguments); + } + + @override + Proto invoke(List? arguments) { + return arguments == null + ? this + : new InvalidInvocationProto(this, const [], arguments); + } + + @override + String toString() => 'VoidProto()'; + + @override + Proto? resolve() => null; +} + +/// A [reference] to a `dynamic`. +class DynamicProto extends Proto { + final Reference reference; + + DynamicProto(this.reference); + + @override + Expression toExpression() { + return new TypeLiteral(toTypeAnnotation()); + } + + @override + TypeAnnotation toTypeAnnotation() => new DynamicTypeAnnotation(reference); + + @override + Proto access(String? name) { + return name == null ? this : new InvalidAccessProto(this, name); + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments == null + ? this + : new InvalidInstantiationProto(this, typeArguments); + } + + @override + Proto invoke(List? arguments) { + return arguments == null + ? this + : new InvalidInvocationProto(this, const [], arguments); + } + + @override + String toString() => 'DynamicProto()'; + + @override + Proto? resolve() => null; +} + +/// A [reference] to a constructor, including a reference to the [type] on which +/// it was accessed, as well as the [typeArguments] applied to [type]. +class ConstructorProto extends Proto { + final Reference type; + final List typeArguments; + final ConstructorReference reference; + + ConstructorProto(this.type, this.typeArguments, this.reference); + + @override + String toString() => 'ConstructorProto($type,$typeArguments,$reference)'; + + @override + Proto access(String? name) { + return name != null ? new InvalidAccessProto(this, name) : this; + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments != null + ? new ExpressionInstantiationProto(this, typeArguments) + : this; + } + + @override + Proto invoke(List? arguments) { + return arguments != null + ? new ExpressionProto(new ConstructorInvocation( + new NamedTypeAnnotation(type, typeArguments), reference, arguments)) + : this; + } + + @override + Expression toExpression() { + return new ConstructorTearOff( + new NamedTypeAnnotation(type, typeArguments), reference); + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + Proto? resolve() => null; +} + +/// A [reference] to a static or top level field. +class FieldProto extends Proto { + final FieldReference reference; + + FieldProto(this.reference); + + @override + String toString() => 'FieldProto($reference)'; + + @override + Proto access(String? name) { + return name != null ? new InstanceAccessProto(this, name) : this; + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments != null + ? new ExpressionInstantiationProto(this, typeArguments) + : this; + } + + @override + Proto invoke(List? arguments) { + return arguments != null + ? new InstanceInvocationProto(this, const [], arguments) + : this; + } + + @override + Expression toExpression() { + return new StaticGet(reference); + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + Proto? resolve() => null; +} + +/// A [reference] to a static or top level method. +class FunctionProto extends Proto { + final FunctionReference reference; + + FunctionProto(this.reference); + + @override + String toString() => 'FunctionProto($reference)'; + + @override + Proto access(String? name) { + return name != null ? new InstanceAccessProto(this, name) : this; + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments != null + ? new FunctionInstantiationProto(reference, typeArguments) + : this; + } + + @override + Proto invoke(List? arguments) { + return arguments != null + ? new ExpressionProto( + new StaticInvocation(reference, const [], arguments)) + : this; + } + + @override + Expression toExpression() { + return new FunctionTearOff(reference); + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + Proto? resolve() => null; +} + +/// A [reference] to a static or top level method instantiated with +/// [typeArguments]. +class FunctionInstantiationProto extends Proto { + final FunctionReference reference; + final List typeArguments; + + FunctionInstantiationProto(this.reference, this.typeArguments); + + @override + String toString() => 'FunctionInstantiationProto($reference,$typeArguments)'; + + @override + Proto access(String? name) { + return name != null ? new InstanceAccessProto(this, name) : this; + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments != null + ? new ExpressionInstantiationProto(this, typeArguments) + : this; + } + + @override + Proto invoke(List? arguments) { + return arguments != null + ? new ExpressionProto( + new StaticInvocation(reference, typeArguments, arguments)) + : this; + } + + @override + Expression toExpression() { + return new Instantiation(new FunctionTearOff(reference), typeArguments); + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + Proto? resolve() => null; +} + +/// A reference to the [prefix]. +/// +/// The [Proto] includes the [scope] of the prefix, which is used to resolve +/// access to imported members and types through the prefix. +class PrefixProto extends Proto { + final String prefix; + final Scope scope; + + PrefixProto(this.prefix, this.scope); + + @override + String toString() => 'PrefixProto($prefix)'; + + @override + Proto access(String? name) { + if (name == null) { + return this; + } + return scope.lookup(name); + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments != null + ? new InvalidInstantiationProto(this, typeArguments) + : this; + } + + @override + Proto invoke(List? arguments) { + return arguments != null + ? new InvalidInvocationProto(this, const [], arguments) + : this; + } + + @override + Expression toExpression() { + return new InvalidExpression(); + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + Proto? resolve() => null; +} + +/// The suffix of an access to the property [text] including applied +/// [typeArguments] and [arguments], if any. +/// +/// This is not really a [Proto] but just a sequence of information needed to +/// call [Proto.access], [Proto.instantiate], and [Proto.invoke]. Unfortunately +/// the parser currently provides these as a "send" which is not the ideal model +/// for parsing Dart. +class IdentifierProto extends Proto { + final String text; + final List? typeArguments; + final List? arguments; + + IdentifierProto(String text) : this._(text, null, null); + + IdentifierProto._(this.text, this.typeArguments, this.arguments); + + @override + Proto access(String? name) { + return name == null + ? this + : throw new UnimplementedError('IdentifierProto.access'); + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments == null + ? this + : new IdentifierProto._(text, typeArguments, null); + } + + @override + Proto invoke(List? arguments) { + return arguments == null + ? this + : new IdentifierProto._(text, typeArguments, arguments); + } + + @override + Expression toExpression() { + throw new UnimplementedError('IdentifierProto.toExpression'); + } + + @override + TypeAnnotation toTypeAnnotation() { + throw new UnimplementedError('IdentifierProto.toTypeAnnotation'); + } + + @override + String toString() => 'IdentifierProto($text)'; + + @override + Proto? resolve() => null; +} + +/// An access to the [text] property on [receiver]. +/// +/// If [isNullAware] is `true`, this is a `?.` access, otherwise it is a '.' +/// access. +/// +/// This is used for the when the [text] property is known to be an instance +/// member of [receiver]. Either because the [receiver] cannot be the prefix +/// of a static access or if [isNullAware] is `true`. +class InstanceAccessProto extends Proto { + final Proto receiver; + final String text; + final bool isNullAware; + + InstanceAccessProto(this.receiver, this.text, {this.isNullAware = false}); + + @override + Proto access(String? name) { + if (name == null) { + return this; + } + throw new UnimplementedError('InstanceAccessProto.access'); + } + + @override + Proto instantiate(List? typeArguments) { + if (typeArguments == null) { + return this; + } + throw new UnimplementedError('InstanceAccessProto.instantiate'); + } + + @override + Proto invoke(List? arguments) { + if (arguments == null) { + return this; + } + throw new UnimplementedError('InstanceAccessProto.invoke'); + } + + @override + Expression toExpression() { + return isNullAware + ? new NullAwarePropertyGet(receiver.toExpression(), text) + : new PropertyGet(receiver.toExpression(), text); + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + String toString() => 'InstanceAccessProto($receiver,$text)'; + + @override + Proto? resolve() => null; +} + +/// The application of [typeArguments] on [receiver] which is known to be an +/// expression. +class ExpressionInstantiationProto extends Proto { + final Proto receiver; + final List typeArguments; + + ExpressionInstantiationProto(this.receiver, this.typeArguments); + + @override + Proto access(String? name) { + return name != null + ? new ExpressionProto(new PropertyGet(receiver.toExpression(), name)) + : this; + } + + @override + Proto instantiate(List? typeArguments) { + throw new UnimplementedError('InstanceInstantiationProto.instantiate'); + } + + @override + Proto invoke(List? arguments) { + return arguments != null + ? new ExpressionProto(new ImplicitInvocation( + receiver.toExpression(), const [], arguments)) + : this; + } + + @override + Expression toExpression() { + return new Instantiation(receiver.toExpression(), typeArguments); + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + String toString() => 'InstanceInstantiationProto($receiver,$typeArguments)'; + + @override + Proto? resolve() => null; +} + +/// The application of [typeArguments] and [arguments] on [receiver] which is +/// known to be an expression. +class InstanceInvocationProto extends Proto { + final Proto receiver; + final List typeArguments; + final List arguments; + + InstanceInvocationProto(this.receiver, this.typeArguments, this.arguments); + + @override + Proto access(String? name) { + throw new UnimplementedError('InstanceInvocationProto.access'); + } + + @override + Proto instantiate(List? typeArguments) { + throw new UnimplementedError('InstanceInvocationProto.instantiate'); + } + + @override + Proto invoke(List? arguments) { + throw new UnimplementedError('InstanceInvocationProto.invoke'); + } + + @override + Expression toExpression() { + return new ImplicitInvocation( + receiver.toExpression(), typeArguments, arguments); + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + String toString() => + 'InstanceInvocationProto($receiver,$typeArguments,$arguments)'; + + @override + Proto? resolve() => null; +} + +/// The access of [text] on [receiver] when this is known to be an invalid +/// construct. +// TODO(johnniwinther): This is not valid for non-const expressions. Expand +// this if used for non-const expressions. +class InvalidAccessProto extends Proto { + final Proto receiver; + final String text; + + InvalidAccessProto(this.receiver, this.text); + + @override + Proto access(String? name) { + throw new UnimplementedError('InvalidAccessProto.access'); + } + + @override + Proto instantiate(List? typeArguments) { + throw new UnimplementedError('InvalidAccessProto.instantiate'); + } + + @override + Proto invoke(List? arguments) { + throw new UnimplementedError('InvalidAccessProto.invoke'); + } + + @override + Expression toExpression() { + return new InvalidExpression(); + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + String toString() => 'InvalidAccessProto($receiver,$text)'; + + @override + Proto? resolve() => null; +} + +/// The application of [typeArguments] on [receiver] when this is known to be an +/// invalid construct. +// TODO(johnniwinther): This might not be valid for non-const expressions. +// Expand this if used for non-const expressions. +class InvalidInstantiationProto extends Proto { + final Proto receiver; + final List typeArguments; + + InvalidInstantiationProto(this.receiver, this.typeArguments); + + @override + Proto access(String? name) { + throw new UnimplementedError('InvalidInstantiationProto.access'); + } + + @override + Proto instantiate(List? typeArguments) { + throw new UnimplementedError('InvalidInstantiationProto.instantiate'); + } + + @override + Proto invoke(List? arguments) { + throw new UnimplementedError('InvalidInstantiationProto.invoke'); + } + + @override + Expression toExpression() { + return new InvalidExpression(); + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + String toString() => 'InvalidInstantiationProto($receiver,$typeArguments)'; + + @override + Proto? resolve() => null; +} + +/// The application of [typeArguments] and [arguments] on [receiver] when this +/// is known to be an invalid construct. +// TODO(johnniwinther): This might not be valid for non-const expressions. +// Expand this if used for non-const expressions. +class InvalidInvocationProto extends Proto { + final Proto receiver; + final List typeArguments; + final List arguments; + + InvalidInvocationProto(this.receiver, this.typeArguments, this.arguments); + + @override + Proto access(String? name) { + throw new UnimplementedError('InvalidInvocationProto.access'); + } + + @override + Proto instantiate(List? typeArguments) { + throw new UnimplementedError('InvalidInvocationProto.instantiate'); + } + + @override + Proto invoke(List? arguments) { + throw new UnimplementedError('InvalidInvocationProto.invoke'); + } + + @override + Expression toExpression() { + return new InvalidExpression(); + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + String toString() => + 'InvalidInvocationProto($receiver,$typeArguments,$arguments)'; + + @override + Proto? resolve() => null; +} + +/// An [expression] occurring as a [Proto]. +class ExpressionProto extends Proto { + final Expression expression; + + ExpressionProto(this.expression); + + @override + Proto access(String? name) { + return name != null ? new InstanceAccessProto(this, name) : this; + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments != null + ? new ExpressionInstantiationProto(this, typeArguments) + : this; + } + + @override + Proto invoke(List? arguments) { + return arguments != null + ? new ExpressionProto( + new ImplicitInvocation(expression, const [], arguments)) + : this; + } + + @override + Expression toExpression() { + return expression; + } + + @override + TypeAnnotation toTypeAnnotation() => new InvalidTypeAnnotation(); + + @override + String toString() => 'ExpressionProto($expression)'; + + @override + Proto? resolve() => null; +} + +/// A reference to a [functionTypeParameter]. +class FunctionTypeParameterProto extends Proto { + final FunctionTypeParameter functionTypeParameter; + + FunctionTypeParameterProto(this.functionTypeParameter); + + @override + Proto access(String? name) { + return name == null ? this : new InvalidAccessProto(this, name); + } + + @override + Proto instantiate(List? typeArguments) { + return typeArguments == null + ? this + : new ExpressionInstantiationProto(this, typeArguments); + } + + @override + Proto invoke(List? arguments) { + return arguments != null + ? new ExpressionProto( + new ImplicitInvocation(toExpression(), const [], arguments)) + : this; + } + + @override + Proto? resolve() => null; + + @override + Expression toExpression() { + return new TypeLiteral(toTypeAnnotation()); + } + + @override + TypeAnnotation toTypeAnnotation() { + return new FunctionTypeParameterType(functionTypeParameter); + } +} diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/record_fields.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/record_fields.dart new file mode 100644 index 000000000000..04b9719e7484 --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/record_fields.dart @@ -0,0 +1,51 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'expressions.dart'; +import 'proto.dart'; + +/// Superclass for named and position record fields. +// TODO(johnniwinther): Merge subclasses into one class? +sealed class RecordField { + /// Returns the [RecordField] corresponding to this [RecordField] in + /// which all [UnresolvedIdentifier]s have been resolved within their scope. + /// + /// If this didn't create a new [RecordField], `null` is returned. + RecordField? resolve(); +} + +class RecordNamedField extends RecordField { + final String name; + final Expression expression; + + RecordNamedField(this.name, this.expression); + + @override + String toString() => 'RecordNamedField($name,$expression)'; + + @override + RecordField? resolve() { + Expression? newExpression = expression.resolve(); + return newExpression == null + ? null + : new RecordNamedField(name, newExpression); + } +} + +class RecordPositionalField extends RecordField { + final Expression expression; + + RecordPositionalField(this.expression); + + @override + String toString() => 'RecordPositionalField($expression)'; + + @override + RecordField? resolve() { + Expression? newExpression = expression.resolve(); + return newExpression == null + ? null + : new RecordPositionalField(newExpression); + } +} diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/references.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/references.dart new file mode 100644 index 000000000000..ce42c94f52c8 --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/references.dart @@ -0,0 +1,76 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// A resolved reference to an entity. +// TODO(johnniwinther): Do we need to split these into subtypes? +sealed class Reference { + const Reference(); +} + +abstract class FieldReference extends Reference { + String get name; + + @override + String toString() => 'FieldReference(${name})'; +} + +abstract class FunctionReference extends Reference { + String get name; + + @override + String toString() => 'FunctionReference(${name})'; +} + +abstract class ConstructorReference extends Reference { + String get name; + + @override + String toString() => 'ConstructorReference(${name})'; +} + +abstract class TypeReference extends Reference { + const TypeReference(); + + String get name; + + @override + String toString() => 'TypeReference(${name})'; +} + +abstract class ClassReference extends Reference { + String get name; + + @override + String toString() => 'ClassReference(${name})'; +} + +abstract class TypedefReference extends Reference { + String get name; + + @override + String toString() => 'TypedefReference(${name})'; +} + +abstract class ExtensionReference extends Reference { + String get name; + + @override + String toString() => 'ExtensionReference(${name})'; +} + +abstract class FunctionTypeParameterReference extends Reference { + String get name; + + @override + String toString() => 'FunctionTypeParameterReference(${name})'; +} + +/// Symbolic references needed during parsing. +abstract class References { + /// The [TypeReference] used for parsing `void`. + TypeReference get voidReference; + + /// The [TypeReference] used for parsing `void`. + TypeReference get dynamicReference; +} diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/scope.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/scope.dart new file mode 100644 index 000000000000..1f24fc589dce --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/scope.dart @@ -0,0 +1,97 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'proto.dart'; +import 'references.dart'; +import 'type_annotations.dart'; + +/// Scope used to lookup named entities. +abstract class Scope { + /// Returns the [Proto] corresponding to [name] in this scope. + /// + /// This might be an [UnresolvedIdentifier] if [name] was not found in this + /// scope. + Proto lookup(String name); +} + +/// Scope of a type declaration used to lookup static members. +abstract class TypeDeclarationScope { + /// Returns the [Proto] corresponding to accessing [name] on the type + /// declaration. + /// + /// If the access is preceded by [typeArguments], these must be passed and + /// included in the returned [Proto]. + Proto lookup(String name, [List? typeArguments]); +} + +/// Base implementation for creating a [TypeDeclarationScope] for a class. +abstract base class BaseClassScope implements TypeDeclarationScope { + ClassReference get classReference; + + Proto createConstructorProto(List? typeArguments, + ConstructorReference constructorReference) { + return new ConstructorProto( + classReference, typeArguments ?? const [], constructorReference); + } + + Proto createMemberProto(List? typeArguments, String name, + T? member, Proto Function(T, String) memberToProto) { + if (member == null) { + if (typeArguments != null) { + return new UnresolvedAccess( + new GenericClassProto(classReference, this, typeArguments), name); + } else { + return new UnresolvedAccess(new ClassProto(classReference, this), name); + } + } else { + if (typeArguments != null) { + return new InvalidAccessProto( + new GenericClassProto(classReference, this, typeArguments), name); + } else { + return memberToProto(member, name); + } + } + } +} + +/// Base implementation for creating a [TypeDeclarationScope] for an extension. +abstract base class BaseExtensionScope implements TypeDeclarationScope { + ExtensionReference get extensionReference; + + Proto createMemberProto(List? typeArguments, String name, + T? member, Proto Function(T, String) memberToProto) { + if (typeArguments != null) { + return new UnresolvedAccess( + new InvalidInstantiationProto( + new ExtensionProto(extensionReference, this), typeArguments), + name); + } else if (member == null) { + return new UnresolvedAccess( + new ExtensionProto(extensionReference, this), name); + } else { + return memberToProto(member, name); + } + } +} + +/// Base implementation for creating a [TypeDeclarationScope] for a typedef. +abstract base class BaseTypedefScope implements TypeDeclarationScope { + TypedefReference get typedefReference; + + Proto createConstructorProto(List? typeArguments, + ConstructorReference constructorReference) { + return new ConstructorProto( + typedefReference, typeArguments ?? const [], constructorReference); + } + + Proto createMemberProto(List? typeArguments, String name) { + if (typeArguments != null) { + return new UnresolvedAccess( + new GenericTypedefProto(typedefReference, this, typeArguments), name); + } else { + return new UnresolvedAccess( + new TypedefProto(typedefReference, this), name); + } + } +} diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/string_literal_parts.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/string_literal_parts.dart new file mode 100644 index 000000000000..ad44087ab763 --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/string_literal_parts.dart @@ -0,0 +1,43 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'expressions.dart'; +import 'proto.dart'; + +/// Superclass for parts of a string literal. +sealed class StringLiteralPart { + /// Returns the [StringLiteralPart] corresponding to this [StringLiteralPart] + /// in which all [UnresolvedIdentifier]s have been resolved within their + /// scope. + /// + /// If this didn't create a new [StringLiteralPart], `null` is returned. + StringLiteralPart? resolve(); +} + +class StringPart extends StringLiteralPart { + final String text; + + StringPart(this.text); + + @override + String toString() => 'StringPart($text)'; + + @override + StringLiteralPart? resolve() => null; +} + +class InterpolationPart extends StringLiteralPart { + final Expression expression; + + InterpolationPart(this.expression); + + @override + String toString() => 'InterpolationPart($expression)'; + + @override + StringLiteralPart? resolve() { + Expression? newExpression = expression.resolve(); + return newExpression == null ? null : new InterpolationPart(newExpression); + } +} diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/type_annotations.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/type_annotations.dart new file mode 100644 index 000000000000..035406ac238e --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/type_annotations.dart @@ -0,0 +1,254 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'expressions.dart'; +import 'formal_parameters.dart'; +import 'proto.dart'; +import 'references.dart'; +import 'util.dart'; + +/// Supertype for all type annotations. +sealed class TypeAnnotation { + /// Returns the [TypeAnnotation] corresponding to this [TypeAnnotation] in + /// which all [UnresolvedIdentifier]s have been resolved within their scope. + /// + /// If this didn't create a new [TypeAnnotation], `null` is returned. + /// + /// [env] maps from the [FunctionTypeParameter]s of this [TypeAnnotation] to + /// the [FunctionTypeParameter]s in the returned [TypeAnnotation]. This is + /// needed because [FunctionTypeParameter] contains its bound, which itself + /// might be resolved in the process. + TypeAnnotation? resolve( + {Map env = const {}}); +} + +class NamedTypeAnnotation extends TypeAnnotation { + final Reference reference; + final List typeArguments; + + NamedTypeAnnotation(this.reference, [this.typeArguments = const []]); + + @override + String toString() => 'NamedTypeAnnotation($reference,$typeArguments)'; + + @override + TypeAnnotation? resolve( + {Map env = const {}}) { + List? newTypeArguments = + typeArguments.resolve((a) => a.resolve(env: env)); + return newTypeArguments == null + ? null + : new NamedTypeAnnotation(reference, newTypeArguments); + } +} + +class NullableTypeAnnotation extends TypeAnnotation { + final TypeAnnotation typeAnnotation; + + NullableTypeAnnotation(this.typeAnnotation); + + @override + String toString() => 'NullableTypeAnnotation($typeAnnotation)'; + + @override + TypeAnnotation? resolve( + {Map env = const {}}) { + TypeAnnotation? newTypeAnnotation = typeAnnotation.resolve(env: env); + return newTypeAnnotation == null + ? null + : new NullableTypeAnnotation(newTypeAnnotation); + } +} + +class VoidTypeAnnotation extends TypeAnnotation { + final Reference reference; + + VoidTypeAnnotation(this.reference); + + @override + String toString() => 'VoidTypeAnnotation()'; + + @override + TypeAnnotation? resolve( + {Map env = const {}}) => + null; +} + +class DynamicTypeAnnotation extends TypeAnnotation { + final Reference reference; + + DynamicTypeAnnotation(this.reference); + + @override + String toString() => 'DynamicTypeAnnotation()'; + + @override + TypeAnnotation? resolve( + {Map env = const {}}) => + null; +} + +class InvalidTypeAnnotation extends TypeAnnotation { + InvalidTypeAnnotation(); + + @override + String toString() => 'InvalidTypeAnnotation()'; + + @override + TypeAnnotation? resolve( + {Map env = const {}}) => + null; +} + +class UnresolvedTypeAnnotation extends TypeAnnotation { + final Unresolved unresolved; + + UnresolvedTypeAnnotation(this.unresolved); + + @override + String toString() => 'UnresolvedTypeAnnotation($unresolved)'; + + @override + TypeAnnotation? resolve( + {Map env = const {}}) { + return unresolved.resolveAsTypeAnnotation(); + } +} + +class FunctionTypeAnnotation extends TypeAnnotation { + final TypeAnnotation? returnType; + final List typeParameters; + final List formalParameters; + + FunctionTypeAnnotation( + this.returnType, + this.typeParameters, + this.formalParameters, + ); + + @override + String toString() => + 'FunctionTypeAnnotation($returnType,$typeParameters,$formalParameters)'; + + @override + TypeAnnotation? resolve( + {Map env = const {}}) { + bool needsNewTypeParameters = false; + for (FunctionTypeParameter typeParameter in typeParameters) { + if (typeParameter.bound?.resolve(env: env) != null) { + needsNewTypeParameters = true; + break; + } + if (typeParameter.metadata?.resolve((e) => e.resolve()) != null) { + needsNewTypeParameters = true; + break; + } + } + List? resolvedTypeParameters; + if (needsNewTypeParameters) { + resolvedTypeParameters = []; + env = {...env}; + for (FunctionTypeParameter typeParameter in typeParameters) { + FunctionTypeParameter resolvedTypeParameter = + new FunctionTypeParameter(typeParameter.name); + env[typeParameter] = resolvedTypeParameter; + resolvedTypeParameters.add(resolvedTypeParameter); + } + for (int i = 0; i < typeParameters.length; i++) { + FunctionTypeParameter typeParameter = typeParameters[i]; + FunctionTypeParameter resolvedTypeParameter = resolvedTypeParameters[i]; + resolvedTypeParameter.bound = + typeParameter.bound?.resolve(env: env) ?? typeParameter.bound; + resolvedTypeParameter.metadata = + typeParameter.metadata?.resolve((e) => e.resolve()) ?? + typeParameter.metadata; + } + } + TypeAnnotation? resolvedReturnType = returnType?.resolve(); + List? resolvedFormalParameters = + formalParameters.resolve((a) => a.resolve()); + return resolvedReturnType == null && + resolvedFormalParameters == null && + resolvedTypeParameters == null + ? null + : new FunctionTypeAnnotation( + resolvedReturnType ?? returnType, + resolvedTypeParameters ?? typeParameters, + resolvedFormalParameters ?? formalParameters); + } +} + +class FunctionTypeParameter { + final String name; + TypeAnnotation? bound; + List? metadata; + + FunctionTypeParameter(this.name); + + @override + String toString() => 'FunctionTypeParameter($metadata,$name,$bound)'; +} + +class FunctionTypeParameterType extends TypeAnnotation { + final FunctionTypeParameter functionTypeParameter; + + FunctionTypeParameterType(this.functionTypeParameter); + + @override + String toString() => 'FunctionTypeParameterType($functionTypeParameter)'; + + @override + TypeAnnotation? resolve( + {Map env = const {}}) { + FunctionTypeParameter? resolvedFunctionTypeParameter = + env[functionTypeParameter]; + return resolvedFunctionTypeParameter == null + ? null + : new FunctionTypeParameterType(resolvedFunctionTypeParameter); + } +} + +class RecordTypeAnnotation extends TypeAnnotation { + final List positional; + final List named; + + RecordTypeAnnotation(this.positional, this.named); + + @override + String toString() => 'FunctionTypeParameterType($positional,$named)'; + + @override + TypeAnnotation? resolve( + {Map env = const {}}) { + List? resolvedPositional = + positional.resolve((e) => e.resolve(env: env)); + List? resolvedNamed = + named.resolve((e) => e.resolve(env: env)); + return resolvedPositional == null && resolvedNamed == null + ? null + : new RecordTypeAnnotation( + resolvedPositional ?? positional, resolvedNamed ?? named); + } +} + +class RecordTypeEntry { + final List metadata; + final TypeAnnotation typeAnnotation; + final String? name; + + RecordTypeEntry(this.metadata, this.typeAnnotation, this.name); + + RecordTypeEntry? resolve( + {Map env = const {}}) { + List? resolvedMetadata = metadata.resolve((e) => e.resolve()); + TypeAnnotation? resolvedTypeAnnotation = typeAnnotation.resolve(env: env); + return resolvedMetadata == null && resolvedTypeAnnotation == null + ? null + : new RecordTypeEntry(resolvedMetadata ?? metadata, + resolvedTypeAnnotation ?? typeAnnotation, name); + } + + @override + String toString() => 'RecordTypeEntry($metadata,$typeAnnotation,$name)'; +} diff --git a/pkg/_fe_analyzer_shared/lib/src/metadata/util.dart b/pkg/_fe_analyzer_shared/lib/src/metadata/util.dart new file mode 100644 index 000000000000..c389e7866764 --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/metadata/util.dart @@ -0,0 +1,23 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +extension ResolveHelper on List { + /// Calls [f] on all elements in the list an returns the resulting list. + /// + /// If all elements returned `null`, `null` is returned. Otherwise a list + /// which for each element is the element returned from [f] or itself if + /// `null`. + List? resolve(E? Function(E) f) { + List? newList; + for (int index = 0; index < this.length; index++) { + E element = this[index]; + E? newElement = f(element); + if (newElement != null) { + newList ??= this.toList(growable: false); + newList[index] = newElement; + } + } + return newList; + } +} diff --git a/pkg/_fe_analyzer_shared/lib/src/testing/metadata_helper.dart b/pkg/_fe_analyzer_shared/lib/src/testing/metadata_helper.dart new file mode 100644 index 000000000000..e23a4799a3b6 --- /dev/null +++ b/pkg/_fe_analyzer_shared/lib/src/testing/metadata_helper.dart @@ -0,0 +1,722 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:_fe_analyzer_shared/src/metadata/ast.dart'; + +/// Returns the arguments expression, if [expression] is of the form +/// `Helper(foo)`, and [expression] otherwise. +/// +/// This is used to simplify testing of metadata expression where most can +/// only occur as arguments to a constant constructor invocation. To avoid the +/// clutter, these tests use a `Helper` class which is omitted in the test +/// output. +Expression unwrap(Expression expression) { + if (expression + case ConstructorInvocation( + type: NamedTypeAnnotation(reference: ClassReference(name: 'Helper')), + constructor: ConstructorReference(name: 'new'), + arguments: [PositionalArgument(expression: Expression argument)] + )) { + return argument; + } + return expression; +} + +/// Creates a structured and readable textual representation of [expression]. +String expressionToText(Expression expression) { + Writer writer = new Writer(); + return writer.expressionToText(expression); +} + +/// Helper class for creating a structured and readable textual representation +/// of an [Expression] node. +class Writer { + StringBuffer sb = new StringBuffer(); + bool _lastWasNewLine = true; + int _indentLevel = 0; + + String expressionToText(Expression expression) { + sb.clear(); + _expressionToText(expression); + return sb.toString(); + } + + void _incIndent({int amount = 1, required bool addNewLine}) { + _indentLevel += amount; + if (addNewLine) { + _addNewLine(); + } + } + + void _decIndent({int amount = 1, bool addNewLine = false}) { + _indentLevel -= amount; + if (addNewLine) { + _addNewLine(); + } + } + + void _addNewLine() { + sb.write('\n'); + _lastWasNewLine = true; + } + + void _write(String value) { + if (_lastWasNewLine) { + sb.write(' ' * _indentLevel); + } + sb.write(value); + _lastWasNewLine = false; + } + + void _expressionToText(Expression expression) { + switch (expression) { + case InvalidExpression(): + _write('InvalidExpression()'); + case StaticGet(): + _write('StaticGet('); + _referenceToText(expression.reference); + _write(')'); + case FunctionTearOff(): + _write('FunctionTearOff('); + _referenceToText(expression.reference); + _write(')'); + case ConstructorTearOff(): + _write('ConstructorTearOff('); + _typeAnnotationToText(expression.type); + _write('.'); + _referenceToText(expression.reference); + _write(')'); + case ConstructorInvocation(): + _write('ConstructorInvocation('); + _incIndent(addNewLine: true); + _typeAnnotationToText(expression.type); + _write('.'); + _referenceToText(expression.constructor); + _argumentsToText(expression.arguments); + _decIndent(); + _write(')'); + case IntegerLiteral(): + _write('IntegerLiteral('); + _write(expression.text); + _write(')'); + case DoubleLiteral(): + _write('DoubleLiteral('); + _write(expression.text); + _write(')'); + case BooleanLiteral(): + _write('BooleanLiteral('); + _write(expression.text); + _write(')'); + case NullLiteral(): + _write('NullLiteral()'); + case SymbolLiteral(): + _write('SymbolLiteral('); + _write(expression.parts.join()); + _write(')'); + case StringLiteral(): + _write('StringLiteral('); + _stringPartsToText(expression.parts); + _write(')'); + case StringJuxtaposition(): + _write('StringJuxtaposition('); + _incIndent(addNewLine: false); + _expressionsToText(expression.expressions, delimiter: ''); + _decIndent(); + _write(')'); + case ImplicitInvocation(): + _write('ImplicitInvocation('); + _incIndent(addNewLine: true); + _expressionToText(expression.receiver); + _typeArgumentsToText(expression.typeArguments); + _argumentsToText(expression.arguments); + _decIndent(); + _write(')'); + case StaticInvocation(): + _write('StaticInvocation('); + _incIndent(addNewLine: true); + _referenceToText(expression.function); + _typeArgumentsToText(expression.typeArguments); + _argumentsToText(expression.arguments); + _decIndent(); + _write(')'); + case Instantiation(): + _write('Instantiation('); + _expressionToText(expression.receiver); + _typeArgumentsToText(expression.typeArguments); + _write(')'); + case MethodInvocation(): + _write('MethodInvocation('); + _incIndent(addNewLine: true); + _expressionToText(expression.receiver); + _write('.'); + _write(expression.name); + _typeArgumentsToText(expression.typeArguments); + _argumentsToText(expression.arguments); + _decIndent(); + _write(')'); + case PropertyGet(): + _write('PropertyGet('); + _expressionToText(expression.receiver); + _write('.'); + _write(expression.name); + _write(')'); + case NullAwarePropertyGet(): + _write('NullAwarePropertyGet('); + _expressionToText(expression.receiver); + _write('?.'); + _write(expression.name); + _write(')'); + case TypeLiteral(): + _write('NullAwarePropertyGet('); + _typeAnnotationToText(expression.typeAnnotation); + _write(')'); + case ParenthesizedExpression(): + _write('ParenthesizedExpression('); + _expressionToText(expression.expression); + _write(')'); + case ConditionalExpression(): + _write('ConditionalExpression('); + _incIndent(addNewLine: true); + _expressionToText(expression.condition); + _incIndent(addNewLine: true); + _write('? '); + _incIndent(addNewLine: false); + _expressionToText(expression.then); + _decIndent(addNewLine: true); + _write(': '); + _incIndent(addNewLine: false); + _expressionToText(expression.otherwise); + _decIndent(amount: 3); + _write(')'); + case ListLiteral(): + _write('ListLiteral('); + _typeArgumentsToText(expression.typeArguments); + _write('['); + _elementsToText(expression.elements); + _write('])'); + case SetOrMapLiteral(): + _write('SetOrMapLiteral('); + _typeArgumentsToText(expression.typeArguments); + _write('{'); + _elementsToText(expression.elements); + _write('})'); + case RecordLiteral(): + _write('RecordLiteral('); + _recordFieldsToText(expression.fields); + _write(')'); + break; + case IfNull(): + _write('IfNull('); + _incIndent(addNewLine: true); + _expressionToText(expression.left); + _addNewLine(); + _write(' ?? '); + _addNewLine(); + _expressionToText(expression.right); + _decIndent(addNewLine: true); + _write(')'); + case LogicalExpression(): + _write('LogicalExpression('); + _expressionToText(expression.left); + _write(' '); + _write(expression.operator.text); + _write(' '); + _expressionToText(expression.right); + _write(')'); + case EqualityExpression(): + _write('EqualityExpression('); + _expressionToText(expression.left); + _write(expression.isNotEquals ? ' != ' : ' == '); + _expressionToText(expression.right); + _write(')'); + case BinaryExpression(): + _write('BinaryExpression('); + _expressionToText(expression.left); + _write(' '); + _write(expression.operator.text); + _write(' '); + _expressionToText(expression.right); + _write(')'); + case UnaryExpression(): + _write('UnaryExpression('); + _write(expression.operator.text); + _expressionToText(expression.expression); + _write(')'); + case IsTest(): + _write('IsTest('); + _expressionToText(expression.expression); + _write(' is'); + if (expression.isNot) { + _write('!'); + } + _write(' '); + _typeAnnotationToText(expression.type); + _write(')'); + case AsExpression(): + _write('AsExpression('); + _expressionToText(expression.expression); + _write(' as '); + _typeAnnotationToText(expression.type); + _write(')'); + case NullCheck(): + _write('NullCheck('); + _expressionToText(expression.expression); + _write(')'); + case UnresolvedExpression(): + _write('UnresolvedExpression('); + _unresolvedToText(expression.unresolved); + _write(')'); + } + } + + void _referenceToText(Reference reference) { + switch (reference) { + case FieldReference(): + _write(reference.name); + case FunctionReference(): + _write(reference.name); + case ConstructorReference(): + _write(reference.name); + case TypeReference(): + _write(reference.name); + case ClassReference(): + _write(reference.name); + case TypedefReference(): + _write(reference.name); + case ExtensionReference(): + _write(reference.name); + case FunctionTypeParameterReference(): + _write(reference.name); + } + } + + void _typeAnnotationToText(TypeAnnotation typeAnnotation) { + switch (typeAnnotation) { + case NamedTypeAnnotation(): + _referenceToText(typeAnnotation.reference); + _typeArgumentsToText(typeAnnotation.typeArguments); + case NullableTypeAnnotation(): + _typeAnnotationToText(typeAnnotation.typeAnnotation); + _write('?'); + case VoidTypeAnnotation(): + _write('void'); + case DynamicTypeAnnotation(): + _write('dynamic'); + case InvalidTypeAnnotation(): + _write('<>'); + case UnresolvedTypeAnnotation(): + _write('< typeArguments) { + if (typeArguments.isNotEmpty) { + _write('<'); + String comma = ''; + for (TypeAnnotation typeArgument in typeArguments) { + _write(comma); + _typeAnnotationToText(typeArgument); + comma = ','; + } + _write('>'); + } + } + + void _formalParametersToText(List formalParameters) { + _write('('); + String comma = ''; + bool inNamed = false; + for (FormalParameter formalParameter in formalParameters) { + _write(comma); + if (!inNamed && formalParameter.isNamed) { + _write('{'); + inNamed = true; + } + if (formalParameter.metadata.isNotEmpty) { + _metadataToText(formalParameter.metadata); + } + if (inNamed && formalParameter.isRequired) { + _write('required '); + } + if (formalParameter.typeAnnotation != null) { + _typeAnnotationToText(formalParameter.typeAnnotation!); + if (formalParameter.name != null) { + _write(' '); + } + } + if (formalParameter.name != null) { + _write(formalParameter.name!); + } + if (formalParameter.defaultValue != null) { + _write(' = '); + _expressionToText(formalParameter.defaultValue!); + } + comma = ', '; + } + if (inNamed) { + _write('}'); + } + _write(')'); + } + + void _argumentToText(Argument argument) { + switch (argument) { + case PositionalArgument(): + _expressionToText(argument.expression); + case NamedArgument(): + _write(argument.name); + _write(': '); + _expressionToText(argument.expression); + } + } + + static final int _newLine = '\n'.codeUnitAt(0); + static final int _backSlash = r'\'.codeUnitAt(0); + static final int _dollar = r'$'.codeUnitAt(0); + static final int _quote = "'".codeUnitAt(0); + + String _escape(String text) { + StringBuffer sb = new StringBuffer(); + for (int c in text.codeUnits) { + if (c == _newLine) { + sb.write(r'\n'); + } else if (c == _backSlash) { + sb.write(r'\\'); + } else if (c == _dollar) { + sb.write(r'\$'); + } else if (c == _quote) { + sb.write(r"\'"); + } else if (c < 0x20 || c >= 0x80) { + String hex = c.toRadixString(16); + hex = ("0" * (4 - hex.length)) + hex; + sb.write('\\u$hex'); + } else { + sb.writeCharCode(c); + } + } + return sb.toString(); + } + + void _stringPartsToText(List parts) { + _write("'"); + for (StringLiteralPart part in parts) { + switch (part) { + case StringPart(): + _write(_escape(part.text)); + case InterpolationPart(): + _write(r'${'); + _expressionToText(part.expression); + _write('}'); + } + } + _write("'"); + } + + void _listToText(List list, void Function(E) elementToText, + {required String delimiter, + bool useNewLine = false, + String prefix = ''}) { + if (list.isNotEmpty) { + bool hasNewLine = useNewLine && list.length > 1; + if (hasNewLine) { + _incIndent(addNewLine: false); + } + String comma = ''; + for (E element in list) { + _write(comma); + if (hasNewLine) { + _addNewLine(); + } + _write(prefix); + elementToText(element); + comma = delimiter; + } + if (hasNewLine) { + _decIndent(); + } + } + } + + void _argumentsToText(List arguments) { + _write('('); + _listToText(arguments, _argumentToText, delimiter: ', ', useNewLine: true); + _write(')'); + } + + void _expressionsToText(List expressions, + {required String delimiter, String prefix = ''}) { + _listToText(expressions, _expressionToText, + delimiter: delimiter, useNewLine: true); + } + + void _metadataToText(List metadata) { + if (metadata.isNotEmpty) { + _expressionsToText(metadata, delimiter: ' ', prefix: '@'); + _write(' '); + } + } + + void _elementToText(Element element) { + switch (element) { + case ExpressionElement(): + _write('ExpressionElement('); + if (element.isNullAware) { + _write('?'); + } + _expressionToText(element.expression); + _write(')'); + case MapEntryElement(): + _write('MapEntryElement('); + if (element.isNullAwareKey) { + _write('?'); + } + _expressionToText(element.key); + _write(':'); + if (element.isNullAwareValue) { + _write('?'); + } + _expressionToText(element.value); + _write(')'); + case SpreadElement(): + _write('SpreadElement('); + if (element.isNullAware) { + _write('?'); + } + _write('...'); + _expressionToText(element.expression); + _write(')'); + case IfElement(): + _write('IfElement('); + _incIndent(addNewLine: true); + _expressionToText(element.condition); + _write(','); + _addNewLine(); + _elementToText(element.then); + if (element.otherwise != null) { + _write(','); + _addNewLine(); + _elementToText(element.otherwise!); + } + _decIndent(); + _write(')'); + } + } + + void _elementsToText(List elements) { + _listToText(elements, _elementToText, delimiter: ', ', useNewLine: true); + } + + void _recordFieldToText(RecordField field) { + switch (field) { + case RecordNamedField(): + _write(field.name); + _write(': '); + _expressionToText(field.expression); + case RecordPositionalField(): + _expressionToText(field.expression); + } + } + + void _recordFieldsToText(List fields) { + _listToText(fields, _recordFieldToText, delimiter: ', '); + } + + void _unresolvedToText(Unresolved unresolved) { + switch (unresolved) { + case UnresolvedIdentifier(): + _write('UnresolvedIdentifier('); + _write(unresolved.name); + _write(')'); + case UnresolvedAccess(): + _write('UnresolvedAccess('); + _incIndent(addNewLine: true); + _protoToText(unresolved.prefix); + _write('.'); + _write(unresolved.name); + _decIndent(); + _write(')'); + case UnresolvedInstantiate(): + _write('UnresolvedInstantiate('); + _incIndent(addNewLine: true); + _protoToText(unresolved.prefix); + _typeArgumentsToText(unresolved.typeArguments); + _decIndent(); + _write(')'); + case UnresolvedInvoke(): + _write('UnresolvedInvoke('); + _incIndent(addNewLine: true); + _protoToText(unresolved.prefix); + _addNewLine(); + _argumentsToText(unresolved.arguments); + _decIndent(); + _write(')'); + } + } + + void _protoToText(Proto proto) { + switch (proto) { + case UnresolvedIdentifier(): + _unresolvedToText(proto); + case UnresolvedAccess(): + _unresolvedToText(proto); + case UnresolvedInstantiate(): + _unresolvedToText(proto); + case UnresolvedInvoke(): + _unresolvedToText(proto); + case ClassProto(): + _write('ClassProto('); + _referenceToText(proto.reference); + _write(')'); + case GenericClassProto(): + _write('GenericClassProto('); + _referenceToText(proto.reference); + _typeArgumentsToText(proto.typeArguments); + _write(')'); + case ExtensionProto(): + _write('ExtensionProto('); + _referenceToText(proto.reference); + _write(')'); + case TypedefProto(): + _write('TypedefProto('); + _referenceToText(proto.reference); + _write(')'); + case GenericTypedefProto(): + _write('GenericTypedefProto('); + _referenceToText(proto.reference); + _typeArgumentsToText(proto.typeArguments); + _write(')'); + case VoidProto(): + _write('VoidProto('); + _referenceToText(proto.reference); + _write(')'); + case DynamicProto(): + _write('DynamicProto('); + _referenceToText(proto.reference); + _write(')'); + case ConstructorProto(): + _write('ConstructorProto('); + _referenceToText(proto.type); + _referenceToText(proto.reference); + _typeArgumentsToText(proto.typeArguments); + _write(')'); + case FieldProto(): + _write('FieldProto('); + _referenceToText(proto.reference); + _write(')'); + case FunctionProto(): + _write('FunctionProto('); + _referenceToText(proto.reference); + _write(')'); + case FunctionInstantiationProto(): + _write('FunctionInstantiationProto('); + _referenceToText(proto.reference); + _typeArgumentsToText(proto.typeArguments); + _write(')'); + case PrefixProto(): + _write('PrefixProto('); + _write(proto.prefix); + _write(')'); + case IdentifierProto(): + _write('IdentifierProto('); + _write(proto.text); + if (proto.typeArguments != null) { + _typeArgumentsToText(proto.typeArguments!); + } + if (proto.arguments != null) { + _argumentsToText(proto.arguments!); + } + _write(')'); + case InstanceAccessProto(): + _write('InstanceAccessProto('); + _protoToText(proto.receiver); + if (proto.isNullAware) { + _write('?.'); + } else { + _write('.'); + } + _write(proto.text); + _write(')'); + case ExpressionInstantiationProto(): + _write('ExpressionInstantiationProto('); + _protoToText(proto.receiver); + _typeArgumentsToText(proto.typeArguments); + _write(')'); + case InstanceInvocationProto(): + _write('InstanceInvocationProto('); + _protoToText(proto.receiver); + _typeArgumentsToText(proto.typeArguments); + _argumentsToText(proto.arguments); + _write(')'); + case InvalidAccessProto(): + _write('InvalidAccessProto('); + _protoToText(proto.receiver); + _write(proto.text); + _write(')'); + case InvalidInstantiationProto(): + _write('InvalidInstantiationProto('); + _protoToText(proto.receiver); + _typeArgumentsToText(proto.typeArguments); + _write(')'); + case InvalidInvocationProto(): + _write('InvalidInvocationProto('); + _protoToText(proto.receiver); + _typeArgumentsToText(proto.typeArguments); + _argumentsToText(proto.arguments); + _write(')'); + case ExpressionProto(): + _write('ExpressionProto('); + _expressionToText(proto.expression); + _write(')'); + case FunctionTypeParameterProto(): + _write('FunctionTypeParameterProto('); + _write(proto.functionTypeParameter.name); + _write(')'); + } + } +} diff --git a/pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart b/pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart index fb7fcf3a5801..c357b059761b 100644 --- a/pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart +++ b/pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer_operations.dart @@ -658,6 +658,15 @@ abstract interface class TypeAnalyzerOperations< SharedTypeSchemaView typeSchema1, SharedTypeSchemaView typeSchema2); + /// Computes the greatest closure of a type. + /// + /// Computing the greatest closure of a type is described here: + /// https://github.com/dart-lang/language/blob/main/resources/type-system/inference.md#type-variable-elimination-least-and-greatest-closure-of-a-type + TypeStructure greatestClosureOfTypeInternal( + TypeStructure type, + List> + typeParametersToEliminate); + /// Converts a type into a corresponding type schema. SharedTypeSchemaView typeToSchema( SharedTypeView type); @@ -888,10 +897,15 @@ abstract class TypeConstraintGenerator< /// https://github.com/dart-lang/sdk/issues/51156#issuecomment-2158825417. bool get enableDiscrepantObliviousnessOfNullabilitySuffixOfFutureOr; + /// True if the language feature inference-using-bounds is enabled. + final bool inferenceUsingBoundsIsEnabled; + /// Abstract type operations to be used in the matching methods. TypeAnalyzerOperations get typeAnalyzerOperations; + TypeConstraintGenerator({required this.inferenceUsingBoundsIsEnabled}); + /// Returns the type arguments of the supertype of [type] that is an /// instantiation of [typeDeclaration]. If none of the supertypes of [type] /// are instantiations of [typeDeclaration], returns null. diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/access/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/access/main.dart new file mode 100644 index 000000000000..104247ba49e7 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/access/main.dart @@ -0,0 +1,232 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'main.dart' as self; + +class Helper { + const Helper(a); +} + +const String variable = ''; + +void function() {} + +class Class { + const Class(); + const Class.named(); + + static const String field = ''; + + static void method() {} +} + +class GenericClass { + const GenericClass(); + const GenericClass.named(); +} + +typedef Alias = Class; +typedef ComplexAlias = Class; +typedef GenericAlias = GenericClass; + +@Helper(variable) +/*member: access1: +StaticGet(variable)*/ +void access1() {} + +@Helper(variable.length) +/*member: access2: +PropertyGet(StaticGet(variable).length)*/ +void access2() {} + +@Helper(function) +/*member: access3: +FunctionTearOff(function)*/ +void access3() {} + +@Helper(Class) +/*member: access4: +NullAwarePropertyGet(Class)*/ +void access4() {} + +@Helper(Class.new) +/*member: access5: +ConstructorTearOff(Class.new)*/ +void access5() {} + +@Helper(Class.named) +/*member: access6: +ConstructorTearOff(Class.named)*/ +void access6() {} + +@Helper(Class.field) +/*member: access7: +StaticGet(field)*/ +void access7() {} + +@Helper(Class.field.length) +/*member: access8: +PropertyGet(StaticGet(field).length)*/ +void access8() {} + +@Helper(Class.method) +/*member: access9: +FunctionTearOff(method)*/ +void access9() {} + +@Helper(self.variable) +/*member: access10: +StaticGet(variable)*/ +void access10() {} + +@Helper(self.variable.length) +/*member: access11: +PropertyGet(StaticGet(variable).length)*/ +void access11() {} + +@Helper(self.function) +/*member: access12: +FunctionTearOff(function)*/ +void access12() {} + +@Helper(self.Class) +/*member: access13: +NullAwarePropertyGet(Class)*/ +void access13() {} + +@Helper(self.Class.new) +/*member: access14: +ConstructorTearOff(Class.new)*/ +void access14() {} + +@Helper(self.Class.named) +/*member: access15: +ConstructorTearOff(Class.named)*/ +void access15() {} + +@Helper(self.Class.field) +/*member: access16: +StaticGet(field)*/ +void access16() {} + +@Helper(self.Class.field.length) +/*member: access17: +PropertyGet(StaticGet(field).length)*/ +void access17() {} + +@Helper(self.Class.method) +/*member: access18: +FunctionTearOff(method)*/ +void access18() {} + +@Helper(dynamic) +/*member: access19: +NullAwarePropertyGet(dynamic)*/ +void access19() {} + +@Helper(Alias.new) +/*member: access20: +ConstructorTearOff(Alias.new)*/ +void access20() {} + +@Helper(Alias.named) +/*member: access21: +ConstructorTearOff(Alias.named)*/ +void access21() {} + +@Helper(ComplexAlias.new) +/*member: access22: +ConstructorTearOff(ComplexAlias.new)*/ +void access22() {} + +@Helper(ComplexAlias.named) +/*member: access23: +ConstructorTearOff(ComplexAlias.named)*/ +void access23() {} + +@Helper(ComplexAlias.new) +/*member: access24: +ConstructorTearOff(ComplexAlias.new)*/ +void access24() {} + +@Helper(ComplexAlias.named) +/*member: access25: +ConstructorTearOff(ComplexAlias.named)*/ +void access25() {} + +@Helper(GenericAlias.new) +/*member: access26: +ConstructorTearOff(GenericAlias.new)*/ +void access26() {} + +@Helper(GenericAlias.named) +/*member: access27: +ConstructorTearOff(GenericAlias.named)*/ +void access27() {} + +@Helper(GenericAlias.new) +/*member: access28: +ConstructorTearOff(GenericAlias.new)*/ +void access28() {} + +@Helper(GenericAlias.named) +/*member: access29: +ConstructorTearOff(GenericAlias.named)*/ +void access29() {} + +@Helper(dynamic) +/*member: access30: +NullAwarePropertyGet(dynamic)*/ +void access30() {} + +@Helper(self.Alias.new) +/*member: access31: +ConstructorTearOff(Alias.new)*/ +void access31() {} + +@Helper(self.Alias.named) +/*member: access32: +ConstructorTearOff(Alias.named)*/ +void access32() {} + +@Helper(self.ComplexAlias.new) +/*member: access33: +ConstructorTearOff(ComplexAlias.new)*/ +void access33() {} + +@Helper(self.ComplexAlias.named) +/*member: access34: +ConstructorTearOff(ComplexAlias.named)*/ +void access34() {} + +@Helper(self.ComplexAlias.new) +/*member: access35: +ConstructorTearOff(ComplexAlias.new)*/ +void access35() {} + +@Helper(self.ComplexAlias.named) +/*member: access36: +ConstructorTearOff(ComplexAlias.named)*/ +void access36() {} + +@Helper(self.GenericAlias.new) +/*member: access37: +ConstructorTearOff(GenericAlias.new)*/ +void access37() {} + +@Helper(self.GenericAlias.named) +/*member: access38: +ConstructorTearOff(GenericAlias.named)*/ +void access38() {} + +@Helper(self.GenericAlias.new) +/*member: access39: +ConstructorTearOff(GenericAlias.new)*/ +void access39() {} + +@Helper(self.GenericAlias.named) +/*member: access40: +ConstructorTearOff(GenericAlias.named)*/ +void access40() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/annotation/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/annotation/main.dart new file mode 100644 index 000000000000..ab3a5d57441c --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/annotation/main.dart @@ -0,0 +1,167 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'main.dart' as self; + +const String variable = ''; + +void function() {} + +class Class { + const Class([a]); + const Class.named({a, b}); + const Class.mixed(a, b, {c, d}); +} + +class GenericClass { + const GenericClass(); + const GenericClass.named({a, b}); +} + +@variable +/*member: annotation1: +StaticGet(variable)*/ +void annotation1() {} + +@function +/*member: annotation2: +FunctionTearOff(function)*/ +void annotation2() {} + +@self.variable +/*member: annotation3: +StaticGet(variable)*/ +void annotation3() {} + +@self.function +/*member: annotation4: +FunctionTearOff(function)*/ +void annotation4() {} + +@Class() +/*member: annotation5: +ConstructorInvocation( + Class.new())*/ +void annotation5() {} + +@Class.named() +/*member: annotation6: +ConstructorInvocation( + Class.named())*/ +void annotation6() {} + +@Class.named(a: 0) +/*member: annotation7: +ConstructorInvocation( + Class.named(a: IntegerLiteral(0)))*/ +void annotation7() {} + +@Class.named(b: 1) +/*member: annotation8: +ConstructorInvocation( + Class.named(b: IntegerLiteral(1)))*/ +void annotation8() {} + +@Class.named(a: 0, b: 1) +/*member: annotation9: +ConstructorInvocation( + Class.named( + a: IntegerLiteral(0), + b: IntegerLiteral(1)))*/ +void annotation9() {} + +@Class.mixed(0, 1) +/*member: annotation10: +ConstructorInvocation( + Class.mixed( + IntegerLiteral(0), + IntegerLiteral(1)))*/ +void annotation10() {} + +@Class.mixed(0, 1, c: 2) +/*member: annotation11: +ConstructorInvocation( + Class.mixed( + IntegerLiteral(0), + IntegerLiteral(1), + c: IntegerLiteral(2)))*/ +void annotation11() {} + +@Class.mixed(0, 1, c: 2, d: 3) +/*member: annotation12: +ConstructorInvocation( + Class.mixed( + IntegerLiteral(0), + IntegerLiteral(1), + c: IntegerLiteral(2), + d: IntegerLiteral(3)))*/ +void annotation12() {} + +@Class.mixed(0, 1, d: 3) +/*member: annotation13: +ConstructorInvocation( + Class.mixed( + IntegerLiteral(0), + IntegerLiteral(1), + d: IntegerLiteral(3)))*/ +void annotation13() {} + +@Class.mixed(d: 3, 0, c: 2, 1) +/*member: annotation14: +ConstructorInvocation( + Class.mixed( + d: IntegerLiteral(3), + IntegerLiteral(0), + c: IntegerLiteral(2), + IntegerLiteral(1)))*/ +void annotation14() {} + +@self.Class() +/*member: annotation15: +ConstructorInvocation( + Class.new())*/ +void annotation15() {} + +@self.Class.named() +/*member: annotation16: +ConstructorInvocation( + Class.named())*/ +void annotation16() {} + +@GenericClass() +/*member: annotation17: +ConstructorInvocation( + GenericClass.new())*/ +void annotation17() {} + +@GenericClass() +/*member: annotation18: +ConstructorInvocation( + GenericClass.new())*/ +void annotation18() {} + +@GenericClass.named() +/*member: annotation19: +ConstructorInvocation( + GenericClass.named())*/ +void annotation19() {} + +@GenericClass.named() +/*member: annotation20: +ConstructorInvocation( + GenericClass.named())*/ +void annotation20() {} + +@self.GenericClass.named() +/*member: annotation21: +ConstructorInvocation( + GenericClass.named())*/ +void annotation21() {} + +@self.GenericClass>.named() +/*member: annotation22: +ConstructorInvocation( + GenericClass>.named())*/ +void annotation22() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/binary/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/binary/main.dart new file mode 100644 index 000000000000..f120e7b95fe2 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/binary/main.dart @@ -0,0 +1,120 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Helper { + const Helper(a); +} + +const bool constBool = true; + +const List? constNullableList = []; + +@Helper(constNullableList ?? [0]) +/*member: binary1: +IfNull( + StaticGet(constNullableList) + ?? + ListLiteral([ExpressionElement(IntegerLiteral(0))]) +)*/ +void binary1() {} + +@Helper(constBool || true) +/*member: binary2: +LogicalExpression(StaticGet(constBool) || BooleanLiteral(true))*/ +void binary2() {} + +@Helper(constBool && true) +/*member: binary3: +LogicalExpression(StaticGet(constBool) && BooleanLiteral(true))*/ +void binary3() {} + +@Helper(0 == 1) +/*member: binary4: +EqualityExpression(IntegerLiteral(0) == IntegerLiteral(1))*/ +void binary4() {} + +@Helper(0 != 1) +/*member: binary5: +EqualityExpression(IntegerLiteral(0) != IntegerLiteral(1))*/ +void binary5() {} + +@Helper(0 >= 1) +/*member: binary6: +BinaryExpression(IntegerLiteral(0) >= IntegerLiteral(1))*/ +void binary6() {} + +@Helper(0 > 1) +/*member: binary7: +BinaryExpression(IntegerLiteral(0) > IntegerLiteral(1))*/ +void binary7() {} + +@Helper(0 <= 1) +/*member: binary8: +BinaryExpression(IntegerLiteral(0) <= IntegerLiteral(1))*/ +void binary8() {} + +@Helper(0 < 1) +/*member: binary9: +BinaryExpression(IntegerLiteral(0) < IntegerLiteral(1))*/ +void binary9() {} + +@Helper(0 | 1) +/*member: binary10: +BinaryExpression(IntegerLiteral(0) | IntegerLiteral(1))*/ +void binary10() {} + +@Helper(0 & 1) +/*member: binary11: +BinaryExpression(IntegerLiteral(0) & IntegerLiteral(1))*/ +void binary11() {} + +@Helper(0 ^ 1) +/*member: binary12: +BinaryExpression(IntegerLiteral(0) ^ IntegerLiteral(1))*/ +void binary12() {} + +@Helper(0 << 1) +/*member: binary13: +BinaryExpression(IntegerLiteral(0) << IntegerLiteral(1))*/ +void binary13() {} + +@Helper(0 >> 1) +/*member: binary14: +BinaryExpression(IntegerLiteral(0) >> IntegerLiteral(1))*/ +void binary14() {} + +@Helper(0 >>> 1) +/*member: binary15: +BinaryExpression(IntegerLiteral(0) >>> IntegerLiteral(1))*/ +void binary15() {} + +@Helper(0 + 1) +/*member: binary16: +BinaryExpression(IntegerLiteral(0) + IntegerLiteral(1))*/ +void binary16() {} + +@Helper(0 - 1) +/*member: binary17: +BinaryExpression(IntegerLiteral(0) - IntegerLiteral(1))*/ +void binary17() {} + +@Helper(0 * 1) +/*member: binary18: +BinaryExpression(IntegerLiteral(0) * IntegerLiteral(1))*/ +void binary18() {} + +@Helper(0 / 1) +/*member: binary19: +BinaryExpression(IntegerLiteral(0) / IntegerLiteral(1))*/ +void binary19() {} + +@Helper(0 % 1) +/*member: binary20: +BinaryExpression(IntegerLiteral(0) % IntegerLiteral(1))*/ +void binary20() {} + +@Helper(0 ~/ 1) +/*member: binary21: +BinaryExpression(IntegerLiteral(0) ~/ IntegerLiteral(1))*/ +void binary21() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/conditional/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/conditional/main.dart new file mode 100644 index 000000000000..a36458f368d4 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/conditional/main.dart @@ -0,0 +1,36 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Helper { + const Helper(a); +} + +const bool constBool = true; + +@Helper(constBool ? 0 : 1) +/*member: conditional1: +ConditionalExpression( + StaticGet(constBool) + ? IntegerLiteral(0) + : IntegerLiteral(1))*/ +void conditional1() {} + +@Helper(bool.fromEnvironment('foo', defaultValue: true) + ? const String.fromEnvironment('bar', defaultValue: 'baz') + : int.fromEnvironment('boz', defaultValue: 42)) +/*member: conditional2: +ConditionalExpression( + ConstructorInvocation( + bool.fromEnvironment( + StringLiteral('foo'), + defaultValue: BooleanLiteral(true))) + ? ConstructorInvocation( + String.fromEnvironment( + StringLiteral('bar'), + defaultValue: StringLiteral('baz'))) + : ConstructorInvocation( + int.fromEnvironment( + StringLiteral('boz'), + defaultValue: IntegerLiteral(42))))*/ +void conditional2() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/constructor_invocation/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/constructor_invocation/main.dart new file mode 100644 index 000000000000..3d886608d018 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/constructor_invocation/main.dart @@ -0,0 +1,178 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'main.dart' as self; + +class Helper { + const Helper(a); +} + +class Class { + const Class([a]); + const Class.named({a, b}); + const Class.mixed(a, b, {c, d}); +} + +class GenericClass { + const GenericClass(); + const GenericClass.named({a, b}); +} + +@Helper(Class()) +/*member: constructorInvocations1: +ConstructorInvocation( + Class.new())*/ +void constructorInvocations1() {} + +@Helper(Class.new()) +/*member: constructorInvocations2: +ConstructorInvocation( + Class.new())*/ +void constructorInvocations2() {} + +@Helper(Class.named()) +/*member: constructorInvocations3: +ConstructorInvocation( + Class.named())*/ +void constructorInvocations3() {} + +@Helper(self.Class()) +/*member: constructorInvocations4: +ConstructorInvocation( + Class.new())*/ +void constructorInvocations4() {} + +@Helper(self.Class.new()) +/*member: constructorInvocations5: +ConstructorInvocation( + Class.new())*/ +void constructorInvocations5() {} + +@Helper(self.Class.named()) +/*member: constructorInvocations6: +ConstructorInvocation( + Class.named())*/ +void constructorInvocations6() {} + +@Helper(GenericClass()) +/*member: constructorInvocations7: +ConstructorInvocation( + GenericClass.new())*/ +void constructorInvocations7() {} + +@Helper(GenericClass()) +/*member: constructorInvocations8: +ConstructorInvocation( + GenericClass.new())*/ +void constructorInvocations8() {} + +@Helper(GenericClass.named()) +/*member: constructorInvocations10: +ConstructorInvocation( + GenericClass.named())*/ +void constructorInvocations10() {} + +@Helper(GenericClass.named()) +/*member: constructorInvocations11: +ConstructorInvocation( + GenericClass.named())*/ +void constructorInvocations11() {} + +@Helper(self.GenericClass.named()) +/*member: constructorInvocations12: +ConstructorInvocation( + GenericClass.named())*/ +void constructorInvocations12() {} + +@Helper(self + .GenericClass>.named()) +/*member: constructorInvocations13: +ConstructorInvocation( + GenericClass>.named())*/ +void constructorInvocations13() {} + +@Helper(const Class()) +/*member: constructorInvocations14: +ConstructorInvocation( + Class.new())*/ +void constructorInvocations14() {} + +@Helper(const Class.new()) +/*member: constructorInvocations15: +ConstructorInvocation( + Class.new())*/ +void constructorInvocations15() {} + +@Helper(const Class.named()) +/*member: constructorInvocations16: +ConstructorInvocation( + Class.named())*/ +void constructorInvocations16() {} + +@Helper(const self.Class()) +/*member: constructorInvocations17: +ConstructorInvocation( + Class.new())*/ +void constructorInvocations17() {} + +@Helper(const self.Class.new()) +/*member: constructorInvocations18: +ConstructorInvocation( + Class.new())*/ +void constructorInvocations18() {} + +@Helper(const self.Class.named()) +/*member: constructorInvocations19: +ConstructorInvocation( + Class.named())*/ +void constructorInvocations19() {} + +@Helper(const GenericClass()) +/*member: constructorInvocations20: +ConstructorInvocation( + GenericClass.new())*/ +void constructorInvocations20() {} + +@Helper(const GenericClass.new()) +/*member: constructorInvocations21: +ConstructorInvocation( + GenericClass.new())*/ +void constructorInvocations21() {} + +@Helper(const GenericClass()) +/*member: constructorInvocations22: +ConstructorInvocation( + GenericClass.new())*/ +void constructorInvocations22() {} + +@Helper(const GenericClass.new()) +/*member: constructorInvocations23: +ConstructorInvocation( + GenericClass.new())*/ +void constructorInvocations23() {} + +@Helper(const GenericClass.named()) +/*member: constructorInvocations24: +ConstructorInvocation( + GenericClass.named())*/ +void constructorInvocations24() {} + +@Helper(const GenericClass.named()) +/*member: constructorInvocations25: +ConstructorInvocation( + GenericClass.named())*/ +void constructorInvocations25() {} + +@Helper(const self.GenericClass.named()) +/*member: constructorInvocations26: +ConstructorInvocation( + GenericClass.named())*/ +void constructorInvocations26() {} + +@Helper(const self + .GenericClass>.named()) +/*member: constructorInvocations27: +ConstructorInvocation( + GenericClass>.named())*/ +void constructorInvocations27() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/extension/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/extension/main.dart new file mode 100644 index 000000000000..36993558d68e --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/extension/main.dart @@ -0,0 +1,77 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'main.dart' as self; + +class Helper { + const Helper(a); +} + +extension Extension on int { + static const variable = 0; + + static void method() {} + + static void genericMethod() {} +} + +@Extension.variable +/*member: extensionConstant1: +StaticGet(variable)*/ +void extensionConstant1() {} + +@self.Extension.variable +/*member: extensionConstant2: +StaticGet(variable)*/ +void extensionConstant2() {} + +@Extension.unresolved +/*member: extensionConstant3: +UnresolvedExpression(UnresolvedAccess( + ExtensionProto(Extension).unresolved))*/ +void extensionConstant3() {} + +@self.Extension.unresolved +/*member: extensionConstant4: +UnresolvedExpression(UnresolvedAccess( + ExtensionProto(Extension).unresolved))*/ +void extensionConstant4() {} + +@Helper(Extension.method) +/*member: extensionConstant5: +FunctionTearOff(method)*/ +void extensionConstant5() {} + +@Helper(self.Extension.method) +/*member: extensionConstant6: +FunctionTearOff(method)*/ +void extensionConstant6() {} + +@Helper(Extension.genericMethod) +/*member: extensionConstant7: +FunctionTearOff(genericMethod)*/ +void extensionConstant7() {} + +@Helper(self.Extension.genericMethod) +/*member: extensionConstant8: +FunctionTearOff(genericMethod)*/ +void extensionConstant8() {} + +@Helper(Extension.genericMethod) +/*member: extensionConstant9: +Instantiation(FunctionTearOff(genericMethod))*/ +void extensionConstant9() {} + +@Helper(self.Extension.genericMethod) +/*member: extensionConstant10: +Instantiation(FunctionTearOff(genericMethod))*/ +void extensionConstant10() {} + +@Helper(Extension.unresolved) +/*member: extensionConstant11: +UnresolvedExpression(UnresolvedInstantiate( + UnresolvedAccess( + ExtensionProto(Extension).unresolved)))*/ +void extensionConstant11() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/invocation/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/invocation/main.dart new file mode 100644 index 000000000000..4f17f6ff37e3 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/invocation/main.dart @@ -0,0 +1,26 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:core'; +import 'dart:core' as core; + +class Helper { + const Helper(a); +} + +@Helper(identical(0, 1)) +/*member: invocation1: +StaticInvocation( + identical( + IntegerLiteral(0), + IntegerLiteral(1)))*/ +void invocation1() {} + +@Helper(core.identical(0, 1)) +/*member: invocation2: +StaticInvocation( + identical( + IntegerLiteral(0), + IntegerLiteral(1)))*/ +void invocation2() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/is_as/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/is_as/main.dart new file mode 100644 index 000000000000..738ec3eed245 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/is_as/main.dart @@ -0,0 +1,22 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Helper { + const Helper(a); +} + +@Helper(0 is int) +/*member: isAs1: +IsTest(IntegerLiteral(0) is int)*/ +void isAs1() {} + +@Helper(0 is! String) +/*member: isAs2: +IsTest(IntegerLiteral(0) is! String)*/ +void isAs2() {} + +@Helper(0 as int) +/*member: isAs3: +AsExpression(IntegerLiteral(0) as int)*/ +void isAs3() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/list_literal/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/list_literal/main.dart new file mode 100644 index 000000000000..1cd8bd849aa5 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/list_literal/main.dart @@ -0,0 +1,158 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Helper { + const Helper(a); +} + +const bool constBool = true; + +const List constList = []; + +const List? constNullableList = []; + +@Helper([]) +/*member: listLiterals1: +ListLiteral([])*/ +void listLiterals1() {} + +@Helper([0]) +/*member: listLiterals2: +ListLiteral([ExpressionElement(IntegerLiteral(0))])*/ +void listLiterals2() {} + +@Helper([0, 1]) +/*member: listLiterals3: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1))])*/ +void listLiterals3() {} + +@Helper([0, 1, 2]) +/*member: listLiterals4: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(IntegerLiteral(2))])*/ +void listLiterals4() {} + +@Helper([]) +/*member: listLiterals5: +ListLiteral([])*/ +void listLiterals5() {} + +@Helper([0]) +/*member: listLiterals6: +ListLiteral([ExpressionElement(IntegerLiteral(0))])*/ +void listLiterals6() {} + +@Helper([0, 1]) +/*member: listLiterals7: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1))])*/ +void listLiterals7() {} + +@Helper([0, 1, 2]) +/*member: listLiterals8: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(IntegerLiteral(2))])*/ +void listLiterals8() {} + +@Helper([0, 1, ...[]]) +/*member: listLiterals9: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + SpreadElement(...ListLiteral([]))])*/ +void listLiterals9() {} + +@Helper([0, 1, ...constList]) +/*member: listLiterals10: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + SpreadElement(...StaticGet(constList))])*/ +void listLiterals10() {} + +@Helper([0, 1, ...?constNullableList]) +/*member: listLiterals11: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + SpreadElement(?...StaticGet(constNullableList))])*/ +void listLiterals11() {} + +@Helper([0, 1, if (constBool) 2]) +/*member: listLiterals12: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + IfElement( + StaticGet(constBool), + ExpressionElement(IntegerLiteral(2)))])*/ +void listLiterals12() {} + +@Helper([0, 1, if (constBool) 2 else 3]) +/*member: listLiterals13: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + IfElement( + StaticGet(constBool), + ExpressionElement(IntegerLiteral(2)), + ExpressionElement(IntegerLiteral(3)))])*/ +void listLiterals13() {} + +@Helper(const []) +/*member: listLiterals14: +ListLiteral([])*/ +void listLiterals14() {} + +@Helper(const [0]) +/*member: listLiterals15: +ListLiteral([ExpressionElement(IntegerLiteral(0))])*/ +void listLiterals15() {} + +@Helper(const [0, 1]) +/*member: listLiterals16: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1))])*/ +void listLiterals16() {} + +@Helper(const [0, 1, 2]) +/*member: listLiterals17: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(IntegerLiteral(2))])*/ +void listLiterals17() {} + +@Helper(const []) +/*member: listLiterals18: +ListLiteral([])*/ +void listLiterals18() {} + +@Helper(const [0]) +/*member: listLiterals19: +ListLiteral([ExpressionElement(IntegerLiteral(0))])*/ +void listLiterals19() {} + +@Helper(const [0, 1]) +/*member: listLiterals20: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1))])*/ +void listLiterals20() {} + +@Helper(const [0, 1, 2]) +/*member: listLiterals21: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(IntegerLiteral(2))])*/ +void listLiterals21() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/literal/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/literal/main.dart new file mode 100644 index 000000000000..4b87b76b2079 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/literal/main.dart @@ -0,0 +1,93 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Helper { + const Helper(a); +} + +const String variable = ''; + +@Helper(0) +/*member: literal1: +IntegerLiteral(0)*/ +void literal1() {} + +@Helper(42.5) +/*member: literal2: +DoubleLiteral(42.5)*/ +void literal2() {} + +@Helper(0x42) +/*member: literal3: +IntegerLiteral(0x42)*/ +void literal3() {} + +@Helper(true) +/*member: literal4: +BooleanLiteral(true)*/ +void literal4() {} + +@Helper(false) +/*member: literal5: +BooleanLiteral(false)*/ +void literal5() {} + +@Helper(null) +/*member: literal6: +NullLiteral()*/ +void literal6() {} + +@Helper('a') +/*member: literal7: +StringLiteral('a')*/ +void literal7() {} + +@Helper('-$variable-') +/*member: literal8: +StringLiteral('-${StaticGet(variable)}-')*/ +void literal8() {} + +@Helper('a${0}b') +/*member: literal9: +StringLiteral('a${IntegerLiteral(0)}b')*/ +void literal9() {} + +@Helper('a' 'b') +/*member: literal10: +StringJuxtaposition( + StringLiteral('a') + StringLiteral('b'))*/ +void literal10() {} + +@Helper('a' 'b' 'c') +/*member: literal11: +StringJuxtaposition( + StringLiteral('a') + StringLiteral('b') + StringLiteral('c'))*/ +void literal11() {} + +@Helper('\t\n\f\r\b\u00A0') +/*member: literal12: +StringLiteral('\u0009\n\u000c\u000d\u0008\u00a0')*/ +void literal12() {} + +@Helper(r'$\') +/*member: literal13: +StringLiteral('\$\\')*/ +void literal13() {} + +@Helper(''' + +more lines + +''') +/*member: literal14: +StringLiteral('\nmore lines\n\n')*/ +void literal14() {} + +@Helper(#a) +/*member: literal15: +SymbolLiteral(a)*/ +void literal15() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/map_literal/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/map_literal/main.dart new file mode 100644 index 000000000000..8ce80a673732 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/map_literal/main.dart @@ -0,0 +1,162 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Helper { + const Helper(a); +} + +const bool constBool = true; + +const Map? constNullableMap = {}; + +@Helper({}) +/*member: mapLiterals1: +SetOrMapLiteral({})*/ +void mapLiterals1() {} + +@Helper({0: 0}) +/*member: mapLiterals2: +SetOrMapLiteral({MapEntryElement(IntegerLiteral(0):IntegerLiteral(0))})*/ +void mapLiterals2() {} + +@Helper({0: 0, 1: 1}) +/*member: mapLiterals3: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1))})*/ +void mapLiterals3() {} + +@Helper({0: 0, 1: 1, 2: 2}) +/*member: mapLiterals4: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + MapEntryElement(IntegerLiteral(2):IntegerLiteral(2))})*/ +void mapLiterals4() {} + +@Helper({}) +/*member: mapLiterals5: +SetOrMapLiteral({})*/ +void mapLiterals5() {} + +@Helper({0: 0}) +/*member: mapLiterals6: +SetOrMapLiteral({MapEntryElement(IntegerLiteral(0):IntegerLiteral(0))})*/ +void mapLiterals6() {} + +@Helper({0: 0, 1: 1}) +/*member: mapLiterals7: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1))})*/ +void mapLiterals7() {} + +@Helper({0: 0, 1: 1, 2: 2}) +/*member: mapLiterals8: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + MapEntryElement(IntegerLiteral(2):IntegerLiteral(2))})*/ +void mapLiterals8() {} + +@Helper({0: 0, 1: 1, ...{}}) +/*member: mapLiterals9: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + SpreadElement(...SetOrMapLiteral({}))})*/ +void mapLiterals9() {} + +@Helper({ + 0: 0, + 1: 1, + ...{2: 2, 3: 3} +}) +/*member: mapLiterals10: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + SpreadElement(...SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(2):IntegerLiteral(2)), + MapEntryElement(IntegerLiteral(3):IntegerLiteral(3))}))})*/ +void mapLiterals10() {} + +@Helper({0: 0, 1: 1, ...?constNullableMap}) +/*member: mapLiterals11: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + SpreadElement(?...StaticGet(constNullableMap))})*/ +void mapLiterals11() {} + +@Helper({0: 0, 1: 1, if (constBool) 2: 2}) +/*member: mapLiterals12: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + IfElement( + StaticGet(constBool), + MapEntryElement(IntegerLiteral(2):IntegerLiteral(2)))})*/ +void mapLiterals12() {} + +@Helper({0: 0, 1: 1, if (constBool) 2: 2 else 3: 3}) +/*member: mapLiterals13: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + IfElement( + StaticGet(constBool), + MapEntryElement(IntegerLiteral(2):IntegerLiteral(2)), + MapEntryElement(IntegerLiteral(3):IntegerLiteral(3)))})*/ +void mapLiterals13() {} + +@Helper(const {}) +/*member: mapLiterals14: +SetOrMapLiteral({})*/ +void mapLiterals14() {} + +@Helper(const {0: 0}) +/*member: mapLiterals15: +SetOrMapLiteral({MapEntryElement(IntegerLiteral(0):IntegerLiteral(0))})*/ +void mapLiterals15() {} + +@Helper(const {0: 0, 1: 1}) +/*member: mapLiterals16: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1))})*/ +void mapLiterals16() {} + +@Helper(const {0: 0, 1: 1, 2: 2}) +/*member: mapLiterals17: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + MapEntryElement(IntegerLiteral(2):IntegerLiteral(2))})*/ +void mapLiterals17() {} + +@Helper(const {}) +/*member: mapLiterals18: +SetOrMapLiteral({})*/ +void mapLiterals18() {} + +@Helper(const {0: 0}) +/*member: mapLiterals19: +SetOrMapLiteral({MapEntryElement(IntegerLiteral(0):IntegerLiteral(0))})*/ +void mapLiterals19() {} + +@Helper(const {0: 0, 1: 1}) +/*member: mapLiterals20: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1))})*/ +void mapLiterals20() {} + +@Helper(const {0: 0, 1: 1, 2: 2}) +/*member: mapLiterals21: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + MapEntryElement(IntegerLiteral(2):IntegerLiteral(2))})*/ +void mapLiterals21() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/marker.options b/pkg/_fe_analyzer_shared/test/metadata/data/marker.options new file mode 100644 index 000000000000..665338dc921f --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/marker.options @@ -0,0 +1,3 @@ +cfe=pkg/front_end/test/id_tests/metadata_test.dart +analyzer=pkg/analyzer/test/id_tests/metadata_test.dart + diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/null_aware_access/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/null_aware_access/main.dart new file mode 100644 index 000000000000..a3678489e447 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/null_aware_access/main.dart @@ -0,0 +1,14 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Helper { + const Helper(a); +} + +const String? constNullableString = ''; + +@Helper(constNullableString?.length) +/*member: nullAwareAccess1: +NullAwarePropertyGet(StaticGet(constNullableString)?.length)*/ +void nullAwareAccess1() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/null_check/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/null_check/main.dart new file mode 100644 index 000000000000..c110abe9668e --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/null_check/main.dart @@ -0,0 +1,14 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Helper { + const Helper(a); +} + +const List? constNullableList = []; + +@Helper(constNullableList!) +/*member: nullCheck1: +NullCheck(StaticGet(constNullableList))*/ +void nullCheck1() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/parenthesized/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/parenthesized/main.dart new file mode 100644 index 000000000000..0b87d8f6b88c --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/parenthesized/main.dart @@ -0,0 +1,24 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Helper { + const Helper(a); +} + +T genericFunction(T t) => t; + +@Helper((0)) +/*member: parenthesized1: +ParenthesizedExpression(IntegerLiteral(0))*/ +void parenthesized1() {} + +@Helper(('').length) +/*member: parenthesized2: +PropertyGet(ParenthesizedExpression(StringLiteral('')).length)*/ +void parenthesized2() {} + +@Helper((genericFunction)) +/*member: parenthesized3: +Instantiation(ParenthesizedExpression(FunctionTearOff(genericFunction)))*/ +void parenthesized3() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/record_literal/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/record_literal/main.dart new file mode 100644 index 000000000000..b858b35d9323 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/record_literal/main.dart @@ -0,0 +1,57 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Helper { + const Helper(a); +} + +@Helper(()) +/*member: recordLiterals1: +RecordLiteral()*/ +void recordLiterals1() {} + +@Helper((0,)) +/*member: recordLiterals2: +RecordLiteral(IntegerLiteral(0))*/ +void recordLiterals2() {} + +@Helper((0, 1)) +/*member: recordLiterals3: +RecordLiteral(IntegerLiteral(0), IntegerLiteral(1))*/ +void recordLiterals3() {} + +@Helper((a: 0, 1)) +/*member: recordLiterals4: +RecordLiteral(a: IntegerLiteral(0), IntegerLiteral(1))*/ +void recordLiterals4() {} + +@Helper((0, b: 1)) +/*member: recordLiterals5: +RecordLiteral(IntegerLiteral(0), b: IntegerLiteral(1))*/ +void recordLiterals5() {} + +@Helper(const ()) +/*member: recordLiterals6: +RecordLiteral()*/ +void recordLiterals6() {} + +@Helper(const (0,)) +/*member: recordLiterals7: +RecordLiteral(IntegerLiteral(0))*/ +void recordLiterals7() {} + +@Helper(const (0, 1)) +/*member: recordLiterals8: +RecordLiteral(IntegerLiteral(0), IntegerLiteral(1))*/ +void recordLiterals8() {} + +@Helper(const (a: 0, 1)) +/*member: recordLiterals9: +RecordLiteral(a: IntegerLiteral(0), IntegerLiteral(1))*/ +void recordLiterals9() {} + +@Helper(const (0, b: 1)) +/*member: recordLiterals10: +RecordLiteral(IntegerLiteral(0), b: IntegerLiteral(1))*/ +void recordLiterals10() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/set_literal/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/set_literal/main.dart new file mode 100644 index 000000000000..ae30eedcde22 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/set_literal/main.dart @@ -0,0 +1,148 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Helper { + const Helper(a); +} + +const bool constBool = true; + +const List constList = []; + +const List? constNullableList = []; + +@Helper({0}) +/*member: setLiterals1: +SetOrMapLiteral({ExpressionElement(IntegerLiteral(0))})*/ +void setLiterals1() {} + +@Helper({0, 1}) +/*member: setLiterals2: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1))})*/ +void setLiterals2() {} + +@Helper({0, 1, 2}) +/*member: setLiterals3: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(IntegerLiteral(2))})*/ +void setLiterals3() {} + +@Helper({}) +/*member: setLiterals4: +SetOrMapLiteral({})*/ +void setLiterals4() {} + +@Helper({0}) +/*member: setLiterals5: +SetOrMapLiteral({ExpressionElement(IntegerLiteral(0))})*/ +void setLiterals5() {} + +@Helper({0, 1}) +/*member: setLiterals6: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1))})*/ +void setLiterals6() {} + +@Helper({0, 1, 2}) +/*member: setLiterals7: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(IntegerLiteral(2))})*/ +void setLiterals7() {} + +@Helper({0, 1, ...[]}) +/*member: setLiterals8: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + SpreadElement(...ListLiteral([]))})*/ +void setLiterals8() {} + +@Helper({0, 1, ...constList}) +/*member: setLiterals9: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + SpreadElement(...StaticGet(constList))})*/ +void setLiterals9() {} + +@Helper({0, 1, ...?constNullableList}) +/*member: setLiterals10: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + SpreadElement(?...StaticGet(constNullableList))})*/ +void setLiterals10() {} + +@Helper({0, 1, if (constBool) 2}) +/*member: setLiterals11: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + IfElement( + StaticGet(constBool), + ExpressionElement(IntegerLiteral(2)))})*/ +void setLiterals11() {} + +@Helper({0, 1, if (constBool) 2 else 3}) +/*member: setLiterals12: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + IfElement( + StaticGet(constBool), + ExpressionElement(IntegerLiteral(2)), + ExpressionElement(IntegerLiteral(3)))})*/ +void setLiterals12() {} + +@Helper(const {0}) +/*member: setLiterals13: +SetOrMapLiteral({ExpressionElement(IntegerLiteral(0))})*/ +void setLiterals13() {} + +@Helper(const {0, 1}) +/*member: setLiterals14: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1))})*/ +void setLiterals14() {} + +@Helper(const {0, 1, 2}) +/*member: setLiterals15: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(IntegerLiteral(2))})*/ +void setLiterals15() {} + +@Helper(const {}) +/*member: setLiterals16: +SetOrMapLiteral({})*/ +void setLiterals16() {} + +@Helper(const {0}) +/*member: setLiterals17: +SetOrMapLiteral({ExpressionElement(IntegerLiteral(0))})*/ +void setLiterals17() {} + +@Helper(const {0, 1}) +/*member: setLiterals18: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1))})*/ +void setLiterals18() {} + +@Helper(const {0, 1, 2}) +/*member: setLiterals19: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(IntegerLiteral(2))})*/ +void setLiterals19() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/type/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/type/main.dart new file mode 100644 index 000000000000..6f1113cf2397 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/type/main.dart @@ -0,0 +1,153 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'dart:core'; +import 'dart:core' as core; +import 'main.dart' as self; + +class Helper { + const Helper(a); +} + +class Class { + const Class([a]); + const Class.named({a, b}); +} + +class GenericClass { + const GenericClass(); + const GenericClass.named({a, b}); +} + +typedef Alias = Class; +typedef ComplexAlias = Class; +typedef GenericAlias = GenericClass; + +@GenericClass() +/*member: type1: +ConstructorInvocation( + GenericClass.new())*/ +void type1() {} + +@GenericClass>() +/*member: type2: +ConstructorInvocation( + GenericClass>.new())*/ +void type2() {} + +@GenericClass() +/*member: type3: +ConstructorInvocation( + GenericClass.new())*/ +void type3() {} + +@GenericClass() +/*member: type4: +ConstructorInvocation( + GenericClass.new())*/ +void type4() {} + +@GenericClass() +/*member: type5: +ConstructorInvocation( + GenericClass.new())*/ +void type5() {} + +@GenericClass() +/*member: type6: +ConstructorInvocation( + GenericClass.new())*/ +void type6() {} + +@GenericClass(T), S Function(T)>() +/*member: type7: +ConstructorInvocation( + GenericClass.new())*/ +void type7() {} + +@GenericClass(T), + S Function(T)>() +/*member: type8: +ConstructorInvocation( + GenericClass.new())*/ +void type8() {} + +// TODO(johnniwinther): Support this. +//@GenericClass(T), +// S Function, T extends S>(T)>() +//void type9() {} + +@GenericClass<(), (int,)>() +/*member: type10: +ConstructorInvocation( + GenericClass<(),(int,)>.new())*/ +void type10() {} + +@GenericClass<(int, {int a}), ({int a, String b})>() +/*member: type11: +ConstructorInvocation( + GenericClass<(int, {int a}),({int a, String b})>.new())*/ +void type11() {} + +@Helper(Alias()) +/*member: type12: +ConstructorInvocation( + Alias.new())*/ +void type12() {} + +@Helper(Alias.named()) +/*member: type13: +ConstructorInvocation( + Alias.named())*/ +void type13() {} + +@Helper(ComplexAlias()) +/*member: type14: +ConstructorInvocation( + ComplexAlias.new())*/ +void type14() {} + +@Helper(ComplexAlias.named()) +/*member: type15: +ConstructorInvocation( + ComplexAlias.named())*/ +void type15() {} + +@Helper(ComplexAlias()) +/*member: type16: +ConstructorInvocation( + ComplexAlias.new())*/ +void type16() {} + +@Helper(ComplexAlias.named()) +/*member: type17: +ConstructorInvocation( + ComplexAlias.named())*/ +void type17() {} + +@Helper(GenericAlias()) +/*member: type18: +ConstructorInvocation( + GenericAlias.new())*/ +void type18() {} + +@Helper(GenericAlias.named()) +/*member: type19: +ConstructorInvocation( + GenericAlias.named())*/ +void type19() {} + +@Helper(GenericAlias()) +/*member: type21: +ConstructorInvocation( + GenericAlias.new())*/ +void type21() {} + +@Helper(GenericAlias.named()) +/*member: type22: +ConstructorInvocation( + GenericAlias.named())*/ +void type22() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/type_argument_application/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/type_argument_application/main.dart new file mode 100644 index 000000000000..e77eb9ebdecf --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/type_argument_application/main.dart @@ -0,0 +1,98 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; +import 'main.dart' as self; + +class Helper { + const Helper(a); +} + +T genericFunction(T t) => t; + +const T Function(T t) genericFunctionAlias = genericFunction; + +class Class { + const Class([a]); + const Class.named({a, b}); +} + +class GenericClass { + const GenericClass(); + const GenericClass.named({a, b}); + + static T genericMethod(T t) => t; + + static const T Function(T t) genericMethodAlias = genericMethod; +} + +@Helper(genericFunctionAlias) +/*member: typeArgumentApplications1: +Instantiation(StaticGet(genericFunctionAlias))*/ +void typeArgumentApplications1() {} + +@Helper(genericFunction) +/*member: typeArgumentApplications2: +Instantiation(FunctionTearOff(genericFunction))*/ +void typeArgumentApplications2() {} + +@Helper(GenericClass) +/*member: typeArgumentApplications3: +NullAwarePropertyGet(GenericClass)*/ +void typeArgumentApplications3() {} + +@Helper(GenericClass.new) +/*member: typeArgumentApplications4: +ConstructorTearOff(GenericClass.new)*/ +void typeArgumentApplications4() {} + +@Helper(GenericClass.named) +/*member: typeArgumentApplications5: +ConstructorTearOff(GenericClass.named)*/ +void typeArgumentApplications5() {} + +@Helper(GenericClass.genericMethodAlias) +/*member: typeArgumentApplications6: +Instantiation(StaticGet(genericMethodAlias))*/ +void typeArgumentApplications6() {} + +@Helper(GenericClass.genericMethod) +/*member: typeArgumentApplications7: +Instantiation(FunctionTearOff(genericMethod))*/ +void typeArgumentApplications7() {} + +@Helper(self.genericFunctionAlias) +/*member: typeArgumentApplications8: +Instantiation(StaticGet(genericFunctionAlias))*/ +void typeArgumentApplications8() {} + +@Helper(self.genericFunction) +/*member: typeArgumentApplications9: +Instantiation(FunctionTearOff(genericFunction))*/ +void typeArgumentApplications9() {} + +@Helper(self.GenericClass) +/*member: typeArgumentApplications10: +NullAwarePropertyGet(GenericClass)*/ +void typeArgumentApplications10() {} + +@Helper(self.GenericClass.new) +/*member: typeArgumentApplications11: +ConstructorTearOff(GenericClass.new)*/ +void typeArgumentApplications11() {} + +@Helper(self.GenericClass.named) +/*member: typeArgumentApplications12: +ConstructorTearOff(GenericClass.named)*/ +void typeArgumentApplications12() {} + +@Helper(self.GenericClass.genericMethodAlias) +/*member: typeArgumentApplications13: +Instantiation(StaticGet(genericMethodAlias))*/ +void typeArgumentApplications13() {} + +@Helper(self.GenericClass.genericMethod) +/*member: typeArgumentApplications14: +Instantiation(FunctionTearOff(genericMethod))*/ +void typeArgumentApplications14() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/unary/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/unary/main.dart new file mode 100644 index 000000000000..03801d72b5b3 --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/unary/main.dart @@ -0,0 +1,26 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +class Helper { + const Helper(a); +} + +const bool constBool = true; + +const int constInt = 42; + +@Helper(-constInt) +/*member: unary1: +UnaryExpression(-StaticGet(constInt))*/ +void unary1() {} + +@Helper(!constBool) +/*member: unary2: +UnaryExpression(!StaticGet(constBool))*/ +void unary2() {} + +@Helper(~constInt) +/*member: unary3: +UnaryExpression(~StaticGet(constInt))*/ +void unary3() {} diff --git a/pkg/_fe_analyzer_shared/test/metadata/data/unresolved/main.dart b/pkg/_fe_analyzer_shared/test/metadata/data/unresolved/main.dart new file mode 100644 index 000000000000..af21c2aa914b --- /dev/null +++ b/pkg/_fe_analyzer_shared/test/metadata/data/unresolved/main.dart @@ -0,0 +1,1311 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:core'; +import 'dart:core' as core; +import 'main.dart' as self; + +class Helper { + const Helper(a); +} + +// Annotations work if a macro that generates these: +// +// const String variable = ''; +// +// const bool constBool = true; +// +// const int constInt = 42; +// +// const String? constNullableString = ''; +// +// const List constList = []; +// +// const List? constNullableList = []; +// +// const Map? constNullableMap = {}; +// +// T genericFunction(T t) => t; +// +// const T Function(T t) genericFunctionAlias = genericFunction; +// +// void function() {} +// +// class UnresolvedClass { +// const UnresolvedClass(); +// } +// +// class UnresolvedGenericClass { +// const UnresolvedGenericClass(); +// } + +class LateDefaultConstructorClass { + // Annotations work if a macro that generates this: + // + // const LateDefaultConstructorClass(); + // + const LateDefaultConstructorClass.named(); +} + +class Class { + const Class([a]); + // Annotations work if a macro that generates these: + // + // const Class.named({a, b}); + // const Class.mixed(a, b, {c, d}); + // + // static const String field = ''; + // + // static void method() {} +} + +class GenericClass { + const GenericClass(); + // Annotations work if a macro that generates these: + // + // const GenericClass.named({a, b}); + // + // static T genericMethod(T t) => t; + // + // static const T Function(T t) genericMethodAlias = genericMethod; +} + +@variable +/*member: metadataAnnotations1: +UnresolvedExpression(UnresolvedIdentifier(variable))*/ +void metadataAnnotations1() {} + +@function +/*member: metadataAnnotations2: +UnresolvedExpression(UnresolvedIdentifier(function))*/ +void metadataAnnotations2() {} + +@self.variable +/*member: metadataAnnotations3: +UnresolvedExpression(UnresolvedIdentifier(variable))*/ +void metadataAnnotations3() {} + +@self.function +/*member: metadataAnnotations4: +UnresolvedExpression(UnresolvedIdentifier(function))*/ +void metadataAnnotations4() {} + +@LateDefaultConstructorClass() +/*member: metadataAnnotations5: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).) + ()))*/ +void metadataAnnotations5() {} + +@Class.named() +/*member: metadataAnnotations6: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).named) + ()))*/ +void metadataAnnotations6() {} + +@Class.named(a: 0) +/*member: metadataAnnotations7: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).named) + (a: IntegerLiteral(0))))*/ +void metadataAnnotations7() {} + +@Class.named(b: 1) +/*member: metadataAnnotations8: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).named) + (b: IntegerLiteral(1))))*/ +void metadataAnnotations8() {} + +@Class.named(a: 0, b: 1) +/*member: metadataAnnotations9: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).named) + ( + a: IntegerLiteral(0), + b: IntegerLiteral(1))))*/ +void metadataAnnotations9() {} + +@Class.mixed(0, 1) +/*member: metadataAnnotations10: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).mixed) + ( + IntegerLiteral(0), + IntegerLiteral(1))))*/ +void metadataAnnotations10() {} + +@Class.mixed(0, 1, c: 2) +/*member: metadataAnnotations11: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).mixed) + ( + IntegerLiteral(0), + IntegerLiteral(1), + c: IntegerLiteral(2))))*/ +void metadataAnnotations11() {} + +@Class.mixed(0, 1, c: 2, d: 3) +/*member: metadataAnnotations12: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).mixed) + ( + IntegerLiteral(0), + IntegerLiteral(1), + c: IntegerLiteral(2), + d: IntegerLiteral(3))))*/ +void metadataAnnotations12() {} + +@Class.mixed(0, 1, d: 3) +/*member: metadataAnnotations13: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).mixed) + ( + IntegerLiteral(0), + IntegerLiteral(1), + d: IntegerLiteral(3))))*/ +void metadataAnnotations13() {} + +@Class.mixed(d: 3, 0, c: 2, 1) +/*member: metadataAnnotations14: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).mixed) + ( + d: IntegerLiteral(3), + IntegerLiteral(0), + c: IntegerLiteral(2), + IntegerLiteral(1))))*/ +void metadataAnnotations14() {} + +@self.LateDefaultConstructorClass() +/*member: metadataAnnotations15: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).) + ()))*/ +void metadataAnnotations15() {} + +@self.Class.named() +/*member: metadataAnnotations16: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).named) + ()))*/ +void metadataAnnotations16() {} + +@LateDefaultConstructorClass() +/*member: metadataAnnotations17: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).) + ()))*/ +void metadataAnnotations17() {} + +@LateDefaultConstructorClass() +/*member: metadataAnnotations18: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + GenericClassProto(LateDefaultConstructorClass).) + ()))*/ +void metadataAnnotations18() {} + +@UnresolvedGenericClass() +/*member: metadataAnnotations19: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedInstantiate( + UnresolvedIdentifier(UnresolvedGenericClass)) + ()))*/ +void metadataAnnotations19() {} + +@GenericClass.named() +/*member: metadataAnnotations20: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(GenericClass).named) + ()))*/ +void metadataAnnotations20() {} + +@GenericClass.named() +/*member: metadataAnnotations21: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + GenericClassProto(GenericClass).named) + ()))*/ +void metadataAnnotations21() {} + +@self.GenericClass.named() +/*member: metadataAnnotations22: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(GenericClass).named) + ()))*/ +void metadataAnnotations22() {} + +@self.GenericClass>.named() +/*member: metadataAnnotations23: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + GenericClassProto(GenericClass>).named) + ()))*/ +void metadataAnnotations23() {} + +@Helper('-$variable-') +/*member: literals1: +StringLiteral('-${UnresolvedExpression(UnresolvedIdentifier(variable))}-')*/ +void literals1() {} + +@Helper('a${constInt}b') +/*member: literals2: +StringLiteral('a${UnresolvedExpression(UnresolvedIdentifier(constInt))}b')*/ +void literals2() {} + +@Helper('a' 'b${constInt}' 'c') +/*member: literals3: +StringJuxtaposition( + StringLiteral('a') + StringLiteral('b${UnresolvedExpression(UnresolvedIdentifier(constInt))}') + StringLiteral('c'))*/ +void literals3() {} + +@Helper(variable) +/*member: access1: +UnresolvedExpression(UnresolvedIdentifier(variable))*/ +void access1() {} + +@Helper(variable.length) +/*member: access2: +UnresolvedExpression(UnresolvedAccess( + UnresolvedIdentifier(variable).length))*/ +void access2() {} + +@Helper(function) +/*member: access3: +UnresolvedExpression(UnresolvedIdentifier(function))*/ +void access3() {} + +@Helper(UnresolvedClass) +/*member: access4: +UnresolvedExpression(UnresolvedIdentifier(UnresolvedClass))*/ +void access4() {} + +@Helper(LateDefaultConstructorClass.new) +/*member: access5: +UnresolvedExpression(UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).))*/ +void access5() {} + +@Helper(Class.named) +/*member: access6: +UnresolvedExpression(UnresolvedAccess( + ClassProto(Class).named))*/ +void access6() {} + +@Helper(Class.field) +/*member: access7: +UnresolvedExpression(UnresolvedAccess( + ClassProto(Class).field))*/ +void access7() {} + +@Helper(Class.field.length) +/*member: access8: +UnresolvedExpression(UnresolvedAccess( + UnresolvedAccess( + ClassProto(Class).field).length))*/ +void access8() {} + +@Helper(Class.method) +/*member: access9: +UnresolvedExpression(UnresolvedAccess( + ClassProto(Class).method))*/ +void access9() {} + +@Helper(self.variable) +/*member: access10: +UnresolvedExpression(UnresolvedIdentifier(variable))*/ +void access10() {} + +@Helper(self.variable.length) +/*member: access11: +UnresolvedExpression(UnresolvedAccess( + UnresolvedIdentifier(variable).length))*/ +void access11() {} + +@Helper(self.function) +/*member: access12: +UnresolvedExpression(UnresolvedIdentifier(function))*/ +void access12() {} + +@Helper(self.UnresolvedClass) +/*member: access13: +UnresolvedExpression(UnresolvedIdentifier(UnresolvedClass))*/ +void access13() {} + +@Helper(self.LateDefaultConstructorClass.new) +/*member: access14: +UnresolvedExpression(UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).))*/ +void access14() {} + +@Helper(self.Class.named) +/*member: access15: +UnresolvedExpression(UnresolvedAccess( + ClassProto(Class).named))*/ +void access15() {} + +@Helper(self.Class.field) +/*member: access16: +UnresolvedExpression(UnresolvedAccess( + ClassProto(Class).field))*/ +void access16() {} + +@Helper(self.Class.field.length) +/*member: access17: +UnresolvedExpression(UnresolvedAccess( + UnresolvedAccess( + ClassProto(Class).field).length))*/ +void access17() {} + +@Helper(self.Class.method) +/*member: access18: +UnresolvedExpression(UnresolvedAccess( + ClassProto(Class).method))*/ +void access18() {} + +@Helper(genericFunctionAlias) +/*member: typeArgumentApplications1: +UnresolvedExpression(UnresolvedInstantiate( + UnresolvedIdentifier(genericFunctionAlias)))*/ +void typeArgumentApplications1() {} + +@Helper(genericFunction) +/*member: typeArgumentApplications2: +UnresolvedExpression(UnresolvedInstantiate( + UnresolvedIdentifier(genericFunction)))*/ +void typeArgumentApplications2() {} + +@Helper(UnresolvedGenericClass) +/*member: typeArgumentApplications3: +UnresolvedExpression(UnresolvedInstantiate( + UnresolvedIdentifier(UnresolvedGenericClass)))*/ +void typeArgumentApplications3() {} + +@Helper(LateDefaultConstructorClass.new) +/*member: typeArgumentApplications4: +UnresolvedExpression(UnresolvedAccess( + GenericClassProto(LateDefaultConstructorClass).))*/ +void typeArgumentApplications4() {} + +@Helper(GenericClass.named) +/*member: typeArgumentApplications5: +UnresolvedExpression(UnresolvedAccess( + GenericClassProto(GenericClass).named))*/ +void typeArgumentApplications5() {} + +@Helper(GenericClass.genericMethodAlias) +/*member: typeArgumentApplications6: +UnresolvedExpression(UnresolvedInstantiate( + UnresolvedAccess( + ClassProto(GenericClass).genericMethodAlias)))*/ +void typeArgumentApplications6() {} + +@Helper(GenericClass.genericMethod) +/*member: typeArgumentApplications7: +UnresolvedExpression(UnresolvedInstantiate( + UnresolvedAccess( + ClassProto(GenericClass).genericMethod)))*/ +void typeArgumentApplications7() {} + +@Helper(self.genericFunctionAlias) +/*member: typeArgumentApplications8: +UnresolvedExpression(UnresolvedInstantiate( + UnresolvedIdentifier(genericFunctionAlias)))*/ +void typeArgumentApplications8() {} + +@Helper(self.genericFunction) +/*member: typeArgumentApplications9: +UnresolvedExpression(UnresolvedInstantiate( + UnresolvedIdentifier(genericFunction)))*/ +void typeArgumentApplications9() {} + +@Helper(self.UnresolvedGenericClass) +/*member: typeArgumentApplications10: +UnresolvedExpression(UnresolvedInstantiate( + UnresolvedIdentifier(UnresolvedGenericClass)))*/ +void typeArgumentApplications10() {} + +@Helper(self.LateDefaultConstructorClass.new) +/*member: typeArgumentApplications11: +UnresolvedExpression(UnresolvedAccess( + GenericClassProto(LateDefaultConstructorClass).))*/ +void typeArgumentApplications11() {} + +@Helper(self.GenericClass.named) +/*member: typeArgumentApplications12: +UnresolvedExpression(UnresolvedAccess( + GenericClassProto(GenericClass).named))*/ +void typeArgumentApplications12() {} + +@Helper(self.GenericClass.genericMethodAlias) +/*member: typeArgumentApplications13: +UnresolvedExpression(UnresolvedInstantiate( + UnresolvedAccess( + ClassProto(GenericClass).genericMethodAlias)))*/ +void typeArgumentApplications13() {} + +@Helper(self.GenericClass.genericMethod) +/*member: typeArgumentApplications14: +UnresolvedExpression(UnresolvedInstantiate( + UnresolvedAccess( + ClassProto(GenericClass).genericMethod)))*/ +void typeArgumentApplications14() {} + +@Helper(LateDefaultConstructorClass()) +/*member: constructorInvocations1: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).) + ()))*/ +void constructorInvocations1() {} + +@Helper(LateDefaultConstructorClass.new()) +/*member: constructorInvocations2: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).) + ()))*/ +void constructorInvocations2() {} + +@Helper(Class.named()) +/*member: constructorInvocations3: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).named) + ()))*/ +void constructorInvocations3() {} + +@Helper(self.LateDefaultConstructorClass()) +/*member: constructorInvocations4: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).) + ()))*/ +void constructorInvocations4() {} + +@Helper(self.LateDefaultConstructorClass.new()) +/*member: constructorInvocations5: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).) + ()))*/ +void constructorInvocations5() {} + +@Helper(self.Class.named()) +/*member: constructorInvocations6: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).named) + ()))*/ +void constructorInvocations6() {} + +@Helper(LateDefaultConstructorClass()) +/*member: constructorInvocations7: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + GenericClassProto(LateDefaultConstructorClass).) + ()))*/ +void constructorInvocations7() {} + +@Helper(GenericClass.named()) +/*member: constructorInvocations8: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(GenericClass).named) + ()))*/ +void constructorInvocations8() {} + +@Helper(GenericClass.named()) +/*member: constructorInvocations9: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + GenericClassProto(GenericClass).named) + ()))*/ +void constructorInvocations9() {} + +@Helper(self.GenericClass.named()) +/*member: constructorInvocations10: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(GenericClass).named) + ()))*/ +void constructorInvocations10() {} + +@Helper(self + .GenericClass>.named()) +/*member: constructorInvocations11: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + GenericClassProto(GenericClass>).named) + ()))*/ +void constructorInvocations11() {} + +@Helper(const LateDefaultConstructorClass()) +/*member: constructorInvocations12: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).) + ()))*/ +void constructorInvocations12() {} + +@Helper(const LateDefaultConstructorClass.new()) +/*member: constructorInvocations13: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).) + ()))*/ +void constructorInvocations13() {} + +@Helper(const Class.named()) +/*member: constructorInvocations14: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).named) + ()))*/ +void constructorInvocations14() {} + +@Helper(const self.LateDefaultConstructorClass()) +/*member: constructorInvocations15: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).) + ()))*/ +void constructorInvocations15() {} + +@Helper(const self.LateDefaultConstructorClass.new()) +/*member: constructorInvocations16: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(LateDefaultConstructorClass).) + ()))*/ +void constructorInvocations16() {} + +@Helper(const self.Class.named()) +/*member: constructorInvocations17: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(Class).named) + ()))*/ +void constructorInvocations17() {} + +@Helper(const LateDefaultConstructorClass()) +/*member: constructorInvocations18: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + GenericClassProto(LateDefaultConstructorClass).) + ()))*/ +void constructorInvocations18() {} + +@Helper(const LateDefaultConstructorClass.new()) +/*member: constructorInvocations19: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + GenericClassProto(LateDefaultConstructorClass).) + ()))*/ +void constructorInvocations19() {} + +@Helper(const GenericClass.named()) +/*member: constructorInvocations20: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(GenericClass).named) + ()))*/ +void constructorInvocations20() {} + +@Helper(const GenericClass.named()) +/*member: constructorInvocations21: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + GenericClassProto(GenericClass).named) + ()))*/ +void constructorInvocations21() {} + +@Helper(const self.GenericClass.named()) +/*member: constructorInvocations22: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + ClassProto(GenericClass).named) + ()))*/ +void constructorInvocations22() {} + +@Helper(const self + .GenericClass>.named()) +/*member: constructorInvocations23: +UnresolvedExpression(UnresolvedInvoke( + UnresolvedAccess( + GenericClassProto(GenericClass>).named) + ()))*/ +void constructorInvocations23() {} + +@Helper([constInt]) +/*member: listLiterals1: +ListLiteral([ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))])*/ +void listLiterals1() {} + +@Helper([0, constInt]) +/*member: listLiterals2: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))])*/ +void listLiterals2() {} + +@Helper([0, 1, constInt]) +/*member: listLiterals3: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))])*/ +void listLiterals3() {} + +@Helper([]) +/*member: listLiterals4: +ListLiteral(<<[])*/ +void listLiterals4() {} + +@Helper([constInt]) +/*member: listLiterals5: +ListLiteral([ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))])*/ +void listLiterals5() {} + +@Helper([0, constInt]) +/*member: listLiterals6: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))])*/ +void listLiterals6() {} + +@Helper([0, 1, constInt]) +/*member: listLiterals7: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))])*/ +void listLiterals7() {} + +@Helper([0, constInt, ...[]]) +/*member: listLiterals8: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt))), + SpreadElement(...ListLiteral([]))])*/ +void listLiterals8() {} + +@Helper([0, 1, ...constList]) +/*member: listLiterals9: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + SpreadElement(...UnresolvedExpression(UnresolvedIdentifier(constList)))])*/ +void listLiterals9() {} + +@Helper([0, 1, ...?constNullableList]) +/*member: listLiterals10: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + SpreadElement(?...UnresolvedExpression(UnresolvedIdentifier(constNullableList)))])*/ +void listLiterals10() {} + +@Helper([0, 1, if (constBool) 2]) +/*member: listLiterals11: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + IfElement( + UnresolvedExpression(UnresolvedIdentifier(constBool)), + ExpressionElement(IntegerLiteral(2)))])*/ +void listLiterals11() {} + +@Helper([0, 1, if (constBool) 2 else 3]) +/*member: listLiterals12: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + IfElement( + UnresolvedExpression(UnresolvedIdentifier(constBool)), + ExpressionElement(IntegerLiteral(2)), + ExpressionElement(IntegerLiteral(3)))])*/ +void listLiterals12() {} + +@Helper(const [constInt]) +/*member: listLiterals13: +ListLiteral([ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))])*/ +void listLiterals13() {} + +@Helper(const [0, constInt]) +/*member: listLiterals14: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))])*/ +void listLiterals14() {} + +@Helper(const [0, 1, constInt]) +/*member: listLiterals15: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))])*/ +void listLiterals15() {} + +@Helper(const []) +/*member: listLiterals16: +ListLiteral(<<[])*/ +void listLiterals16() {} + +@Helper(const [constInt]) +/*member: listLiterals17: +ListLiteral([ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))])*/ +void listLiterals17() {} + +@Helper(const [0, constInt]) +/*member: listLiterals18: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))])*/ +void listLiterals18() {} + +@Helper(const [0, 1, constInt]) +/*member: listLiterals19: +ListLiteral([ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))])*/ +void listLiterals19() {} + +@Helper({constInt}) +/*member: setLiteral1: +SetOrMapLiteral({ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void setLiteral1() {} + +@Helper({0, constInt}) +/*member: setLiterals2: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void setLiterals2() {} + +@Helper({0, 1, constInt}) +/*member: setLiterals3: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void setLiterals3() {} + +@Helper({}) +/*member: setLiterals4: +SetOrMapLiteral(<<{})*/ +void setLiterals4() {} + +@Helper({constInt}) +/*member: setLiterals5: +SetOrMapLiteral({ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void setLiterals5() {} + +@Helper({0, constInt}) +/*member: setLiterals6: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void setLiterals6() {} + +@Helper({0, 1, constInt}) +/*member: setLiterals7: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void setLiterals7() {} + +@Helper({0, constInt, ...[]}) +/*member: setLiterals8: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt))), + SpreadElement(...ListLiteral([]))})*/ +void setLiterals8() {} + +@Helper({0, 1, ...constList}) +/*member: setLiterals9: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + SpreadElement(...UnresolvedExpression(UnresolvedIdentifier(constList)))})*/ +void setLiterals9() {} + +@Helper({0, 1, ...?constNullableList}) +/*member: setLiterals10: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + SpreadElement(?...UnresolvedExpression(UnresolvedIdentifier(constNullableList)))})*/ +void setLiterals10() {} + +@Helper({0, 1, if (constBool) 2}) +/*member: setLiterals11: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + IfElement( + UnresolvedExpression(UnresolvedIdentifier(constBool)), + ExpressionElement(IntegerLiteral(2)))})*/ +void setLiterals11() {} + +@Helper({0, 1, if (constBool) 2 else 3}) +/*member: setLiterals12: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + IfElement( + UnresolvedExpression(UnresolvedIdentifier(constBool)), + ExpressionElement(IntegerLiteral(2)), + ExpressionElement(IntegerLiteral(3)))})*/ +void setLiterals12() {} + +@Helper(const {constInt}) +/*member: setLiterals13: +SetOrMapLiteral({ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void setLiterals13() {} + +@Helper(const {0, constInt}) +/*member: setLiterals14: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void setLiterals14() {} + +@Helper(const {0, 1, constInt}) +/*member: setLiterals15: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void setLiterals15() {} + +@Helper(const {}) +/*member: setLiterals16: +SetOrMapLiteral(<<{})*/ +void setLiterals16() {} + +@Helper(const {constInt}) +/*member: setLiterals17: +SetOrMapLiteral({ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void setLiterals17() {} + +@Helper(const {0, constInt}) +/*member: setLiterals18: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void setLiterals18() {} + +@Helper(const {0, 1, constInt}) +/*member: setLiterals19: +SetOrMapLiteral({ + ExpressionElement(IntegerLiteral(0)), + ExpressionElement(IntegerLiteral(1)), + ExpressionElement(UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void setLiterals19() {} + +@Helper({0: constInt}) +/*member: mapLiterals1: +SetOrMapLiteral({MapEntryElement(IntegerLiteral(0):UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void mapLiterals1() {} + +@Helper({0: 0, 1: constInt}) +/*member: mapLiterals2: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void mapLiterals2() {} + +@Helper({0: 0, 1: 1, 2: constInt}) +/*member: mapLiterals3: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + MapEntryElement(IntegerLiteral(2):UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void mapLiterals3() {} + +@Helper({}) +/*member: mapLiterals4: +SetOrMapLiteral({})*/ +void mapLiterals4() {} + +@Helper({0: constInt}) +/*member: mapLiterals5: +SetOrMapLiteral({MapEntryElement(IntegerLiteral(0):UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void mapLiterals5() {} + +@Helper({0: 0, 1: constInt}) +/*member: mapLiterals6: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void mapLiterals6() {} + +@Helper({0: 0, 1: 1, 2: constInt}) +/*member: mapLiterals7: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + MapEntryElement(IntegerLiteral(2):UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void mapLiterals7() {} + +@Helper({0: 0, 1: constInt, ...{}}) +/*member: mapLiterals8: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):UnresolvedExpression(UnresolvedIdentifier(constInt))), + SpreadElement(...SetOrMapLiteral({}))})*/ +void mapLiterals8() {} + +@Helper({ + 0: 0, + 1: 1, + ...{2: 2, 3: constInt} +}) +/*member: mapLiterals9: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + SpreadElement(...SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(2):IntegerLiteral(2)), + MapEntryElement(IntegerLiteral(3):UnresolvedExpression(UnresolvedIdentifier(constInt)))}))})*/ +void mapLiterals9() {} + +@Helper({0: 0, 1: 1, ...?constNullableMap}) +/*member: mapLiterals10: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + SpreadElement(?...UnresolvedExpression(UnresolvedIdentifier(constNullableMap)))})*/ +void mapLiterals10() {} + +@Helper({0: 0, 1: 1, if (constBool) 2: 2}) +/*member: mapLiterals11: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + IfElement( + UnresolvedExpression(UnresolvedIdentifier(constBool)), + MapEntryElement(IntegerLiteral(2):IntegerLiteral(2)))})*/ +void mapLiterals11() {} + +@Helper({0: 0, 1: 1, if (constBool) 2: 2 else 3: 3}) +/*member: mapLiterals12: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + IfElement( + UnresolvedExpression(UnresolvedIdentifier(constBool)), + MapEntryElement(IntegerLiteral(2):IntegerLiteral(2)), + MapEntryElement(IntegerLiteral(3):IntegerLiteral(3)))})*/ +void mapLiterals12() {} + +@Helper(const {0: constInt}) +/*member: mapLiterals13: +SetOrMapLiteral({MapEntryElement(IntegerLiteral(0):UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void mapLiterals13() {} + +@Helper(const {0: 0, 1: constInt}) +/*member: mapLiterals14: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void mapLiterals14() {} + +@Helper(const {0: 0, 1: 1, 2: constInt}) +/*member: mapLiterals15: +SetOrMapLiteral({ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + MapEntryElement(IntegerLiteral(2):UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void mapLiterals15() {} + +@Helper(const {}) +/*member: mapLiterals16: +SetOrMapLiteral(<<{})*/ +void mapLiterals16() {} + +@Helper( + const {0: constInt}) +/*member: mapLiterals17: +SetOrMapLiteral(<<{MapEntryElement(IntegerLiteral(0):UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void mapLiterals17() {} + +@Helper(const , + self.UnresolvedGenericClass>{0: 0, 1: constInt}) +/*member: mapLiterals18: +SetOrMapLiteral(<<),<)>{ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void mapLiterals18() {} + +@Helper(const , int>{ + 0: 0, + 1: 1, + 2: constInt +}) +/*member: mapLiterals19: +SetOrMapLiteral(<<),int>{ + MapEntryElement(IntegerLiteral(0):IntegerLiteral(0)), + MapEntryElement(IntegerLiteral(1):IntegerLiteral(1)), + MapEntryElement(IntegerLiteral(2):UnresolvedExpression(UnresolvedIdentifier(constInt)))})*/ +void mapLiterals19() {} + +@Helper((constInt,)) +/*member: recordLiterals1: +RecordLiteral(UnresolvedExpression(UnresolvedIdentifier(constInt)))*/ +void recordLiterals1() {} + +@Helper((0, constInt)) +/*member: recordLiterals2: +RecordLiteral(IntegerLiteral(0), UnresolvedExpression(UnresolvedIdentifier(constInt)))*/ +void recordLiterals2() {} + +@Helper((a: 0, constInt)) +/*member: recordLiterals3: +RecordLiteral(a: IntegerLiteral(0), UnresolvedExpression(UnresolvedIdentifier(constInt)))*/ +void recordLiterals3() {} + +@Helper((0, b: constInt)) +/*member: recordLiterals4: +RecordLiteral(IntegerLiteral(0), b: UnresolvedExpression(UnresolvedIdentifier(constInt)))*/ +void recordLiterals4() {} + +@Helper(const (constInt,)) +/*member: recordLiterals5: +RecordLiteral(UnresolvedExpression(UnresolvedIdentifier(constInt)))*/ +void recordLiterals5() {} + +@Helper(const (0, constInt)) +/*member: recordLiterals6: +RecordLiteral(IntegerLiteral(0), UnresolvedExpression(UnresolvedIdentifier(constInt)))*/ +void recordLiterals6() {} + +@Helper(const (a: 0, constInt)) +/*member: recordLiterals7: +RecordLiteral(a: IntegerLiteral(0), UnresolvedExpression(UnresolvedIdentifier(constInt)))*/ +void recordLiterals7() {} + +@Helper(const (0, b: constInt)) +/*member: recordLiterals8: +RecordLiteral(IntegerLiteral(0), b: UnresolvedExpression(UnresolvedIdentifier(constInt)))*/ +void recordLiterals8() {} + +@Helper((constInt)) +/*member: parenthesized1: +ParenthesizedExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)))*/ +void parenthesized1() {} + +@Helper((variable).length) +/*member: parenthesized2: +PropertyGet(ParenthesizedExpression(UnresolvedExpression(UnresolvedIdentifier(variable))).length)*/ +void parenthesized2() {} + +@Helper((genericFunction)) +/*member: parenthesized3: +Instantiation(ParenthesizedExpression(UnresolvedExpression(UnresolvedIdentifier(genericFunction))))*/ +void parenthesized3() {} + +@Helper(constBool ? 0 : 1) +/*member: conditional1: +ConditionalExpression( + UnresolvedExpression(UnresolvedIdentifier(constBool)) + ? IntegerLiteral(0) + : IntegerLiteral(1))*/ +void conditional1() {} + +@Helper(bool.fromEnvironment(variable, defaultValue: true) + ? const String.fromEnvironment(variable, defaultValue: 'baz') + : int.fromEnvironment(variable, defaultValue: 42)) +/*member: conditional2: +ConditionalExpression( + ConstructorInvocation( + bool.fromEnvironment( + UnresolvedExpression(UnresolvedIdentifier(variable)), + defaultValue: BooleanLiteral(true))) + ? ConstructorInvocation( + String.fromEnvironment( + UnresolvedExpression(UnresolvedIdentifier(variable)), + defaultValue: StringLiteral('baz'))) + : ConstructorInvocation( + int.fromEnvironment( + UnresolvedExpression(UnresolvedIdentifier(variable)), + defaultValue: IntegerLiteral(42))))*/ +void conditional2() {} + +@Helper(constNullableList ?? [0]) +/*member: binary1: +IfNull( + UnresolvedExpression(UnresolvedIdentifier(constNullableList)) + ?? + ListLiteral([ExpressionElement(IntegerLiteral(0))]) +)*/ +void binary1() {} + +@Helper(constBool || true) +/*member: binary2: +LogicalExpression(UnresolvedExpression(UnresolvedIdentifier(constBool)) || BooleanLiteral(true))*/ +void binary2() {} + +@Helper(constBool && true) +/*member: binary3: +LogicalExpression(UnresolvedExpression(UnresolvedIdentifier(constBool)) && BooleanLiteral(true))*/ +void binary3() {} + +@Helper(constInt == 1) +/*member: binary4: +EqualityExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) == IntegerLiteral(1))*/ +void binary4() {} + +@Helper(constInt != 1) +/*member: binary5: +EqualityExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) != IntegerLiteral(1))*/ +void binary5() {} + +@Helper(constInt >= 1) +/*member: binary6: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) >= IntegerLiteral(1))*/ +void binary6() {} + +@Helper(constInt > 1) +/*member: binary7: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) > IntegerLiteral(1))*/ +void binary7() {} + +@Helper(constInt <= 1) +/*member: binary8: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) <= IntegerLiteral(1))*/ +void binary8() {} + +@Helper(constInt < 1) +/*member: binary9: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) < IntegerLiteral(1))*/ +void binary9() {} + +@Helper(constInt | 1) +/*member: binary10: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) | IntegerLiteral(1))*/ +void binary10() {} + +@Helper(constInt & 1) +/*member: binary11: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) & IntegerLiteral(1))*/ +void binary11() {} + +@Helper(constInt ^ 1) +/*member: binary12: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) ^ IntegerLiteral(1))*/ +void binary12() {} + +@Helper(constInt << 1) +/*member: binary13: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) << IntegerLiteral(1))*/ +void binary13() {} + +@Helper(constInt >> 1) +/*member: binary14: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) >> IntegerLiteral(1))*/ +void binary14() {} + +@Helper(constInt >>> 1) +/*member: binary15: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) >>> IntegerLiteral(1))*/ +void binary15() {} + +@Helper(constInt + 1) +/*member: binary16: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) + IntegerLiteral(1))*/ +void binary16() {} + +void binary17() {} + +@Helper(constInt - 1) +/*member: binary18: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) - IntegerLiteral(1))*/ +void binary18() {} + +@Helper(constInt * 1) +/*member: binary19: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) * IntegerLiteral(1))*/ +void binary19() {} + +@Helper(constInt / 1) +/*member: binary20: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) / IntegerLiteral(1))*/ +void binary20() {} + +@Helper(constInt % 1) +/*member: binary21: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) % IntegerLiteral(1))*/ +void binary21() {} + +@Helper(constInt ~/ 1) +/*member: binary22: +BinaryExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) ~/ IntegerLiteral(1))*/ +void binary22() {} + +@Helper(constInt is int) +/*member: isAs1: +IsTest(UnresolvedExpression(UnresolvedIdentifier(constInt)) is int)*/ +void isAs1() {} + +@Helper(constInt is! String) +/*member: isAs2: +IsTest(UnresolvedExpression(UnresolvedIdentifier(constInt)) is! String)*/ +void isAs2() {} + +@Helper(constInt as int) +/*member: isAs3: +AsExpression(UnresolvedExpression(UnresolvedIdentifier(constInt)) as int)*/ +void isAs3() {} + +@Helper(-constInt) +/*member: unary1: +UnaryExpression(-UnresolvedExpression(UnresolvedIdentifier(constInt)))*/ +void unary1() {} + +@Helper(!constBool) +/*member: unary2: +UnaryExpression(!UnresolvedExpression(UnresolvedIdentifier(constBool)))*/ +void unary2() {} + +@Helper(~constInt) +/*member: unary3: +UnaryExpression(~UnresolvedExpression(UnresolvedIdentifier(constInt)))*/ +void unary3() {} + +@Helper(constNullableList!) +/*member: nullCheck1: +NullCheck(UnresolvedExpression(UnresolvedIdentifier(constNullableList)))*/ +void nullCheck1() {} + +@Helper(constNullableString?.length) +/*member: nullAwareAccess1: +NullAwarePropertyGet(UnresolvedExpression(UnresolvedIdentifier(constNullableString))?.length)*/ +void nullAwareAccess1() {} diff --git a/pkg/_fe_analyzer_shared/test/mini_ast.dart b/pkg/_fe_analyzer_shared/test/mini_ast.dart index 1c7dd832d674..667ba2a8f2dc 100644 --- a/pkg/_fe_analyzer_shared/test/mini_ast.dart +++ b/pkg/_fe_analyzer_shared/test/mini_ast.dart @@ -3271,6 +3271,13 @@ class MiniAstOperations SharedTypeView type, NullabilitySuffix modifier) { return SharedTypeView(type.unwrapTypeView().withNullability(modifier)); } + + @override + Type greatestClosureOfTypeInternal(Type type, + List> typeParametersToEliminate) { + // TODO(paulberry): Implement greatest closure of types in mini ast. + throw UnimplementedError(); + } } /// Representation of an expression or statement in the pseudo-Dart language diff --git a/pkg/_fe_analyzer_shared/test/type_inference/type_constraint_gatherer_test.dart b/pkg/_fe_analyzer_shared/test/type_inference/type_constraint_gatherer_test.dart index dbcfb0f47bfb..5a000ee42535 100644 --- a/pkg/_fe_analyzer_shared/test/type_inference/type_constraint_gatherer_test.dart +++ b/pkg/_fe_analyzer_shared/test/type_inference/type_constraint_gatherer_test.dart @@ -544,8 +544,8 @@ class _TypeConstraintGatherer extends TypeConstraintGenerator[]; _TypeConstraintGatherer(Set typeVariablesBeingConstrained, - {this.enableDiscrepantObliviousnessOfNullabilitySuffixOfFutureOr = - false}) { + {this.enableDiscrepantObliviousnessOfNullabilitySuffixOfFutureOr = false}) + : super(inferenceUsingBoundsIsEnabled: false) { for (var typeVariableName in typeVariablesBeingConstrained) { _typeVariablesBeingConstrained .add(TypeRegistry.addTypeParameter(typeVariableName)); diff --git a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart index 431646033581..fda74c4aabbd 100644 --- a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart +++ b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart @@ -772,6 +772,7 @@ class GenericInferrer { typeSystem: _typeSystem, typeSystemOperations: _typeSystemOperations, typeParameters: _typeFormals, + inferenceUsingBoundsIsEnabled: inferenceUsingBoundsIsEnabled, dataForTesting: null); typeConstraintGatherer.trySubtypeMatch( lower, typeParameterToInferBound, /* leftSchema */ true, @@ -889,6 +890,7 @@ class GenericInferrer { typeSystem: _typeSystem, typeParameters: _typeParameters, typeSystemOperations: _typeSystemOperations, + inferenceUsingBoundsIsEnabled: inferenceUsingBoundsIsEnabled, dataForTesting: dataForTesting); var success = gatherer.trySubtypeMatch(t1, t2, !covariant, nodeForTesting: nodeForTesting); diff --git a/pkg/analyzer/lib/src/dart/element/type_constraint_gatherer.dart b/pkg/analyzer/lib/src/dart/element/type_constraint_gatherer.dart index 9655ad0afc57..15e5474b7a8f 100644 --- a/pkg/analyzer/lib/src/dart/element/type_constraint_gatherer.dart +++ b/pkg/analyzer/lib/src/dart/element/type_constraint_gatherer.dart @@ -51,6 +51,7 @@ class TypeConstraintGatherer extends shared.TypeConstraintGenerator< required TypeSystemImpl typeSystem, required Iterable typeParameters, required TypeSystemOperations typeSystemOperations, + required super.inferenceUsingBoundsIsEnabled, required this.dataForTesting, }) : _typeSystem = typeSystem, _typeSystemOperations = typeSystemOperations { @@ -157,7 +158,13 @@ class TypeConstraintGatherer extends shared.TypeConstraintGenerator< if (_typeSystemOperations.matchInferableParameter(SharedTypeView(Q)) case var Q_element? when Q_nullability == NullabilitySuffix.none && - _typeParameters.contains(Q_element)) { + _typeParameters.contains(Q_element) && + (!inferenceUsingBoundsIsEnabled || + (Q_element.bound == null || + _typeSystemOperations.isSubtypeOfInternal( + P, + _typeSystemOperations.greatestClosureOfTypeInternal( + Q_element.bound!, [..._typeParameters]))))) { _addLower(Q_element, P, nodeForTesting: nodeForTesting); return true; } @@ -315,7 +322,9 @@ class TypeConstraintGatherer extends shared.TypeConstraintGenerator< } if (P is FunctionType && Q is FunctionType) { - return _functionType(P, Q, leftSchema, nodeForTesting: nodeForTesting); + return _functionType(P, Q, leftSchema, + nodeForTesting: nodeForTesting, + inferenceUsingBoundsIsEnabled: inferenceUsingBoundsIsEnabled); } // A type `P` is a subtype match for `Record` with respect to `L` under no @@ -330,6 +339,7 @@ class TypeConstraintGatherer extends shared.TypeConstraintGenerator< if (P is SharedRecordTypeStructure && Q is SharedRecordTypeStructure) { return _recordType(P as RecordTypeImpl, Q as RecordTypeImpl, leftSchema, + inferenceUsingBoundsIsEnabled: inferenceUsingBoundsIsEnabled, nodeForTesting: nodeForTesting); } @@ -371,7 +381,8 @@ class TypeConstraintGatherer extends shared.TypeConstraintGenerator< /// returned. Otherwise, [_constraints] is left unchanged (or rolled back), /// and `false` is returned. bool _functionType(FunctionType P, FunctionType Q, bool leftSchema, - {required AstNode? nodeForTesting}) { + {required bool inferenceUsingBoundsIsEnabled, + required AstNode? nodeForTesting}) { if (P.nullabilitySuffix != NullabilitySuffix.none) { return false; } @@ -461,7 +472,8 @@ class TypeConstraintGatherer extends shared.TypeConstraintGenerator< /// returned. Otherwise, [_constraints] is left unchanged (or rolled back), /// and `false` is returned. bool _recordType(RecordTypeImpl P, RecordTypeImpl Q, bool leftSchema, - {required AstNode? nodeForTesting}) { + {required bool inferenceUsingBoundsIsEnabled, + required AstNode? nodeForTesting}) { // If `P` is `(M0, ..., Mk)` and `Q` is `(N0, ..., Nk)`, then the match // holds under constraints `C0 + ... + Ck`: // If `Mi` is a subtype match for `Ni` with respect to L under diff --git a/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart index 8313e98f6141..ce055217041e 100644 --- a/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart +++ b/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart @@ -517,6 +517,14 @@ class TypeSystemOperations typeSystem.greatestClosureOfSchema(schema.unwrapTypeSchemaView())); } + @override + DartType greatestClosureOfTypeInternal(DartType type, + List> typeParametersToEliminate) { + typeParametersToEliminate.first; + return typeSystem.greatestClosure( + type, typeParametersToEliminate.cast()); + } + @override bool isAlwaysExhaustiveType(SharedTypeView type) { return typeSystem.isAlwaysExhaustive(type.unwrapTypeView()); diff --git a/pkg/analyzer/lib/src/summary2/macro_metadata.dart b/pkg/analyzer/lib/src/summary2/macro_metadata.dart new file mode 100644 index 000000000000..fa7f1ecced3c --- /dev/null +++ b/pkg/analyzer/lib/src/summary2/macro_metadata.dart @@ -0,0 +1,237 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:_fe_analyzer_shared/src/metadata/ast.dart' as shared; +import 'package:_fe_analyzer_shared/src/metadata/parser.dart' as shared; +import 'package:_fe_analyzer_shared/src/metadata/scope.dart' as shared; +import 'package:analyzer/dart/ast/token.dart'; +import 'package:analyzer/dart/element/element.dart'; +import 'package:analyzer/dart/element/scope.dart'; +import 'package:analyzer/dart/element/type.dart'; +import 'package:analyzer/src/dart/element/element.dart'; +import 'package:analyzer/src/dart/element/scope.dart'; + +/// Creates a [shared.Expression] for the [annotation]. +shared.Expression parseAnnotation(ElementAnnotationImpl annotation) { + var compilationUnit = annotation.compilationUnit; + var annotationImpl = annotation.annotationAst; + var uri = compilationUnit.source.uri; + var scope = _Scope(compilationUnit); + var references = _References(); + // The token stream might have been detached, so we ensure an EOF while + // parsing the annotation. + var endTokenNext = annotationImpl.endToken.next; + annotationImpl.endToken.next ??= Token.eof(-1); + var expression = shared.parseAnnotation( + annotationImpl.atSign, uri, scope, references, + isDartLibrary: uri.isScheme("dart") || uri.isScheme("org-dartlang-sdk")); + annotationImpl.endToken.next = endTokenNext; + return expression; +} + +shared.Proto _elementToProto(Element element, String name) { + if (element is ClassElement) { + var reference = _ClassReference(element); + return shared.ClassProto(reference, _ClassScope(element, reference)); + } else if (element is PropertyAccessorElement) { + VariableElement? variableElement = element.variable2; + if (variableElement != null) { + return shared.FieldProto(_VariableReference(variableElement)); + } + } else if (element is FunctionElement) { + return shared.FunctionProto(_FunctionReference(element)); + } else if (element is MethodElement) { + return shared.FunctionProto(_FunctionReference(element)); + } else if (element is VariableElement) { + return shared.FieldProto(_VariableReference(element)); + } else if (element is PrefixElement) { + return shared.PrefixProto(name, _PrefixScope(element)); + } else if (element.kind == ElementKind.DYNAMIC) { + return shared.DynamicProto(const _DynamicReference()); + } else if (element is TypeAliasElement) { + var reference = _TypedefReference(element); + return shared.TypedefProto(reference, _TypedefScope(element, reference)); + } else if (element is ExtensionElement) { + var reference = _ExtensionReference(element); + return shared.ExtensionProto( + reference, _ExtensionScope(element, reference)); + } + + // TODO(johnniwinther): Support extension types. + throw UnsupportedError( + "Unsupported element $element (${element.runtimeType}) for '$name'."); +} + +class _ClassReference extends shared.ClassReference { + final ClassElement _element; + + _ClassReference(this._element); + + @override + String get name => _element.name; +} + +final class _ClassScope extends shared.BaseClassScope { + final ClassElement _classElement; + + @override + final _ClassReference classReference; + + _ClassScope(this._classElement, this.classReference); + + @override + shared.Proto lookup(String name, + [List? typeArguments]) { + var constructor = _classElement.getNamedConstructor(name); + if (constructor != null) { + return createConstructorProto( + typeArguments, _ConstructorReference(constructor)); + } + Element? member = _classElement.augmented.getField(name); + member ??= _classElement.augmented.getMethod(name); + return createMemberProto(typeArguments, name, member, _elementToProto); + } +} + +class _ConstructorReference extends shared.ConstructorReference { + final ConstructorElement _element; + + _ConstructorReference(this._element); + + @override + String get name => _element.name.isEmpty ? 'new' : _element.name; +} + +class _DynamicReference extends shared.TypeReference { + const _DynamicReference(); + + @override + String get name => 'dynamic'; +} + +class _ExtensionReference extends shared.ExtensionReference { + final ExtensionElement _element; + + _ExtensionReference(this._element); + + @override + String get name => _element.name!; +} + +final class _ExtensionScope extends shared.BaseExtensionScope { + final ExtensionElement _extensionElement; + + @override + final _ExtensionReference extensionReference; + + _ExtensionScope(this._extensionElement, this.extensionReference); + + @override + shared.Proto lookup(String name, + [List? typeArguments]) { + Element? member = _extensionElement.augmented.getField(name); + member ??= _extensionElement.augmented.getMethod(name); + return createMemberProto(typeArguments, name, member, _elementToProto); + } +} + +class _FunctionReference extends shared.FunctionReference { + final ExecutableElement _element; + + _FunctionReference(this._element); + + @override + String get name => _element.name; +} + +class _PrefixScope implements shared.Scope { + final PrefixElement _prefixElement; + + _PrefixScope(this._prefixElement); + + @override + shared.Proto lookup(String name) { + ScopeLookupResult result = _prefixElement.scope.lookup(name); + Element? getter = result.getter; + if (getter == null) { + return shared.UnresolvedIdentifier(this, name); + } else { + return _elementToProto(getter, name); + } + } +} + +class _References implements shared.References { + @override + shared.TypeReference get dynamicReference => const _DynamicReference(); + + @override + shared.TypeReference get voidReference => const _VoidReference(); +} + +class _Scope implements shared.Scope { + final LibraryFragmentScope _libraryFragmentScope; + + _Scope(CompilationUnitElementImpl compilationUnit) + : _libraryFragmentScope = LibraryFragmentScope(compilationUnit); + + @override + shared.Proto lookup(String name) { + ScopeLookupResult result = _libraryFragmentScope.lookup(name); + Element? getter = result.getter; + if (getter == null) { + return shared.UnresolvedIdentifier(this, name); + } else { + return _elementToProto(getter, name); + } + } +} + +class _TypedefReference implements shared.TypedefReference { + final TypeAliasElement _element; + + _TypedefReference(this._element); + + @override + String get name => _element.name; +} + +final class _TypedefScope extends shared.BaseTypedefScope { + final TypeAliasElement _typeAliasElement; + + @override + final shared.TypedefReference typedefReference; + + _TypedefScope(this._typeAliasElement, this.typedefReference); + + @override + shared.Proto lookup(String name, + [List? typeArguments]) { + DartType aliasedType = _typeAliasElement.aliasedType; + if (aliasedType is InterfaceType) { + var constructor = aliasedType.element.getNamedConstructor(name); + if (constructor != null) { + return createConstructorProto( + typeArguments, _ConstructorReference(constructor)); + } + } + return createMemberProto(typeArguments, name); + } +} + +class _VariableReference extends shared.FieldReference { + final VariableElement _element; + + _VariableReference(this._element); + + @override + String get name => _element.name; +} + +class _VoidReference extends shared.TypeReference { + const _VoidReference(); + + @override + String get name => 'void'; +} diff --git a/pkg/analyzer/test/id_tests/metadata_test.dart b/pkg/analyzer/test/id_tests/metadata_test.dart new file mode 100644 index 000000000000..f41c9738f20e --- /dev/null +++ b/pkg/analyzer/test/id_tests/metadata_test.dart @@ -0,0 +1,73 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:_fe_analyzer_shared/src/testing/id.dart'; +import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'; +import 'package:_fe_analyzer_shared/src/testing/metadata_helper.dart'; +import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/element/element.dart'; +import 'package:analyzer/src/dart/analysis/testing_data.dart'; +import 'package:analyzer/src/dart/element/element.dart'; +import 'package:analyzer/src/dart/element/inheritance_manager3.dart'; +import 'package:analyzer/src/summary2/macro_metadata.dart'; +import 'package:analyzer/src/util/ast_data_extractor.dart'; + +import '../util/id_testing_helper.dart'; + +main(List args) async { + Directory dataDir = Directory.fromUri(Platform.script + .resolve('../../../_fe_analyzer_shared/test/metadata/data')); + return runTests( + dataDir, + args: args, + createUriForFileName: createUriForFileName, + onFailure: onFailure, + runTest: runTestFor(const _MetadataDataComputer(), [analyzerDefaultConfig]), + preserveWhitespaceInAnnotations: true, + ); +} + +class _MetadataDataComputer extends DataComputer { + const _MetadataDataComputer(); + + @override + DataInterpreter get dataValidator => const StringDataInterpreter(); + + @override + bool get supportsErrors => true; + + @override + void computeUnitData(TestingData testingData, CompilationUnit unit, + Map> actualMap) { + _MetadataDataExtractor(unit.declaredElement!.source.uri, actualMap) + .run(unit); + } +} + +class _MetadataDataExtractor extends AstDataExtractor { + final inheritance = InheritanceManager3(); + + _MetadataDataExtractor(super.uri, super.actualMap); + + @override + String? computeNodeValue(Id id, AstNode node) { + if (node is Declaration) { + Element? element = node.declaredElement; + if (element != null) { + List list = []; + for (ElementAnnotation annotation in element.metadata) { + if (annotation is ElementAnnotationImpl) { + list.add(expressionToText(unwrap(parseAnnotation(annotation)))); + } + } + if (list.isNotEmpty) { + return '\n${list.join('\n')}'; + } + } + } + return null; + } +} diff --git a/pkg/analyzer/test/src/dart/element/generic_inferrer_test.dart b/pkg/analyzer/test/src/dart/element/generic_inferrer_test.dart index 237747c18b5c..bd0b3e6a44e3 100644 --- a/pkg/analyzer/test/src/dart/element/generic_inferrer_test.dart +++ b/pkg/analyzer/test/src/dart/element/generic_inferrer_test.dart @@ -189,7 +189,9 @@ class GenericFunctionInferenceTest extends AbstractTypeSystemTest { // Something invalid... _assertTypes( _inferCall(clone, [stringNone, numNone], expectError: true), - [objectNone], + [ + interfaceTypeNone(A, typeArguments: [objectQuestion]), + ], ); } diff --git a/pkg/analyzer/test/src/dart/element/type_constraint_gatherer_test.dart b/pkg/analyzer/test/src/dart/element/type_constraint_gatherer_test.dart index 3733b4664a1e..68dc69bfe2a3 100644 --- a/pkg/analyzer/test/src/dart/element/type_constraint_gatherer_test.dart +++ b/pkg/analyzer/test/src/dart/element/type_constraint_gatherer_test.dart @@ -1271,6 +1271,7 @@ class TypeConstraintGathererTest extends AbstractTypeSystemTest { typeParameters: typeParameters, typeSystemOperations: TypeSystemOperations(typeSystem, strictCasts: false), + inferenceUsingBoundsIsEnabled: false, dataForTesting: null, ); @@ -1299,6 +1300,7 @@ class TypeConstraintGathererTest extends AbstractTypeSystemTest { typeParameters: typeParameters, typeSystemOperations: TypeSystemOperations(typeSystem, strictCasts: false), + inferenceUsingBoundsIsEnabled: false, dataForTesting: null, ); diff --git a/pkg/dart2wasm/lib/globals.dart b/pkg/dart2wasm/lib/globals.dart index 96c4d196d71a..db06ac82f1c2 100644 --- a/pkg/dart2wasm/lib/globals.dart +++ b/pkg/dart2wasm/lib/globals.dart @@ -14,7 +14,6 @@ class Globals { final Map _globals = {}; final Map _globalGetters = {}; - final Map _globalSetters = {}; final Map _globalInitializers = {}; final Map _globalInitializedFlag = {}; late final WasmGlobalImporter _globalsModuleMap = @@ -63,39 +62,6 @@ class Globals { return global.type.type; } - /// Sets the value of [w.Global] in [b]. - /// - /// Takes into account the calling module and the module the global belongs - /// to. If they are not the same then sets the global indirectly, either - /// through an import or a setter call. - void updateGlobal(w.InstructionsBuilder b, - void Function(w.InstructionsBuilder b) pushValue, w.Global global) { - final owningModule = global.enclosingModule; - final callingModule = b.module; - if (owningModule == callingModule) { - pushValue(b); - b.global_set(global); - } else if (translator.isMainModule(owningModule)) { - final importedGlobal = _globalsModuleMap.get(global, callingModule); - pushValue(b); - b.global_set(importedGlobal); - } else { - final setter = _globalSetters.putIfAbsent(global, () { - final setterType = - owningModule.types.defineFunction([global.type.type], const []); - final setterFunction = owningModule.functions.define(setterType); - final setterBody = setterFunction.body; - setterBody.local_get(setterBody.locals.single); - setterBody.global_set(global); - setterBody.end(); - return setterFunction; - }); - - pushValue(b); - translator.callFunction(setter, b); - } - } - /// Return (and if needed create) the Wasm global corresponding to a static /// field. w.Global getGlobalForStaticField(Field field) { diff --git a/pkg/front_end/lib/src/base/incremental_compiler.dart b/pkg/front_end/lib/src/base/incremental_compiler.dart index fe6d16d03859..f8e6317cad31 100644 --- a/pkg/front_end/lib/src/base/incremental_compiler.dart +++ b/pkg/front_end/lib/src/base/incremental_compiler.dart @@ -1985,6 +1985,8 @@ class IncrementalCompiler implements IncrementalKernelGenerator { isAugmenting: false, indexedLibrary: null, mayImplementRestrictedTypes: false); + debugCompilationUnit.markLanguageVersionFinal(); + SourceLibraryBuilder debugLibrary = debugCompilationUnit.createLibrary(); debugLibrary.buildNameSpace(); libraryBuilder.libraryNameSpace.forEachLocalMember((name, member) { @@ -2047,6 +2049,7 @@ class IncrementalCompiler implements IncrementalKernelGenerator { isAugmenting: false, indexedLibrary: null, mayImplementRestrictedTypes: false); + debugCompilationUnit.markLanguageVersionFinal(); SourceLibraryBuilder? orgDebugLibrary = debugLibrary; debugLibrary = debugCompilationUnit.createLibrary(); diff --git a/pkg/front_end/lib/src/base/scope.dart b/pkg/front_end/lib/src/base/scope.dart index 6977d13eabd1..62072d478793 100644 --- a/pkg/front_end/lib/src/base/scope.dart +++ b/pkg/front_end/lib/src/base/scope.dart @@ -20,6 +20,7 @@ import '../kernel/body_builder_context.dart'; import '../kernel/hierarchy/class_member.dart' show ClassMember; import '../kernel/kernel_helper.dart'; import '../kernel/load_library_builder.dart'; +import '../kernel/type_algorithms.dart'; import '../source/source_class_builder.dart'; import '../source/source_extension_builder.dart'; import '../source/source_extension_type_declaration_builder.dart'; @@ -565,10 +566,6 @@ class AccessErrorBuilder extends ProblemBuilder { @override Builder? get parent => builder.parent; - @override - // Coverage-ignore(suite): Not run. - bool get isFinal => builder.isFinal; - @override bool get isField => builder.isField; @@ -640,6 +637,10 @@ mixin ErroneousMemberBuilderMixin implements SourceMemberBuilder { // Coverage-ignore(suite): Not run. MemberDataForTesting? get dataForTesting => null; + @override + // Coverage-ignore(suite): Not run. + Iterable? get metadataForTesting => null; + @override // Coverage-ignore(suite): Not run. Name get memberName => throw new UnsupportedError('$runtimeType.memberName'); @@ -722,6 +723,14 @@ mixin ErroneousMemberBuilderMixin implements SourceMemberBuilder { return 0; } + @override + // Coverage-ignore(suite): Not run. + int computeDefaultTypes(ComputeDefaultTypeContext context, + {required bool inErrorRecovery}) { + assert(false, "Unexpected call to $runtimeType.computeDefaultTypes."); + return 0; + } + @override // Coverage-ignore(suite): Not run. List get localMembers => const []; @@ -755,10 +764,7 @@ mixin ErroneousMemberBuilderMixin implements SourceMemberBuilder { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { + BodyBuilderContext createBodyBuilderContext() { throw new UnsupportedError( '$runtimeType.bodyBuilderContextForAnnotations}'); } diff --git a/pkg/front_end/lib/src/builder/builder.dart b/pkg/front_end/lib/src/builder/builder.dart index 8b18f9103091..a57b874c9abf 100644 --- a/pkg/front_end/lib/src/builder/builder.dart +++ b/pkg/front_end/lib/src/builder/builder.dart @@ -32,8 +32,6 @@ abstract class Builder { bool get isField; - bool get isFinal; - bool get isGetter; bool get isExternal; @@ -287,10 +285,6 @@ abstract class BuilderImpl implements Builder { @override bool get isField => false; - @override - // Coverage-ignore(suite): Not run. - bool get isFinal => false; - @override bool get isGetter => false; diff --git a/pkg/front_end/lib/src/builder/class_builder.dart b/pkg/front_end/lib/src/builder/class_builder.dart index 21ade2ab57d6..a2ab400b7353 100644 --- a/pkg/front_end/lib/src/builder/class_builder.dart +++ b/pkg/front_end/lib/src/builder/class_builder.dart @@ -117,7 +117,6 @@ abstract class ClassBuilder implements DeclarationBuilder, ClassMemberAccess { bool get isInterface; - @override bool get isFinal; bool get declaresConstConstructor; diff --git a/pkg/front_end/lib/src/builder/formal_parameter_builder.dart b/pkg/front_end/lib/src/builder/formal_parameter_builder.dart index a49647badbc7..3b69de44303a 100644 --- a/pkg/front_end/lib/src/builder/formal_parameter_builder.dart +++ b/pkg/front_end/lib/src/builder/formal_parameter_builder.dart @@ -148,9 +148,6 @@ class FormalParameterBuilder extends BuilderImpl @override bool get isConst => modifiers.isConst; - @override - bool get isFinal => modifiers.isFinal; - // An initializing formal parameter might be final without its // VariableDeclaration being final. See // [ProcedureBuilder.computeFormalParameterInitializerScope].. @@ -173,7 +170,7 @@ class FormalParameterBuilder extends BuilderImpl // `null` is used in [VariableDeclarationImpl] to signal an omitted // type. type: isTypeOmitted ? null : builtType, - isFinal: isFinal, + isFinal: modifiers.isFinal, isConst: false, isInitializingFormal: isInitializingFormal, isCovariantByDeclaration: isCovariantByDeclaration, @@ -279,11 +276,8 @@ class FormalParameterBuilder extends BuilderImpl final DeclarationBuilder declarationBuilder = parent.declarationBuilder!; LookupScope scope = declarationBuilder.scope; - BodyBuilderContext bodyBuilderContext = new ParameterBodyBuilderContext( - this, - inOutlineBuildingPhase: true, - inMetadata: false, - inConstFields: false); + BodyBuilderContext bodyBuilderContext = + new ParameterBodyBuilderContext(this); BodyBuilder bodyBuilder = libraryBuilder.loader .createBodyBuilderForOutlineExpression( libraryBuilder, bodyBuilderContext, scope, fileUri); diff --git a/pkg/front_end/lib/src/builder/metadata_builder.dart b/pkg/front_end/lib/src/builder/metadata_builder.dart index d4b5a1e04cef..83a0b31e3914 100644 --- a/pkg/front_end/lib/src/builder/metadata_builder.dart +++ b/pkg/front_end/lib/src/builder/metadata_builder.dart @@ -5,14 +5,19 @@ library fasta.metadata_builder; import 'package:_fe_analyzer_shared/src/scanner/scanner.dart' show Token; +import 'package:_fe_analyzer_shared/src/metadata/expressions.dart' as shared; import 'package:kernel/ast.dart'; import 'package:kernel/clone.dart'; +import '../base/loader.dart'; import '../base/scope.dart' show LookupScope; import '../kernel/body_builder.dart' show BodyBuilder; import '../kernel/body_builder_context.dart'; +import '../kernel/macro/metadata.dart'; import '../source/source_library_builder.dart' show SourceLibraryBuilder; +bool computeSharedExpressionForTesting = false; + class MetadataBuilder { /// Token for `@` for annotations that have not yet been parsed. Token? _atToken; @@ -35,6 +40,11 @@ class MetadataBuilder { // Coverage-ignore(suite): Not run. Token? get beginToken => _atToken; + shared.Expression? _sharedExpression; + + // Coverage-ignore(suite): Not run. + shared.Expression? get expression => _sharedExpression; + static void buildAnnotations( Annotatable parent, List? metadata, @@ -61,6 +71,12 @@ class MetadataBuilder { MetadataBuilder annotationBuilder = metadata[i]; Token? beginToken = annotationBuilder._atToken; if (beginToken != null) { + if (computeSharedExpressionForTesting) { + // Coverage-ignore-block(suite): Not run. + annotationBuilder._sharedExpression = _parseSharedExpression( + library.loader, beginToken, library.importUri, fileUri, scope); + } + bodyBuilder ??= library.loader.createBodyBuilderForOutlineExpression( library, bodyBuilderContext, scope, fileUri); Expression annotation = bodyBuilder.parseAnnotation(beginToken); @@ -117,3 +133,9 @@ class MetadataBuilder { } } } + +// Coverage-ignore(suite): Not run. +shared.Expression _parseSharedExpression(Loader loader, Token atToken, + Uri importUri, Uri fileUri, LookupScope scope) { + return parseAnnotation(loader, atToken, importUri, fileUri, scope); +} diff --git a/pkg/front_end/lib/src/dill/dill_member_builder.dart b/pkg/front_end/lib/src/dill/dill_member_builder.dart index 67f760aca8bb..6f6c47377dc3 100644 --- a/pkg/front_end/lib/src/dill/dill_member_builder.dart +++ b/pkg/front_end/lib/src/dill/dill_member_builder.dart @@ -156,10 +156,6 @@ class DillFieldBuilder extends DillMemberBuilder implements FieldBuilder { // Coverage-ignore(suite): Not run. bool get isConst => field.isConst; - @override - // Coverage-ignore(suite): Not run. - bool get isFinal => field.isFinal; - @override bool get isStatic => field.isStatic; } diff --git a/pkg/front_end/lib/src/fragment/constructor.dart b/pkg/front_end/lib/src/fragment/constructor.dart index b4331a94cf6c..a06135a13f41 100644 --- a/pkg/front_end/lib/src/fragment/constructor.dart +++ b/pkg/front_end/lib/src/fragment/constructor.dart @@ -99,14 +99,8 @@ class _ConstructorBodyBuildingContext implements FunctionBodyBuildingContext { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return _fragment.builder.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return _fragment.builder.createBodyBuilderContext(); } @override diff --git a/pkg/front_end/lib/src/fragment/factory.dart b/pkg/front_end/lib/src/fragment/factory.dart index 44cad93f6444..04439fb53e0f 100644 --- a/pkg/front_end/lib/src/fragment/factory.dart +++ b/pkg/front_end/lib/src/fragment/factory.dart @@ -83,14 +83,8 @@ class _FactoryBodyBuildingContext implements FunctionBodyBuildingContext { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return _fragment.builder.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return _fragment.builder.createBodyBuilderContext(); } @override diff --git a/pkg/front_end/lib/src/fragment/function.dart b/pkg/front_end/lib/src/fragment/function.dart index 7fdb21d97376..f1036fb4aa7f 100644 --- a/pkg/front_end/lib/src/fragment/function.dart +++ b/pkg/front_end/lib/src/fragment/function.dart @@ -18,10 +18,7 @@ abstract class FunctionBodyBuildingContext { // TODO(johnniwinther): Avoid the need for this. bool get shouldBuild; - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}); + BodyBuilderContext createBodyBuilderContext(); LookupScope get typeParameterScope; diff --git a/pkg/front_end/lib/src/fragment/getter.dart b/pkg/front_end/lib/src/fragment/getter.dart index 36448df459cb..d25cf9e42f0b 100644 --- a/pkg/front_end/lib/src/fragment/getter.dart +++ b/pkg/front_end/lib/src/fragment/getter.dart @@ -86,14 +86,8 @@ class _GetterBodyBuildingContext implements FunctionBodyBuildingContext { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return _fragment.builder.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return _fragment.builder.createBodyBuilderContext(); } @override diff --git a/pkg/front_end/lib/src/fragment/method.dart b/pkg/front_end/lib/src/fragment/method.dart index 24389b16761c..47c0c1508f23 100644 --- a/pkg/front_end/lib/src/fragment/method.dart +++ b/pkg/front_end/lib/src/fragment/method.dart @@ -88,14 +88,8 @@ class _MethodBodyBuildingContext implements FunctionBodyBuildingContext { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return _fragment.builder.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return _fragment.builder.createBodyBuilderContext(); } @override diff --git a/pkg/front_end/lib/src/fragment/primary_constructor.dart b/pkg/front_end/lib/src/fragment/primary_constructor.dart index 45d0a68cec84..c347f4152381 100644 --- a/pkg/front_end/lib/src/fragment/primary_constructor.dart +++ b/pkg/front_end/lib/src/fragment/primary_constructor.dart @@ -91,14 +91,8 @@ class _PrimaryConstructorBodyBuildingContext } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return _fragment.builder.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return _fragment.builder.createBodyBuilderContext(); } @override diff --git a/pkg/front_end/lib/src/fragment/setter.dart b/pkg/front_end/lib/src/fragment/setter.dart index 57bad9ae2785..944d2e73225c 100644 --- a/pkg/front_end/lib/src/fragment/setter.dart +++ b/pkg/front_end/lib/src/fragment/setter.dart @@ -86,14 +86,8 @@ class _SetterBodyBuildingContext implements FunctionBodyBuildingContext { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return _fragment.builder.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return _fragment.builder.createBodyBuilderContext(); } @override diff --git a/pkg/front_end/lib/src/kernel/body_builder_context.dart b/pkg/front_end/lib/src/kernel/body_builder_context.dart index 7134351cccd3..95eae5fbde86 100644 --- a/pkg/front_end/lib/src/kernel/body_builder_context.dart +++ b/pkg/front_end/lib/src/kernel/body_builder_context.dart @@ -41,25 +41,15 @@ import 'internal_ast.dart'; abstract class BodyBuilderContext { final BodyBuilderDeclarationContext _declarationContext; - final bool isDeclarationInstanceMember; - - final bool inOutlineBuildingPhase; - - final bool inMetadata; - - final bool inConstFields; + final bool _isDeclarationInstanceMember; BodyBuilderContext( LibraryBuilder libraryBuilder, DeclarationBuilder? declarationBuilder, - {required this.isDeclarationInstanceMember, - required this.inOutlineBuildingPhase, - required this.inMetadata, - required this.inConstFields}) - : _declarationContext = new BodyBuilderDeclarationContext( + {required bool isDeclarationInstanceMember}) + : _isDeclarationInstanceMember = isDeclarationInstanceMember, + _declarationContext = new BodyBuilderDeclarationContext( libraryBuilder, declarationBuilder); - bool get hasFormalParameters; - String get memberName { throw new UnsupportedError('${runtimeType}.memberName'); } @@ -128,7 +118,7 @@ abstract class BodyBuilderContext { bool get isNativeMethod => false; bool get isDeclarationInstanceContext { - return isDeclarationInstanceMember || isConstructor; + return _isDeclarationInstanceMember || isConstructor; } bool get isRedirectingFactory => false; @@ -510,19 +500,8 @@ class _TopLevelBodyBuilderDeclarationContext } class LibraryBodyBuilderContext extends BodyBuilderContext { - LibraryBodyBuilderContext(SourceLibraryBuilder libraryBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) - : super(libraryBuilder, null, - isDeclarationInstanceMember: false, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + LibraryBodyBuilderContext(SourceLibraryBuilder libraryBuilder) + : super(libraryBuilder, null, isDeclarationInstanceMember: false); } mixin _DeclarationBodyBuilderContext @@ -535,89 +514,39 @@ mixin _DeclarationBodyBuilderContext class ClassBodyBuilderContext extends BodyBuilderContext with _DeclarationBodyBuilderContext { - ClassBodyBuilderContext(SourceClassBuilder sourceClassBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + ClassBodyBuilderContext(SourceClassBuilder sourceClassBuilder) : super(sourceClassBuilder.libraryBuilder, sourceClassBuilder, - isDeclarationInstanceMember: false, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + isDeclarationInstanceMember: false); } class EnumBodyBuilderContext extends BodyBuilderContext with _DeclarationBodyBuilderContext { - EnumBodyBuilderContext(SourceEnumBuilder sourceEnumBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + EnumBodyBuilderContext(SourceEnumBuilder sourceEnumBuilder) : super(sourceEnumBuilder.libraryBuilder, sourceEnumBuilder, - isDeclarationInstanceMember: false, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + isDeclarationInstanceMember: false); } class ExtensionBodyBuilderContext extends BodyBuilderContext with _DeclarationBodyBuilderContext { - ExtensionBodyBuilderContext(SourceExtensionBuilder sourceExtensionBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + ExtensionBodyBuilderContext(SourceExtensionBuilder sourceExtensionBuilder) : super(sourceExtensionBuilder.libraryBuilder, sourceExtensionBuilder, - isDeclarationInstanceMember: false, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + isDeclarationInstanceMember: false); } class ExtensionTypeBodyBuilderContext extends BodyBuilderContext with _DeclarationBodyBuilderContext { ExtensionTypeBodyBuilderContext( SourceExtensionTypeDeclarationBuilder - sourceExtensionTypeDeclarationBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + sourceExtensionTypeDeclarationBuilder) : super(sourceExtensionTypeDeclarationBuilder.libraryBuilder, sourceExtensionTypeDeclarationBuilder, - isDeclarationInstanceMember: false, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + isDeclarationInstanceMember: false); } class TypedefBodyBuilderContext extends BodyBuilderContext { - TypedefBodyBuilderContext(SourceTypeAliasBuilder sourceTypeAliasBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + TypedefBodyBuilderContext(SourceTypeAliasBuilder sourceTypeAliasBuilder) : super(sourceTypeAliasBuilder.libraryBuilder, null, - isDeclarationInstanceMember: false, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + isDeclarationInstanceMember: false); } mixin _MemberBodyBuilderContext @@ -651,15 +580,9 @@ class FieldBodyBuilderContext extends BodyBuilderContext @override final Member _builtMember; - FieldBodyBuilderContext(this._member, this._builtMember, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + FieldBodyBuilderContext(this._member, this._builtMember) : super(_member.libraryBuilder, _member.declarationBuilder, - isDeclarationInstanceMember: _member.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + isDeclarationInstanceMember: _member.isDeclarationInstanceMember); @override bool get isLateField => _member.isLate; @@ -687,10 +610,6 @@ class FieldBodyBuilderContext extends BodyBuilderContext ? ConstantContext.required : ConstantContext.none; } - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; } mixin _FunctionBodyBuilderContextMixin @@ -788,19 +707,9 @@ class ProcedureBodyBuilderContext extends BodyBuilderContext @override final Member _builtMember; - ProcedureBodyBuilderContext(this._member, this._builtMember, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + ProcedureBodyBuilderContext(this._member, this._builtMember) : super(_member.libraryBuilder, _member.declarationBuilder, - isDeclarationInstanceMember: _member.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => true; + isDeclarationInstanceMember: _member.isDeclarationInstanceMember); } mixin _ConstructorBodyBuilderContextMixin @@ -872,15 +781,9 @@ class ConstructorBodyBuilderContext extends BodyBuilderContext @override final Member _builtMember; - ConstructorBodyBuilderContext(this._member, this._builtMember, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + ConstructorBodyBuilderContext(this._member, this._builtMember) : super(_member.libraryBuilder, _member.declarationBuilder, - isDeclarationInstanceMember: _member.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + isDeclarationInstanceMember: _member.isDeclarationInstanceMember); @override bool isConstructorCyclic(String name) { @@ -893,10 +796,6 @@ class ConstructorBodyBuilderContext extends BodyBuilderContext !isExternalConstructor; } - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => true; - @override TreeNode get _initializerParent => _member.invokeTarget; } @@ -912,25 +811,15 @@ class ExtensionTypeConstructorBodyBuilderContext extends BodyBuilderContext @override final Member _builtMember; - ExtensionTypeConstructorBodyBuilderContext(this._member, this._builtMember, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + ExtensionTypeConstructorBodyBuilderContext(this._member, this._builtMember) : super(_member.libraryBuilder, _member.declarationBuilder, - isDeclarationInstanceMember: _member.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + isDeclarationInstanceMember: _member.isDeclarationInstanceMember); @override bool isConstructorCyclic(String name) { return _declarationContext.isConstructorCyclic(_member.name, name); } - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => true; - @override TreeNode get _initializerParent => _member.invokeTarget; } @@ -945,15 +834,9 @@ class FactoryBodyBuilderContext extends BodyBuilderContext @override final Member _builtMember; - FactoryBodyBuilderContext(this._member, this._builtMember, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + FactoryBodyBuilderContext(this._member, this._builtMember) : super(_member.libraryBuilder, _member.declarationBuilder, - isDeclarationInstanceMember: _member.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + isDeclarationInstanceMember: _member.isDeclarationInstanceMember); @override void setAsyncModifier(AsyncMarker asyncModifier) { @@ -964,10 +847,6 @@ class FactoryBodyBuilderContext extends BodyBuilderContext DartType get returnTypeContext { return _member.function.returnType; } - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => true; } class RedirectingFactoryBodyBuilderContext extends BodyBuilderContext @@ -980,15 +859,9 @@ class RedirectingFactoryBodyBuilderContext extends BodyBuilderContext @override final Member _builtMember; - RedirectingFactoryBodyBuilderContext(this._member, this._builtMember, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + RedirectingFactoryBodyBuilderContext(this._member, this._builtMember) : super(_member.libraryBuilder, _member.declarationBuilder, - isDeclarationInstanceMember: _member.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + isDeclarationInstanceMember: _member.isDeclarationInstanceMember); @override bool get isRedirectingFactory => true; @@ -997,44 +870,24 @@ class RedirectingFactoryBodyBuilderContext extends BodyBuilderContext String get redirectingFactoryTargetName { return _member.redirectionTarget.fullNameForErrors; } - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => true; } class ParameterBodyBuilderContext extends BodyBuilderContext { factory ParameterBodyBuilderContext( - FormalParameterBuilder formalParameterBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { + FormalParameterBuilder formalParameterBuilder) { final DeclarationBuilder declarationBuilder = formalParameterBuilder.parent.declarationBuilder!; return new ParameterBodyBuilderContext._(declarationBuilder.libraryBuilder, - declarationBuilder, formalParameterBuilder, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + declarationBuilder, formalParameterBuilder); } ParameterBodyBuilderContext._( LibraryBuilder libraryBuilder, DeclarationBuilder? declarationBuilder, - FormalParameterBuilder formalParameterBuilder, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + FormalParameterBuilder formalParameterBuilder) : super(libraryBuilder, declarationBuilder, isDeclarationInstanceMember: - formalParameterBuilder.isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - // Coverage-ignore(suite): Not run. - bool get hasFormalParameters => false; + formalParameterBuilder.isDeclarationInstanceMember); } // Coverage-ignore(suite): Not run. @@ -1048,16 +901,7 @@ class ExpressionCompilerProcedureBodyBuildContext extends BodyBuilderContext ExpressionCompilerProcedureBodyBuildContext( DietListener listener, this._member, this._builtMember, - {required bool isDeclarationInstanceMember, - required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) + {required bool isDeclarationInstanceMember}) : super(listener.libraryBuilder, listener.currentDeclaration, - isDeclarationInstanceMember: isDeclarationInstanceMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); - - @override - bool get hasFormalParameters => false; + isDeclarationInstanceMember: isDeclarationInstanceMember); } diff --git a/pkg/front_end/lib/src/kernel/implicit_field_type.dart b/pkg/front_end/lib/src/kernel/implicit_field_type.dart index 0df8aa9a3d4e..922ec0179622 100644 --- a/pkg/front_end/lib/src/kernel/implicit_field_type.dart +++ b/pkg/front_end/lib/src/kernel/implicit_field_type.dart @@ -150,10 +150,7 @@ class _ImplicitFieldTypeRoot extends InferredType { // Coverage-ignore(suite): Not run. ?.inferenceData); BodyBuilderContext bodyBuilderContext = - fieldBuilder.createBodyBuilderContext( - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false); + fieldBuilder.createBodyBuilderContext(); BodyBuilder bodyBuilder = fieldBuilder.libraryBuilder.loader .createBodyBuilderForField( fieldBuilder.libraryBuilder, diff --git a/pkg/front_end/lib/src/kernel/kernel_variable_builder.dart b/pkg/front_end/lib/src/kernel/kernel_variable_builder.dart index ae491c998161..eb47e95b6643 100644 --- a/pkg/front_end/lib/src/kernel/kernel_variable_builder.dart +++ b/pkg/front_end/lib/src/kernel/kernel_variable_builder.dart @@ -31,10 +31,6 @@ class VariableBuilderImpl extends BuilderImpl implements VariableBuilder { @override bool get isConst => variable.isConst; - @override - // Coverage-ignore(suite): Not run. - bool get isFinal => variable.isFinal; - @override bool get isAssignable => variable.isAssignable; diff --git a/pkg/front_end/lib/src/kernel/macro/metadata.dart b/pkg/front_end/lib/src/kernel/macro/metadata.dart new file mode 100644 index 000000000000..d99ed157d4ea --- /dev/null +++ b/pkg/front_end/lib/src/kernel/macro/metadata.dart @@ -0,0 +1,285 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:_fe_analyzer_shared/src/metadata/expressions.dart' as shared; +import 'package:_fe_analyzer_shared/src/metadata/parser.dart' as shared; +import 'package:_fe_analyzer_shared/src/metadata/proto.dart' as shared; +import 'package:_fe_analyzer_shared/src/metadata/references.dart' as shared; +import 'package:_fe_analyzer_shared/src/metadata/scope.dart' as shared; +import 'package:_fe_analyzer_shared/src/metadata/type_annotations.dart' + as shared; +import 'package:_fe_analyzer_shared/src/scanner/token.dart'; +import 'package:kernel/ast.dart'; + +import '../../base/loader.dart'; +import '../../base/scope.dart'; +import '../../builder/builder.dart'; +import '../../builder/declaration_builders.dart'; +import '../../builder/dynamic_type_declaration_builder.dart'; +import '../../builder/field_builder.dart'; +import '../../builder/future_or_type_declaration_builder.dart'; +import '../../builder/member_builder.dart'; +import '../../builder/never_type_declaration_builder.dart'; +import '../../builder/null_type_declaration_builder.dart'; +import '../../builder/prefix_builder.dart'; +import '../../builder/procedure_builder.dart'; + +// Coverage-ignore(suite): Not run. +final Uri dummyUri = Uri.parse('dummy:uri'); + +// Coverage-ignore(suite): Not run. +bool _isDartLibrary(Uri importUri, Uri fileUri) { + return importUri.isScheme("dart") || fileUri.isScheme("org-dartlang-sdk"); +} + +// Coverage-ignore(suite): Not run. +shared.Expression parseAnnotation(Loader loader, Token atToken, Uri importUri, + Uri fileUri, LookupScope scope) { + return shared.parseAnnotation( + atToken, fileUri, new AnnotationScope(scope), new References(loader), + isDartLibrary: _isDartLibrary(importUri, fileUri)); +} + +// Coverage-ignore(suite): Not run. +shared.Proto builderToProto(Builder builder, String name) { + if (builder is FieldBuilder) { + return new shared.FieldProto(new FieldReference(builder)); + } else if (builder is ProcedureBuilder) { + return new shared.FunctionProto(new FunctionReference(builder)); + } else if (builder is PrefixBuilder) { + return new shared.PrefixProto(name, new PrefixScope(builder)); + } else if (builder is ClassBuilder) { + shared.ClassReference classReference = new ClassReference(builder); + return new shared.ClassProto( + classReference, new ClassScope(builder, classReference)); + } else if (builder is DynamicTypeDeclarationBuilder) { + return new shared.DynamicProto(new TypeReference(builder)); + } else if (builder is TypeAliasBuilder) { + shared.TypedefReference typedefReference = new TypedefReference(builder); + return new shared.TypedefProto( + typedefReference, new TypedefScope(builder, typedefReference)); + } else if (builder is ExtensionBuilder) { + shared.ExtensionReference extensionReference = + new ExtensionReference(builder); + return new shared.ExtensionProto( + extensionReference, new ExtensionScope(builder, extensionReference)); + } else { + // TODO(johnniwinther): Support extension types. + throw new UnsupportedError("Unsupported builder $builder for $name"); + } +} + +// Coverage-ignore(suite): Not run. +class References implements shared.References { + final Loader loader; + + late final DynamicTypeDeclarationBuilder dynamicDeclaration = + new DynamicTypeDeclarationBuilder( + const DynamicType(), loader.coreLibrary, -1); + + late final NeverTypeDeclarationBuilder neverDeclaration = + new NeverTypeDeclarationBuilder( + const NeverType.nonNullable(), loader.coreLibrary, -1); + + late final NullTypeDeclarationBuilder nullDeclaration = + new NullTypeDeclarationBuilder(const NullType(), loader.coreLibrary, -1); + + late final FutureOrTypeDeclarationBuilder futureOrDeclaration = + new FutureOrTypeDeclarationBuilder( + new FutureOrType(const DynamicType(), Nullability.nonNullable), + loader.coreLibrary, + -1); + + @override + late final shared.TypeReference dynamicReference = + new TypeReference(dynamicDeclaration); + + @override + shared.TypeReference get voidReference => const VoidTypeReference(); + + References(this.loader); +} + +// Coverage-ignore(suite): Not run. +class AnnotationScope implements shared.Scope { + final LookupScope scope; + + AnnotationScope(this.scope); + + @override + shared.Proto lookup(String name) { + int fileOffset = -1; + Uri fileUri = dummyUri; + Builder? builder = scope.lookupGetable(name, fileOffset, fileUri); + if (builder == null) { + return new shared.UnresolvedIdentifier(this, name); + } else { + return builderToProto(builder, name); + } + } +} + +// Coverage-ignore(suite): Not run. +final class ClassScope extends shared.BaseClassScope { + final ClassBuilder builder; + @override + final shared.ClassReference classReference; + + ClassScope(this.builder, this.classReference); + + @override + shared.Proto lookup(String name, + [List? typeArguments]) { + int fileOffset = -1; + Uri fileUri = dummyUri; + MemberBuilder? constructor = + builder.constructorScope.lookup(name, fileOffset, fileUri); + if (constructor != null) { + return createConstructorProto( + typeArguments, new ConstructorReference(constructor)); + } + Builder? member = builder.lookupLocalMember(name, setter: false); + return createMemberProto(typeArguments, name, member, builderToProto); + } +} + +// Coverage-ignore(suite): Not run. +final class ExtensionScope extends shared.BaseExtensionScope { + final ExtensionBuilder builder; + @override + final shared.ExtensionReference extensionReference; + + ExtensionScope(this.builder, this.extensionReference); + + @override + shared.Proto lookup(String name, + [List? typeArguments]) { + Builder? member = builder.lookupLocalMember(name, setter: false); + return createMemberProto(typeArguments, name, member, builderToProto); + } +} + +// Coverage-ignore(suite): Not run. +final class TypedefScope extends shared.BaseTypedefScope { + final TypeAliasBuilder builder; + + @override + final shared.TypedefReference typedefReference; + + TypedefScope(this.builder, this.typedefReference); + + @override + shared.Proto lookup(String name, + [List? typeArguments]) { + int fileOffset = -1; + Uri fileUri = dummyUri; + TypeDeclarationBuilder? typeDeclaration = builder.unaliasDeclaration(null); + if (typeDeclaration is ClassBuilder) { + MemberBuilder? constructor = + typeDeclaration.constructorScope.lookup(name, fileOffset, fileUri); + if (constructor != null) { + return createConstructorProto( + typeArguments, new ConstructorReference(constructor)); + } + } + return createMemberProto(typeArguments, name); + } +} + +// Coverage-ignore(suite): Not run. +class TypeReference extends shared.TypeReference { + final TypeDeclarationBuilder builder; + + TypeReference(this.builder); + + @override + String get name => builder.name; +} + +class VoidTypeReference extends shared.TypeReference { + const VoidTypeReference(); + + @override + // Coverage-ignore(suite): Not run. + String get name => 'void'; +} + +// Coverage-ignore(suite): Not run. +class PrefixScope implements shared.Scope { + final PrefixBuilder prefixBuilder; + + PrefixScope(this.prefixBuilder); + + @override + shared.Proto lookup(String name) { + int fileOffset = -1; + Uri fileUri = dummyUri; + Builder? builder = prefixBuilder.lookup(name, fileOffset, fileUri); + if (builder == null) { + return new shared.UnresolvedIdentifier(this, name); + } else { + return builderToProto(builder, name); + } + } +} + +// Coverage-ignore(suite): Not run. +class FieldReference extends shared.FieldReference { + final FieldBuilder builder; + + FieldReference(this.builder); + + @override + String get name => builder.name; +} + +// Coverage-ignore(suite): Not run. +class FunctionReference extends shared.FunctionReference { + final ProcedureBuilder builder; + + FunctionReference(this.builder); + + @override + String get name => builder.name; +} + +// Coverage-ignore(suite): Not run. +class ConstructorReference extends shared.ConstructorReference { + final MemberBuilder builder; + + ConstructorReference(this.builder); + + @override + String get name => builder.name.isEmpty ? 'new' : builder.name; +} + +// Coverage-ignore(suite): Not run. +class ClassReference extends shared.ClassReference { + final ClassBuilder builder; + + ClassReference(this.builder); + + @override + String get name => builder.name; +} + +// Coverage-ignore(suite): Not run. +class ExtensionReference extends shared.ExtensionReference { + final ExtensionBuilder builder; + + ExtensionReference(this.builder); + + @override + String get name => builder.name; +} + +// Coverage-ignore(suite): Not run. +class TypedefReference extends shared.TypedefReference { + final TypeAliasBuilder builder; + + TypedefReference(this.builder); + + @override + String get name => builder.name; +} diff --git a/pkg/front_end/lib/src/kernel/type_algorithms.dart b/pkg/front_end/lib/src/kernel/type_algorithms.dart index bc4682fedc35..7ed84285e80b 100644 --- a/pkg/front_end/lib/src/kernel/type_algorithms.dart +++ b/pkg/front_end/lib/src/kernel/type_algorithms.dart @@ -6,21 +6,14 @@ import 'package:kernel/ast.dart'; import 'package:kernel/src/find_type_visitor.dart'; import 'package:kernel/util/graph.dart' show Graph, computeStrongComponents; +import '../api_prototype/experimental_flags.dart'; +import '../base/messages.dart'; import '../base/problems.dart'; import '../builder/declaration_builders.dart'; import '../builder/formal_parameter_builder.dart'; import '../builder/nullability_builder.dart'; import '../builder/record_type_builder.dart'; import '../builder/type_builder.dart'; -import '../codes/cfe_codes.dart' - show - LocatedMessage, - Message, - templateBoundIssueViaCycleNonSimplicity, - templateBoundIssueViaLoopNonSimplicity, - templateBoundIssueViaRawTypeWithNonSimpleBounds, - templateNonSimpleBoundViaReference, - templateNonSimpleBoundViaVariable; import '../source/source_class_builder.dart'; import '../source/source_extension_builder.dart'; import '../source/source_extension_type_declaration_builder.dart'; @@ -252,7 +245,7 @@ class TypeWithInBoundReferences { /// Finds issues by raw generic types with inbound references in type /// parameters. -List getInboundReferenceIssues( +List _getInboundReferenceIssues( List? parameters) { if (parameters == null) return []; @@ -299,18 +292,18 @@ List getInboundReferenceIssues( } /// Finds raw non-simple types in bounds of type parameters in [typeBuilder]. -List getInboundReferenceIssuesInType( +List _getInboundReferenceIssuesInType( TypeBuilder? typeBuilder) { List genericFunctionTypeBuilders = []; - findUnaliasedGenericFunctionTypes(typeBuilder, + _findUnaliasedGenericFunctionTypes(typeBuilder, result: genericFunctionTypeBuilders); List issues = []; for (FunctionTypeBuilder genericFunctionTypeBuilder in genericFunctionTypeBuilders) { List typeParameters = genericFunctionTypeBuilder.typeParameters!; - issues.addAll(getInboundReferenceIssues(typeParameters)); + issues.addAll(_getInboundReferenceIssues(typeParameters)); } return issues; } @@ -323,7 +316,7 @@ List getInboundReferenceIssuesInType( /// The reason for putting the type parameters into the paths as well as for /// using type for [start], and not the corresponding type declaration, /// is better error reporting. -List> findRawTypePathsToDeclaration( +List> _findRawTypePathsToDeclaration( TypeBuilder? start, TypeDeclarationBuilder end, [Set? visited]) { visited ??= new Set.identity(); @@ -341,7 +334,7 @@ List> findRawTypePathsToDeclaration( TypeBuilder? parameterBound = typeParameter.bound; if (parameterBound != null) { for (List path - in findRawTypePathsToDeclaration( + in _findRawTypePathsToDeclaration( parameterBound, end, visited)) { if (path.isNotEmpty) { paths.add([ @@ -397,7 +390,7 @@ List> findRawTypePathsToDeclaration( } } else { for (TypeBuilder argument in arguments) { - paths.addAll(findRawTypePathsToDeclaration(argument, end, visited)); + paths.addAll(_findRawTypePathsToDeclaration(argument, end, visited)); } } case FunctionTypeBuilder( @@ -405,24 +398,24 @@ List> findRawTypePathsToDeclaration( :List? formals, :TypeBuilder returnType ): - paths.addAll(findRawTypePathsToDeclaration(returnType, end, visited)); + paths.addAll(_findRawTypePathsToDeclaration(returnType, end, visited)); if (typeParameters != null) { for (StructuralParameterBuilder parameter in typeParameters) { if (parameter.bound != null) { paths.addAll( - findRawTypePathsToDeclaration(parameter.bound, end, visited)); + _findRawTypePathsToDeclaration(parameter.bound, end, visited)); } if (parameter.defaultType != null) { // Coverage-ignore-block(suite): Not run. - paths.addAll(findRawTypePathsToDeclaration( + paths.addAll(_findRawTypePathsToDeclaration( parameter.defaultType, end, visited)); } } } if (formals != null) { for (ParameterBuilder formal in formals) { - paths - .addAll(findRawTypePathsToDeclaration(formal.type, end, visited)); + paths.addAll( + _findRawTypePathsToDeclaration(formal.type, end, visited)); } } case RecordTypeBuilder( @@ -431,12 +424,14 @@ List> findRawTypePathsToDeclaration( ): if (positionalFields != null) { for (RecordTypeFieldBuilder field in positionalFields) { - paths.addAll(findRawTypePathsToDeclaration(field.type, end, visited)); + paths + .addAll(_findRawTypePathsToDeclaration(field.type, end, visited)); } } if (namedFields != null) { for (RecordTypeFieldBuilder field in namedFields) { - paths.addAll(findRawTypePathsToDeclaration(field.type, end, visited)); + paths + .addAll(_findRawTypePathsToDeclaration(field.type, end, visited)); } } case FixedTypeBuilder(): @@ -459,7 +454,7 @@ List> _findRawTypeCyclesFromTypeParameters( TypeBuilder? parameterBound = parameter.bound; if (parameterBound != null) { for (List dependencyPath - in findRawTypePathsToDeclaration(parameterBound, declaration)) { + in _findRawTypePathsToDeclaration(parameterBound, declaration)) { if (dependencyPath.isNotEmpty) { dependencyPath.first.typeParameterBuilder = parameter; cycles.add(dependencyPath); @@ -478,15 +473,15 @@ List> _findRawTypeCyclesFromTypeParameters( /// /// The reason for putting the type parameters into the cycles is better error /// reporting. -List> findRawTypeCycles( - TypeDeclarationBuilder declaration) { +List> _findRawTypeCycles( + ITypeDeclarationBuilder declaration, + List? typeParameters) { if (declaration is SourceClassBuilder) { - return _findRawTypeCyclesFromTypeParameters( - declaration, declaration.typeParameters); + return _findRawTypeCyclesFromTypeParameters(declaration, typeParameters); } else if (declaration is SourceTypeAliasBuilder) { List> cycles = >[]; - cycles.addAll(_findRawTypeCyclesFromTypeParameters( - declaration, declaration.typeParameters)); + cycles.addAll( + _findRawTypeCyclesFromTypeParameters(declaration, typeParameters)); if (declaration.type is FunctionTypeBuilder) { FunctionTypeBuilder type = declaration.type as FunctionTypeBuilder; cycles.addAll(_findRawTypeCyclesFromTypeParameters( @@ -494,11 +489,9 @@ List> findRawTypeCycles( return cycles; } } else if (declaration is SourceExtensionBuilder) { - return _findRawTypeCyclesFromTypeParameters( - declaration, declaration.typeParameters); + return _findRawTypeCyclesFromTypeParameters(declaration, typeParameters); } else if (declaration is SourceExtensionTypeDeclarationBuilder) { - return _findRawTypeCyclesFromTypeParameters( - declaration, declaration.typeParameters); + return _findRawTypeCyclesFromTypeParameters(declaration, typeParameters); } else { unhandled('$declaration (${declaration.runtimeType})', 'findRawTypeCycles', declaration.fileOffset, declaration.fileUri); @@ -509,9 +502,9 @@ List> findRawTypeCycles( /// Converts raw generic type [cycles] for [declaration] into reportable issues. /// /// The [cycles] are expected to be in the format specified for the return value -/// of [findRawTypeCycles]. -List convertRawTypeCyclesIntoIssues( - TypeDeclarationBuilder declaration, +/// of [_findRawTypeCycles]. +List _convertRawTypeCyclesIntoIssues( + ITypeDeclarationBuilder declaration, List> cycles) { List issues = []; for (List cycle in cycles) { @@ -548,10 +541,10 @@ List convertRawTypeCyclesIntoIssues( /// /// The issues are those caused by raw types with inbound references in the /// bounds of their type parameters. -List getNonSimplicityIssuesForTypeParameters( +List _getNonSimplicityIssuesForTypeParameters( List? parameters) { if (parameters == null) return []; - return getInboundReferenceIssues(parameters); + return _getInboundReferenceIssues(parameters); } /// Finds non-simplicity issues for the given [declaration]. @@ -564,28 +557,16 @@ List getNonSimplicityIssuesForTypeParameters( /// first element in the triplet is the type declaration that has the issue. /// The second element in the triplet is the error message. The third element /// in the triplet is the context. -List getNonSimplicityIssuesForDeclaration( - TypeDeclarationBuilder declaration, - {bool performErrorRecovery = true}) { +List _getNonSimplicityIssuesForDeclaration( + ITypeDeclarationBuilder declaration, + List? typeParameters) { List issues = []; - if (declaration is SourceClassBuilder) { - issues.addAll(getInboundReferenceIssues(declaration.typeParameters)); - } else if (declaration is SourceTypeAliasBuilder) { - issues.addAll(getInboundReferenceIssues(declaration.typeParameters)); - } else if (declaration is SourceExtensionBuilder) { - issues.addAll(getInboundReferenceIssues(declaration.typeParameters)); - } else if (declaration is SourceExtensionTypeDeclarationBuilder) { - issues.addAll(getInboundReferenceIssues(declaration.typeParameters)); - } else { - unhandled( - '$declaration (${declaration.runtimeType})', - 'getNonSimplicityIssuesForDeclaration', - declaration.fileOffset, - declaration.fileUri); - } + issues.addAll(_getInboundReferenceIssues(typeParameters)); + List> cyclesToReport = >[]; - for (List cycle in findRawTypeCycles(declaration)) { + for (List cycle + in _findRawTypeCycles(declaration, typeParameters)) { // To avoid reporting the same error for each element of the cycle, we only // do so if it comes the first in the lexicographical order. Note that // one-element cycles shouldn't be checked, as they are loops. @@ -609,12 +590,10 @@ List getNonSimplicityIssuesForDeclaration( } } List rawTypeCyclesAsIssues = - convertRawTypeCyclesIntoIssues(declaration, cyclesToReport); + _convertRawTypeCyclesIntoIssues(declaration, cyclesToReport); issues.addAll(rawTypeCyclesAsIssues); - if (performErrorRecovery) { - breakCycles(cyclesToReport); - } + _breakCycles(cyclesToReport); return issues; } @@ -622,8 +601,8 @@ List getNonSimplicityIssuesForDeclaration( /// Break raw generic type [cycles] as error recovery. /// /// The [cycles] are expected to be in the format specified for the return value -/// of [findRawTypeCycles]. -void breakCycles(List> cycles) { +/// of [_findRawTypeCycles]. +void _breakCycles(List> cycles) { for (List cycle in cycles) { if (cycle.isNotEmpty) { cycle.first.typeParameterBuilder?.bound = null; @@ -632,7 +611,7 @@ void breakCycles(List> cycles) { } /// Finds generic function type sub-terms in [type]. -void findUnaliasedGenericFunctionTypes(TypeBuilder? type, +void _findUnaliasedGenericFunctionTypes(TypeBuilder? type, {required List result}) { switch (type) { case FunctionTypeBuilder( @@ -644,22 +623,22 @@ void findUnaliasedGenericFunctionTypes(TypeBuilder? type, result.add(type); for (StructuralParameterBuilder typeParameter in typeParameters) { - findUnaliasedGenericFunctionTypes(typeParameter.bound, + _findUnaliasedGenericFunctionTypes(typeParameter.bound, result: result); - findUnaliasedGenericFunctionTypes(typeParameter.defaultType, + _findUnaliasedGenericFunctionTypes(typeParameter.defaultType, result: result); } } - findUnaliasedGenericFunctionTypes(returnType, result: result); + _findUnaliasedGenericFunctionTypes(returnType, result: result); if (formals != null) { for (ParameterBuilder formal in formals) { - findUnaliasedGenericFunctionTypes(formal.type, result: result); + _findUnaliasedGenericFunctionTypes(formal.type, result: result); } } case NamedTypeBuilder(typeArguments: List? arguments): if (arguments != null) { for (TypeBuilder argument in arguments) { - findUnaliasedGenericFunctionTypes(argument, result: result); + _findUnaliasedGenericFunctionTypes(argument, result: result); } } case RecordTypeBuilder( @@ -668,12 +647,12 @@ void findUnaliasedGenericFunctionTypes(TypeBuilder? type, ): if (positionalFields != null) { for (RecordTypeFieldBuilder field in positionalFields) { - findUnaliasedGenericFunctionTypes(field.type, result: result); + _findUnaliasedGenericFunctionTypes(field.type, result: result); } } if (namedFields != null) { for (RecordTypeFieldBuilder field in namedFields) { - findUnaliasedGenericFunctionTypes(field.type, result: result); + _findUnaliasedGenericFunctionTypes(field.type, result: result); } } case FixedTypeBuilder(): @@ -725,7 +704,7 @@ class TypeParameterSearch extends FindTypeVisitor { /// See section 15.3.1 Auxiliary Concepts for Instantiation to Bound. class NonSimplicityIssue { /// The generic declaration that has a non-simplicity issue. - final TypeDeclarationBuilder declaration; + final ITypeDeclarationBuilder declaration; /// The non-simplicity error message. final Message message; @@ -761,3 +740,185 @@ class RawTypeCycleElement { RawTypeCycleElement(this.type, this.typeParameterBuilder); } + +class ComputeDefaultTypeContext { + final ProblemReporting _problemReporting; + final LibraryFeatures libraryFeatures; + final TypeBuilder dynamicType; + final TypeBuilder bottomType; + final List unboundTypeParameters; + + ComputeDefaultTypeContext( + this._problemReporting, this.libraryFeatures, this.unboundTypeParameters, + {required TypeBuilder dynamicType, required TypeBuilder bottomType}) + : dynamicType = dynamicType, + bottomType = bottomType; + + void _reportIssues(List issues) { + for (NonSimplicityIssue issue in issues) { + _problemReporting.addProblem(issue.message, issue.declaration.fileOffset, + issue.declaration.name.length, issue.declaration.fileUri, + context: issue.context); + } + } + + /// Reports an error on generic function types used as bounds + /// + /// The function recursively searches for all generic function types in + /// [typeBuilder] and checks the bounds of type parameters of the found types + /// for being generic function types. Returns `true` if any errors were + /// reported. + bool recursivelyReportGenericFunctionTypesAsBoundsForType( + TypeBuilder? typeBuilder) { + if (libraryFeatures.genericMetadata.isEnabled) return false; + + List genericFunctionTypeBuilders = + []; + _findUnaliasedGenericFunctionTypes(typeBuilder, + result: genericFunctionTypeBuilders); + bool hasReportedErrors = false; + for (FunctionTypeBuilder genericFunctionTypeBuilder + in genericFunctionTypeBuilders) { + assert( + genericFunctionTypeBuilder.typeParameters != null, + "Function 'findUnaliasedGenericFunctionTypes' " + "returned a function type without type parameters."); + for (StructuralParameterBuilder typeParameter + in genericFunctionTypeBuilder.typeParameters!) { + hasReportedErrors = _reportGenericFunctionTypeAsBoundIfNeeded( + typeParameter.bound, + typeParameterName: typeParameter.name, + fileUri: typeParameter.fileUri, + charOffset: typeParameter.fileOffset) || + hasReportedErrors; + } + } + return hasReportedErrors; + } + + /// Reports an error if [bound] is a generic function type + /// + /// Returns `true` if any errors were reported. + bool _reportGenericFunctionTypeAsBoundIfNeeded(TypeBuilder? bound, + {required String typeParameterName, + Uri? fileUri, + required int charOffset}) { + if (libraryFeatures.genericMetadata.isEnabled) return false; + + bool isUnaliasedGenericFunctionType = bound is FunctionTypeBuilder && + bound.typeParameters != null && + bound.typeParameters!.isNotEmpty; + bool isAliasedGenericFunctionType = false; + TypeDeclarationBuilder? declaration = bound?.declaration; + // TODO(cstefantsova): Unalias beyond the first layer for the check. + if (declaration is TypeAliasBuilder) { + // Coverage-ignore-block(suite): Not run. + TypeBuilder? rhsType = declaration.type; + if (rhsType is FunctionTypeBuilder && + rhsType.typeParameters != null && + rhsType.typeParameters!.isNotEmpty) { + isAliasedGenericFunctionType = true; + } + } + + if (isUnaliasedGenericFunctionType || isAliasedGenericFunctionType) { + _problemReporting.addProblem(messageGenericFunctionTypeInBound, + charOffset, typeParameterName.length, fileUri); + return true; + } + return false; + } + + /// Reports an error on generic function types used as bounds + /// + /// The function recursively searches for all generic function types in + /// [typeParameter.bound] and checks the bounds of type parameters of the + /// found types for being generic function types. Additionally, the function + /// checks [typeParameter.bound] for being a generic function type. Returns + /// `true` if any errors were reported. + bool _recursivelyReportGenericFunctionTypesAsBoundsForVariable( + NominalParameterBuilder typeParameter) { + if (libraryFeatures.genericMetadata.isEnabled) return false; + + bool hasReportedErrors = false; + hasReportedErrors = _reportGenericFunctionTypeAsBoundIfNeeded( + typeParameter.bound, + typeParameterName: typeParameter.name, + fileUri: typeParameter.fileUri, + charOffset: typeParameter.fileOffset) || + hasReportedErrors; + hasReportedErrors = recursivelyReportGenericFunctionTypesAsBoundsForType( + typeParameter.bound) || + hasReportedErrors; + return hasReportedErrors; + } + + int computeDefaultTypesForVariables(List? variables, + {required bool inErrorRecovery}) { + if (variables == null) return 0; + + bool haveErroneousBounds = false; + if (!inErrorRecovery) { + if (!libraryFeatures.genericMetadata.isEnabled) { + for (NominalParameterBuilder variable in variables) { + haveErroneousBounds = + _recursivelyReportGenericFunctionTypesAsBoundsForVariable( + variable) || + haveErroneousBounds; + } + } + + if (!haveErroneousBounds) { + List calculatedBounds = calculateBounds( + variables, dynamicType, bottomType, + unboundTypeParameters: unboundTypeParameters); + for (int i = 0; i < variables.length; ++i) { + variables[i].defaultType = calculatedBounds[i]; + } + } + } + + if (inErrorRecovery || haveErroneousBounds) { + // Use dynamic in case of errors. + for (int i = 0; i < variables.length; ++i) { + variables[i].defaultType = dynamicType; + } + } + + return variables.length; + } + + void reportGenericFunctionTypesForFormals( + List? formals) { + if (formals != null && formals.isNotEmpty) { + for (FormalParameterBuilder formal in formals) { + List issues = + _getInboundReferenceIssuesInType(formal.type); + _reportIssues(issues); + recursivelyReportGenericFunctionTypesAsBoundsForType(formal.type); + } + } + } + + bool reportNonSimplicityIssues(ITypeDeclarationBuilder declaration, + List? typeParameters) { + List issues = + _getNonSimplicityIssuesForDeclaration(declaration, typeParameters); + _reportIssues(issues); + return issues.isNotEmpty; + } + + bool reportInboundReferenceIssuesForType(TypeBuilder type) { + List issues = _getInboundReferenceIssuesInType(type); + _reportIssues(issues); + return issues.isNotEmpty; + } + + bool reportSimplicityIssuesForTypeParameters( + List? typeParameters) { + List issues = + _getNonSimplicityIssuesForTypeParameters(typeParameters); + _reportIssues(issues); + return issues.isNotEmpty; + } +} diff --git a/pkg/front_end/lib/src/source/diet_listener.dart b/pkg/front_end/lib/src/source/diet_listener.dart index c885fba634ad..1682f5a27120 100644 --- a/pkg/front_end/lib/src/source/diet_listener.dart +++ b/pkg/front_end/lib/src/source/diet_listener.dart @@ -386,11 +386,8 @@ class DietListener extends StackListenerImpl { FunctionBodyBuildingContext functionBodyBuildingContext = functionFragment.createFunctionBodyBuildingContext(); if (functionBodyBuildingContext.shouldBuild) { - final BodyBuilder listener = createFunctionListener( - functionBodyBuildingContext, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false); + final BodyBuilder listener = + createFunctionListener(functionBodyBuildingContext); buildFunctionBody( listener, bodyToken, metadata, MemberKind.TopLevelMethod); } @@ -597,12 +594,7 @@ class DietListener extends StackListenerImpl { LibraryDependency? dependency = _offsetMap.lookupImport(importKeyword).libraryDependency; parseMetadata( - libraryBuilder.createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - metadata, - dependency); + libraryBuilder.createBodyBuilderContext(), metadata, dependency); } @override @@ -618,12 +610,7 @@ class DietListener extends StackListenerImpl { LibraryDependency dependency = _offsetMap.lookupExport(exportKeyword).libraryDependency; parseMetadata( - libraryBuilder.createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - metadata, - dependency); + libraryBuilder.createBodyBuilderContext(), metadata, dependency); } @override @@ -632,13 +619,7 @@ class DietListener extends StackListenerImpl { Token? metadata = pop() as Token?; LibraryPart part = _offsetMap.lookupPart(partKeyword); - parseMetadata( - libraryBuilder.createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - metadata, - part); + parseMetadata(libraryBuilder.createBodyBuilderContext(), metadata, part); } @override @@ -691,14 +672,8 @@ class DietListener extends StackListenerImpl { buildRedirectingFactoryMethod(bodyToken, functionBodyBuildingContext, MemberKind.Factory, metadata); } else { - buildFunctionBody( - createFunctionListener(functionBodyBuildingContext, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false), - bodyToken, - metadata, - MemberKind.Factory); + buildFunctionBody(createFunctionListener(functionBodyBuildingContext), + bodyToken, metadata, MemberKind.Factory); } } } @@ -833,14 +808,8 @@ class DietListener extends StackListenerImpl { functionFragment.createFunctionBodyBuildingContext(); if (functionBodyBuildingContext.shouldBuild) { MemberKind memberKind = functionBodyBuildingContext.memberKind; - buildFunctionBody( - createFunctionListener(functionBodyBuildingContext, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false), - beginParam, - metadata, - memberKind); + buildFunctionBody(createFunctionListener(functionBodyBuildingContext), + beginParam, metadata, memberKind); } } @@ -899,19 +868,13 @@ class DietListener extends StackListenerImpl { } BodyBuilder createFunctionListener( - FunctionBodyBuildingContext functionBodyBuildingContext, - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { + FunctionBodyBuildingContext functionBodyBuildingContext) { final LookupScope typeParameterScope = functionBodyBuildingContext.typeParameterScope; final LocalScope formalParameterScope = functionBodyBuildingContext .computeFormalParameterScope(typeParameterScope); return createListener( - functionBodyBuildingContext.createBodyBuilderContext( - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields), + functionBodyBuildingContext.createBodyBuilderContext(), typeParameterScope, thisVariable: functionBodyBuildingContext.thisVariable, thisTypeParameters: functionBodyBuildingContext.thisTypeParameters, @@ -929,11 +892,8 @@ class DietListener extends StackListenerImpl { // Coverage-ignore(suite): Not run. ?.beginSubdivide( BenchmarkSubdivides.diet_listener_buildRedirectingFactoryMethod); - final BodyBuilder listener = createFunctionListener( - functionBodyBuildingContext, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false); + final BodyBuilder listener = + createFunctionListener(functionBodyBuildingContext); try { Parser parser = new Parser(listener, useImplicitCreationExpression: useImplicitCreationExpressionInCfe, @@ -978,12 +938,7 @@ class DietListener extends StackListenerImpl { // TODO(paulberry): don't re-parse the field if we've already parsed it // for type inference. _parseFields( - createListener( - declaration.createBodyBuilderContext( - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: declaration.isConst), - memberScope, + createListener(declaration.createBodyBuilderContext(), memberScope, inferenceDataForTesting: declaration .dataForTesting // Coverage-ignore(suite): Not run. @@ -1146,11 +1101,7 @@ class DietListener extends StackListenerImpl { functionFragment.createFunctionBodyBuildingContext(); if (functionBodyBuildingContext.shouldBuild) { buildPrimaryConstructor( - createFunctionListener(functionBodyBuildingContext, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false), - formalsToken); + createFunctionListener(functionBodyBuildingContext), formalsToken); } // The current declaration is set in [beginClassOrMixinOrExtensionBody], diff --git a/pkg/front_end/lib/src/source/source_builder_mixins.dart b/pkg/front_end/lib/src/source/source_builder_mixins.dart index 1d24fdc4695d..81867d642255 100644 --- a/pkg/front_end/lib/src/source/source_builder_mixins.dart +++ b/pkg/front_end/lib/src/source/source_builder_mixins.dart @@ -19,6 +19,7 @@ import '../builder/procedure_builder.dart'; import '../builder/type_builder.dart'; import '../kernel/body_builder_context.dart'; import '../kernel/kernel_helper.dart'; +import '../kernel/type_algorithms.dart'; import 'source_constructor_builder.dart'; import 'source_field_builder.dart'; import 'source_library_builder.dart'; @@ -28,6 +29,8 @@ import 'source_procedure_builder.dart'; abstract class SourceDeclarationBuilder implements IDeclarationBuilder { void buildScopes(LibraryBuilder coreLibrary); + + int computeDefaultTypes(ComputeDefaultTypeContext context); } mixin SourceDeclarationBuilderMixin @@ -126,6 +129,35 @@ mixin SourceDeclarationBuilderMixin return count; } + @override + int computeDefaultTypes(ComputeDefaultTypeContext context) { + bool hasErrors = context.reportNonSimplicityIssues(this, typeParameters); + int count = context.computeDefaultTypesForVariables(typeParameters, + inErrorRecovery: hasErrors); + + Iterator iterator = + nameSpace.filteredConstructorIterator( + parent: this, includeDuplicates: false, includeAugmentations: true); + while (iterator.moveNext()) { + count += iterator.current + .computeDefaultTypes(context, inErrorRecovery: hasErrors); + } + + forEach((String name, Builder member) { + if (member is SourceMemberBuilder) { + count += + member.computeDefaultTypes(context, inErrorRecovery: hasErrors); + } else { + // Coverage-ignore-block(suite): Not run. + assert( + false, + "Unexpected extension type member " + "$member (${member.runtimeType})."); + } + }); + return count; + } + void checkTypesInOutline(TypeEnvironment typeEnvironment) { forEach((String name, Builder builder) { if (builder is SourceFieldBuilder) { @@ -155,23 +187,14 @@ mixin SourceDeclarationBuilderMixin }); } - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}); + BodyBuilderContext createBodyBuilderContext(); void buildOutlineExpressions(ClassHierarchy classHierarchy, List delayedDefaultValueCloners) { if (typeParameters != null) { for (int i = 0; i < typeParameters!.length; i++) { - typeParameters![i].buildOutlineExpressions( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - classHierarchy, - typeParameterScope); + typeParameters![i].buildOutlineExpressions(libraryBuilder, + createBodyBuilderContext(), classHierarchy, typeParameterScope); } } diff --git a/pkg/front_end/lib/src/source/source_class_builder.dart b/pkg/front_end/lib/src/source/source_class_builder.dart index 508423928a06..ea410af4cc01 100644 --- a/pkg/front_end/lib/src/source/source_class_builder.dart +++ b/pkg/front_end/lib/src/source/source_class_builder.dart @@ -42,6 +42,7 @@ import '../kernel/body_builder_context.dart'; import '../kernel/hierarchy/hierarchy_builder.dart'; import '../kernel/hierarchy/hierarchy_node.dart'; import '../kernel/kernel_helper.dart'; +import '../kernel/type_algorithms.dart'; import '../kernel/utils.dart' show compareProcedures; import 'class_declaration.dart'; import 'name_scheme.dart'; @@ -410,14 +411,8 @@ class SourceClassBuilder extends ClassBuilderImpl return cls; } - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new ClassBodyBuilderContext(this, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new ClassBodyBuilderContext(this); } void buildOutlineExpressions(ClassHierarchy classHierarchy, @@ -431,24 +426,15 @@ class SourceClassBuilder extends ClassBuilderImpl MetadataBuilder.buildAnnotations( isAugmenting ? origin.cls : cls, metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), libraryBuilder, fileUri, libraryBuilder.scope, createFileUriExpression: isAugmenting); if (typeParameters != null) { for (int i = 0; i < typeParameters!.length; i++) { - typeParameters![i].buildOutlineExpressions( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - classHierarchy, - typeParameterScope); + typeParameters![i].buildOutlineExpressions(libraryBuilder, + createBodyBuilderContext(), classHierarchy, typeParameterScope); } } @@ -1147,6 +1133,29 @@ class SourceClassBuilder extends ClassBuilderImpl } } + @override + int computeDefaultTypes(ComputeDefaultTypeContext context) { + bool hasErrors = context.reportNonSimplicityIssues(this, typeParameters); + int count = context.computeDefaultTypesForVariables(typeParameters, + inErrorRecovery: hasErrors); + + Iterator iterator = + nameSpace.filteredConstructorIterator( + parent: this, includeDuplicates: false, includeAugmentations: true); + while (iterator.moveNext()) { + count += iterator.current + .computeDefaultTypes(context, inErrorRecovery: hasErrors); + } + + Iterator memberIterator = + fullMemberIterator(); + while (memberIterator.moveNext()) { + count += memberIterator.current + .computeDefaultTypes(context, inErrorRecovery: hasErrors); + } + return count; + } + void checkTypesInOutline(TypeEnvironment typeEnvironment) { Iterator memberIterator = fullMemberIterator(); diff --git a/pkg/front_end/lib/src/source/source_compilation_unit.dart b/pkg/front_end/lib/src/source/source_compilation_unit.dart index 22c1fd995402..7388f79dcf55 100644 --- a/pkg/front_end/lib/src/source/source_compilation_unit.dart +++ b/pkg/front_end/lib/src/source/source_compilation_unit.dart @@ -446,6 +446,10 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { @override SourceLibraryBuilder createLibrary([Library? library]) { + assert( + _languageVersion.isFinal, + "Can not create a SourceLibraryBuilder before the language version of " + "the compilation unit is finalized."); assert(_libraryBuilder == null, "Source library builder as already been created for $this."); SourceLibraryBuilder libraryBuilder = _libraryBuilder = @@ -918,199 +922,21 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { TypeBuilder bottomType, ClassBuilder objectClass) { int count = 0; - int computeDefaultTypesForVariables( - List? variables, - {required bool inErrorRecovery}) { - if (variables == null) return 0; - - bool haveErroneousBounds = false; - if (!inErrorRecovery) { - if (!libraryFeatures.genericMetadata.isEnabled) { - for (NominalParameterBuilder variable in variables) { - haveErroneousBounds = - _recursivelyReportGenericFunctionTypesAsBoundsForVariable( - variable) || - haveErroneousBounds; - } - } - - if (!haveErroneousBounds) { - List unboundTypeParameters = []; - List calculatedBounds = calculateBounds( - variables, dynamicType, bottomType, - unboundTypeParameters: unboundTypeParameters); - _builderFactoryResult - .registerUnresolvedStructuralParameters(unboundTypeParameters); - - for (int i = 0; i < variables.length; ++i) { - variables[i].defaultType = calculatedBounds[i]; - } - } - } - - if (inErrorRecovery || haveErroneousBounds) { - // Use dynamic in case of errors. - for (int i = 0; i < variables.length; ++i) { - variables[i].defaultType = dynamicType; - } - } - - return variables.length; - } - - void reportIssues(List issues) { - for (NonSimplicityIssue issue in issues) { - addProblem(issue.message, issue.declaration.fileOffset, - issue.declaration.name.length, issue.declaration.fileUri, - context: issue.context); - } - } - - void processSourceProcedureBuilder(SourceProcedureBuilder member) { - List issues = - getNonSimplicityIssuesForTypeParameters(member.typeParameters); - if (member.formals != null && member.formals!.isNotEmpty) { - for (FormalParameterBuilder formal in member.formals!) { - issues.addAll(getInboundReferenceIssuesInType(formal.type)); - _recursivelyReportGenericFunctionTypesAsBoundsForType(formal.type); - } - } - if (member.returnType is! OmittedTypeBuilder) { - issues.addAll(getInboundReferenceIssuesInType(member.returnType)); - _recursivelyReportGenericFunctionTypesAsBoundsForType( - member.returnType); - } - reportIssues(issues); - count += computeDefaultTypesForVariables(member.typeParameters, - inErrorRecovery: issues.isNotEmpty); - } - - void processSourceFieldBuilder(SourceFieldBuilder member) { - TypeBuilder? fieldType = member.type; - if (fieldType is! OmittedTypeBuilder) { - List issues = - getInboundReferenceIssuesInType(fieldType); - reportIssues(issues); - _recursivelyReportGenericFunctionTypesAsBoundsForType(fieldType); - } - } - - void processSourceConstructorBuilder(SourceFunctionBuilder member, - {required bool inErrorRecovery}) { - count += computeDefaultTypesForVariables(member.typeParameters, - // Type parameters are inherited from the enclosing declaration, so if - // it has issues, so do the constructors. - inErrorRecovery: inErrorRecovery); - List? formals = member.formals; - if (formals != null && formals.isNotEmpty) { - for (FormalParameterBuilder formal in formals) { - List issues = - getInboundReferenceIssuesInType(formal.type); - reportIssues(issues); - _recursivelyReportGenericFunctionTypesAsBoundsForType(formal.type); - } - } - } - - void processSourceMemberBuilder(SourceMemberBuilder member, - {required bool inErrorRecovery}) { - if (member is SourceProcedureBuilder) { - processSourceProcedureBuilder(member); - } else if (member is SourceFieldBuilder) { - processSourceFieldBuilder(member); - } else { - assert(member is SourceFactoryBuilder || - member is SourceConstructorBuilder); - processSourceConstructorBuilder(member as SourceFunctionBuilder, - inErrorRecovery: inErrorRecovery); - } - } + List unboundTypeParameters = []; + ComputeDefaultTypeContext context = new ComputeDefaultTypeContext( + _problemReporting, libraryFeatures, unboundTypeParameters, + dynamicType: dynamicType, bottomType: bottomType); - void computeDefaultValuesForDeclaration(Builder declaration) { - if (declaration is SourceClassBuilder) { - List issues = getNonSimplicityIssuesForDeclaration( - declaration, - performErrorRecovery: true); - reportIssues(issues); - count += computeDefaultTypesForVariables(declaration.typeParameters, - inErrorRecovery: issues.isNotEmpty); - - Iterator iterator = declaration.nameSpace - .filteredConstructorIterator( - parent: declaration, - includeDuplicates: false, - includeAugmentations: true); - while (iterator.moveNext()) { - processSourceMemberBuilder(iterator.current, - inErrorRecovery: issues.isNotEmpty); - } - - Iterator memberIterator = - declaration.fullMemberIterator(); - while (memberIterator.moveNext()) { - SourceMemberBuilder member = memberIterator.current; - processSourceMemberBuilder(member, - inErrorRecovery: issues.isNotEmpty); - } + Iterator iterator = libraryBuilder.localMembersIterator; + while (iterator.moveNext()) { + Builder declaration = iterator.current; + if (declaration is SourceDeclarationBuilder) { + count += declaration.computeDefaultTypes(context); } else if (declaration is SourceTypeAliasBuilder) { - List issues = getNonSimplicityIssuesForDeclaration( - declaration, - performErrorRecovery: true); - issues.addAll(getInboundReferenceIssuesInType(declaration.type)); - reportIssues(issues); - count += computeDefaultTypesForVariables(declaration.typeParameters, - inErrorRecovery: issues.isNotEmpty); - _recursivelyReportGenericFunctionTypesAsBoundsForType(declaration.type); + count += declaration.computeDefaultType(context); } else if (declaration is SourceMemberBuilder) { - processSourceMemberBuilder(declaration, inErrorRecovery: false); - } else if (declaration is SourceExtensionBuilder) { - List issues = getNonSimplicityIssuesForDeclaration( - declaration, - performErrorRecovery: true); - reportIssues(issues); - count += computeDefaultTypesForVariables(declaration.typeParameters, - inErrorRecovery: issues.isNotEmpty); - - declaration.forEach((String name, Builder member) { - if (member is SourceMemberBuilder) { - processSourceMemberBuilder(member, - inErrorRecovery: issues.isNotEmpty); - } else { - // Coverage-ignore-block(suite): Not run. - assert(false, - "Unexpected extension member $member (${member.runtimeType})."); - } - }); - } else if (declaration is SourceExtensionTypeDeclarationBuilder) { - List issues = getNonSimplicityIssuesForDeclaration( - declaration, - performErrorRecovery: true); - reportIssues(issues); - count += computeDefaultTypesForVariables(declaration.typeParameters, - inErrorRecovery: issues.isNotEmpty); - - Iterator iterator = declaration.nameSpace - .filteredConstructorIterator( - parent: declaration, - includeDuplicates: false, - includeAugmentations: true); - while (iterator.moveNext()) { - processSourceMemberBuilder(iterator.current, - inErrorRecovery: issues.isNotEmpty); - } - - declaration.forEach((String name, Builder member) { - if (member is SourceMemberBuilder) { - processSourceMemberBuilder(member, - inErrorRecovery: issues.isNotEmpty); - } else { - // Coverage-ignore-block(suite): Not run. - assert( - false, - "Unexpected extension type member " - "$member (${member.runtimeType})."); - } - }); + count += + declaration.computeDefaultTypes(context, inErrorRecovery: false); } else { // Coverage-ignore-block(suite): Not run. assert( @@ -1122,102 +948,10 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit { } } - Iterator iterator = libraryBuilder.localMembersIterator; - while (iterator.moveNext()) { - computeDefaultValuesForDeclaration(iterator.current); - } - return count; - } - - /// Reports an error on generic function types used as bounds - /// - /// The function recursively searches for all generic function types in - /// [typeParameter.bound] and checks the bounds of type parameters of the - /// found types for being generic function types. Additionally, the function - /// checks [typeParameter.bound] for being a generic function type. Returns - /// `true` if any errors were reported. - bool _recursivelyReportGenericFunctionTypesAsBoundsForVariable( - NominalParameterBuilder typeParameter) { - if (libraryFeatures.genericMetadata.isEnabled) return false; - - bool hasReportedErrors = false; - hasReportedErrors = _reportGenericFunctionTypeAsBoundIfNeeded( - typeParameter.bound, - typeParameterName: typeParameter.name, - fileUri: typeParameter.fileUri, - charOffset: typeParameter.fileOffset) || - hasReportedErrors; - hasReportedErrors = _recursivelyReportGenericFunctionTypesAsBoundsForType( - typeParameter.bound) || - hasReportedErrors; - return hasReportedErrors; - } - - /// Reports an error on generic function types used as bounds - /// - /// The function recursively searches for all generic function types in - /// [typeBuilder] and checks the bounds of type parameters of the found types - /// for being generic function types. Returns `true` if any errors were - /// reported. - bool _recursivelyReportGenericFunctionTypesAsBoundsForType( - TypeBuilder? typeBuilder) { - if (libraryFeatures.genericMetadata.isEnabled) return false; - - List genericFunctionTypeBuilders = - []; - findUnaliasedGenericFunctionTypes(typeBuilder, - result: genericFunctionTypeBuilders); - bool hasReportedErrors = false; - for (FunctionTypeBuilder genericFunctionTypeBuilder - in genericFunctionTypeBuilders) { - assert( - genericFunctionTypeBuilder.typeParameters != null, - "Function 'findUnaliasedGenericFunctionTypes' " - "returned a function type without type parameters."); - for (StructuralParameterBuilder typeParameter - in genericFunctionTypeBuilder.typeParameters!) { - hasReportedErrors = _reportGenericFunctionTypeAsBoundIfNeeded( - typeParameter.bound, - typeParameterName: typeParameter.name, - fileUri: typeParameter.fileUri, - charOffset: typeParameter.fileOffset) || - hasReportedErrors; - } - } - return hasReportedErrors; - } - - /// Reports an error if [bound] is a generic function type - /// - /// Returns `true` if any errors were reported. - bool _reportGenericFunctionTypeAsBoundIfNeeded(TypeBuilder? bound, - {required String typeParameterName, - Uri? fileUri, - required int charOffset}) { - if (libraryFeatures.genericMetadata.isEnabled) return false; - - bool isUnaliasedGenericFunctionType = bound is FunctionTypeBuilder && - bound.typeParameters != null && - bound.typeParameters!.isNotEmpty; - bool isAliasedGenericFunctionType = false; - TypeDeclarationBuilder? declaration = bound?.declaration; - // TODO(cstefantsova): Unalias beyond the first layer for the check. - if (declaration is TypeAliasBuilder) { - // Coverage-ignore-block(suite): Not run. - TypeBuilder? rhsType = declaration.type; - if (rhsType is FunctionTypeBuilder && - rhsType.typeParameters != null && - rhsType.typeParameters!.isNotEmpty) { - isAliasedGenericFunctionType = true; - } - } + _builderFactoryResult + .registerUnresolvedStructuralParameters(unboundTypeParameters); - if (isUnaliasedGenericFunctionType || isAliasedGenericFunctionType) { - addProblem(messageGenericFunctionTypeInBound, charOffset, - typeParameterName.length, fileUri); - return true; - } - return false; + return count; } @override diff --git a/pkg/front_end/lib/src/source/source_constructor_builder.dart b/pkg/front_end/lib/src/source/source_constructor_builder.dart index e153565e658a..c1581c64993c 100644 --- a/pkg/front_end/lib/src/source/source_constructor_builder.dart +++ b/pkg/front_end/lib/src/source/source_constructor_builder.dart @@ -42,6 +42,7 @@ import '../kernel/kernel_helper.dart' TypeDependency, finishConstructorAugmentation, finishProcedureAugmentation; +import '../kernel/type_algorithms.dart'; import '../type_inference/inference_results.dart'; import '../type_inference/type_schema.dart'; import 'constructor_declaration.dart'; @@ -313,14 +314,8 @@ abstract class AbstractSourceConstructorBuilder formalParameterScope = null; } BodyBuilder bodyBuilder = libraryBuilder.loader - .createBodyBuilderForOutlineExpression( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: false, - inConstFields: false), - declarationScope, - fileUri, + .createBodyBuilderForOutlineExpression(libraryBuilder, + createBodyBuilderContext(), declarationScope, fileUri, formalParameterScope: formalParameterScope); if (isConst) { bodyBuilder.constantContext = ConstantContext.required; @@ -350,6 +345,17 @@ abstract class AbstractSourceConstructorBuilder return null; } + @override + int computeDefaultTypes(ComputeDefaultTypeContext context, + {required bool inErrorRecovery}) { + int count = context.computeDefaultTypesForVariables(typeParameters, + // Type parameters are inherited from the enclosing declaration, so if + // it has issues, so do the constructors. + inErrorRecovery: inErrorRecovery); + context.reportGenericFunctionTypesForFormals(formals); + return count; + } + @override // Coverage-ignore(suite): Not run. void checkVariance( @@ -652,14 +658,8 @@ class DeclaredSourceConstructorBuilder List? initializers; if (beginInitializers != null) { BodyBuilder bodyBuilder = libraryBuilder.loader - .createBodyBuilderForOutlineExpression( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false), - declarationBuilder.scope, - fileUri); + .createBodyBuilderForOutlineExpression(libraryBuilder, + createBodyBuilderContext(), declarationBuilder.scope, fileUri); if (isConst) { bodyBuilder.constantContext = ConstantContext.required; } @@ -1002,14 +1002,8 @@ class DeclaredSourceConstructorBuilder } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new ConstructorBodyBuilderContext(this, constructor, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new ConstructorBodyBuilderContext(this, constructor); } // TODO(johnniwinther): Add annotations to tear-offs. @@ -1061,6 +1055,10 @@ class SyntheticSourceConstructorBuilder extends MemberBuilderImpl _constructor = constructor, _constructorTearOff = constructorTearOff; + @override + // Coverage-ignore(suite): Not run. + Iterable? get metadataForTesting => null; + @override // Coverage-ignore(suite): Not run. int get fileOffset => _constructor.fileOffset; @@ -1199,6 +1197,14 @@ class SyntheticSourceConstructorBuilder extends MemberBuilderImpl } } + @override + // Coverage-ignore(suite): Not run. + int computeDefaultTypes(ComputeDefaultTypeContext context, + {required bool inErrorRecovery}) { + assert(false, "Unexpected call to $runtimeType.computeDefaultType"); + return 0; + } + @override // Coverage-ignore(suite): Not run. void checkVariance( @@ -1507,14 +1513,8 @@ class SourceExtensionTypeConstructorBuilder } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new ExtensionTypeConstructorBodyBuilderContext(this, _constructor, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new ExtensionTypeConstructorBodyBuilderContext(this, _constructor); } // TODO(johnniwinther): Add annotations to tear-offs. diff --git a/pkg/front_end/lib/src/source/source_enum_builder.dart b/pkg/front_end/lib/src/source/source_enum_builder.dart index 8d2eeae20c21..b6eeeb989f1a 100644 --- a/pkg/front_end/lib/src/source/source_enum_builder.dart +++ b/pkg/front_end/lib/src/source/source_enum_builder.dart @@ -574,14 +574,8 @@ class SourceEnumBuilder extends SourceClassBuilder { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new EnumBodyBuilderContext(this, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new EnumBodyBuilderContext(this); } DartType buildElement(SourceFieldBuilder fieldBuilder, CoreTypes coreTypes) { @@ -643,13 +637,7 @@ class SourceEnumBuilder extends SourceClassBuilder { // be built via a body builder to detect potential errors. BodyBuilder bodyBuilder = libraryBuilder.loader .createBodyBuilderForOutlineExpression( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: false, - inConstFields: false), - scope, - fileUri); + libraryBuilder, createBodyBuilderContext(), scope, fileUri); bodyBuilder.constantContext = ConstantContext.inferred; if (enumConstantInfo.argumentsBeginToken != null) { diff --git a/pkg/front_end/lib/src/source/source_extension_builder.dart b/pkg/front_end/lib/src/source/source_extension_builder.dart index 27f957f4e220..7e43fd8f2fc2 100644 --- a/pkg/front_end/lib/src/source/source_extension_builder.dart +++ b/pkg/front_end/lib/src/source/source_extension_builder.dart @@ -132,10 +132,6 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl // Coverage-ignore(suite): Not run. bool get isConst => _modifiers.isConst; - @override - // Coverage-ignore(suite): Not run. - bool get isFinal => _modifiers.isFinal; - @override // Coverage-ignore(suite): Not run. bool get isStatic => _modifiers.isStatic; @@ -188,14 +184,8 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new ExtensionBodyBuilderContext(this, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new ExtensionBodyBuilderContext(this); } @override @@ -223,10 +213,7 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl MetadataBuilder.buildAnnotations( annotatable, _introductory.metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), libraryBuilder, _introductory.fileUri, libraryBuilder.scope); diff --git a/pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart b/pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart index 3f3bf83cd34c..c281084a0fa8 100644 --- a/pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart +++ b/pkg/front_end/lib/src/source/source_extension_type_declaration_builder.dart @@ -151,10 +151,6 @@ class SourceExtensionTypeDeclarationBuilder // Coverage-ignore(suite): Not run. bool get isConst => _modifiers.isConst; - @override - // Coverage-ignore(suite): Not run. - bool get isFinal => _modifiers.isFinal; - @override // Coverage-ignore(suite): Not run. bool get isStatic => _modifiers.isStatic; @@ -734,10 +730,7 @@ class SourceExtensionTypeDeclarationBuilder MetadataBuilder.buildAnnotations( annotatable, _introductory.metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), libraryBuilder, _introductory.fileUri, libraryBuilder.scope); @@ -936,14 +929,8 @@ class SourceExtensionTypeDeclarationBuilder bool get isMixinDeclaration => false; @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new ExtensionTypeBodyBuilderContext(this, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new ExtensionTypeBodyBuilderContext(this); } /// Return a map whose keys are the supertypes of this diff --git a/pkg/front_end/lib/src/source/source_factory_builder.dart b/pkg/front_end/lib/src/source/source_factory_builder.dart index 48ee0dd679a9..d7e263ad2a3c 100644 --- a/pkg/front_end/lib/src/source/source_factory_builder.dart +++ b/pkg/front_end/lib/src/source/source_factory_builder.dart @@ -33,6 +33,7 @@ import '../kernel/body_builder_context.dart'; import '../kernel/constructor_tearoff_lowering.dart'; import '../kernel/hierarchy/class_member.dart'; import '../kernel/kernel_helper.dart'; +import '../kernel/type_algorithms.dart'; import '../type_inference/inference_helper.dart'; import '../type_inference/type_inferrer.dart'; import '../type_inference/type_schema.dart'; @@ -300,6 +301,17 @@ class SourceFactoryBuilder extends SourceFunctionBuilderImpl { return 1; } + @override + int computeDefaultTypes(ComputeDefaultTypeContext context, + {required bool inErrorRecovery}) { + int count = context.computeDefaultTypesForVariables(typeParameters, + // Type parameters are inherited from the enclosing declaration, so if + // it has issues, so do the constructors. + inErrorRecovery: inErrorRecovery); + context.reportGenericFunctionTypesForFormals(formals); + return count; + } + @override // Coverage-ignore(suite): Not run. void checkVariance( @@ -333,14 +345,8 @@ class SourceFactoryBuilder extends SourceFunctionBuilderImpl { void _checkRedirectingFactory(TypeEnvironment typeEnvironment) {} @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new FactoryBodyBuilderContext(this, _procedure, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new FactoryBodyBuilderContext(this, _procedure); } @override @@ -523,14 +529,8 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder { .createLocalTypeInferrer( fileUri, declarationBuilder.thisType, libraryBuilder, null); InferenceHelper helper = libraryBuilder.loader - .createBodyBuilderForOutlineExpression( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: false, - inConstFields: false), - declarationBuilder.scope, - fileUri); + .createBodyBuilderForOutlineExpression(libraryBuilder, + createBodyBuilderContext(), declarationBuilder.scope, fileUri); Builder? targetBuilder = redirectionTarget.target; if (targetBuilder is SourceMemberBuilder) { // Ensure that target has been built. @@ -893,13 +893,7 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new RedirectingFactoryBodyBuilderContext(this, _procedure, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new RedirectingFactoryBodyBuilderContext(this, _procedure); } } diff --git a/pkg/front_end/lib/src/source/source_field_builder.dart b/pkg/front_end/lib/src/source/source_field_builder.dart index 2daea1b4dc55..ba728afdfe3b 100644 --- a/pkg/front_end/lib/src/source/source_field_builder.dart +++ b/pkg/front_end/lib/src/source/source_field_builder.dart @@ -33,6 +33,7 @@ import '../kernel/internal_ast.dart'; import '../kernel/kernel_helper.dart'; import '../kernel/late_lowering.dart' as late_lowering; import '../kernel/member_covariance.dart'; +import '../kernel/type_algorithms.dart'; import '../source/name_scheme.dart'; import '../source/source_extension_builder.dart'; import '../source/source_library_builder.dart' show SourceLibraryBuilder; @@ -52,7 +53,6 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl final MemberName _memberName; - @override final Modifiers modifiers; late FieldEncoding _fieldEncoding; @@ -316,6 +316,30 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl } } + @override + // Coverage-ignore(suite): Not run. + Iterable? get metadataForTesting => metadata; + + @override + bool get isAugmentation => modifiers.isAugment; + + @override + bool get isExternal => modifiers.isExternal; + + @override + bool get isAbstract => modifiers.isAbstract; + + @override + bool get isConst => modifiers.isConst; + + bool get isFinal => modifiers.isFinal; + + @override + bool get isStatic => modifiers.isStatic; + + @override + bool get isAugment => modifiers.isAugment; + @override Builder get parent => declarationBuilder ?? libraryBuilder; @@ -443,14 +467,8 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new FieldBodyBuilderContext(this, _fieldEncoding.builtMember, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new FieldBodyBuilderContext(this, _fieldEncoding.builtMember); } @override @@ -463,10 +481,7 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl MetadataBuilder.buildAnnotations( annotatable, metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), libraryBuilder, fileUri, declarationBuilder?.scope ?? libraryBuilder.scope); @@ -484,13 +499,7 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl LookupScope scope = declarationBuilder?.scope ?? libraryBuilder.scope; BodyBuilder bodyBuilder = libraryBuilder.loader .createBodyBuilderForOutlineExpression( - libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: false, - inConstFields: false), - scope, - fileUri); + libraryBuilder, createBodyBuilderContext(), scope, fileUri); bodyBuilder.constantContext = isConst ? ConstantContext.inferred : ConstantContext.required; Expression initializer = bodyBuilder.typeInferrer @@ -587,6 +596,17 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl List get localSetters => _localSetters ??= _fieldEncoding.getLocalSetters(this); + @override + int computeDefaultTypes(ComputeDefaultTypeContext context, + {required bool inErrorRecovery}) { + TypeBuilder? fieldType = type; + if (fieldType is! OmittedTypeBuilder) { + context.reportInboundReferenceIssuesForType(fieldType); + context.recursivelyReportGenericFunctionTypesAsBoundsForType(fieldType); + } + return 0; + } + @override void checkVariance( SourceClassBuilder sourceClassBuilder, TypeEnvironment typeEnvironment) { diff --git a/pkg/front_end/lib/src/source/source_function_builder.dart b/pkg/front_end/lib/src/source/source_function_builder.dart index 1d5626dcc168..70d6b55ea7ec 100644 --- a/pkg/front_end/lib/src/source/source_function_builder.dart +++ b/pkg/front_end/lib/src/source/source_function_builder.dart @@ -121,7 +121,6 @@ abstract class SourceFunctionBuilderImpl extends SourceMemberBuilderImpl @override final List? metadata; - @override final Modifiers modifiers; @override @@ -153,14 +152,33 @@ abstract class SourceFunctionBuilderImpl extends SourceMemberBuilderImpl } } + @override + // Coverage-ignore(suite): Not run. + Iterable? get metadataForTesting => metadata; + AsyncMarker get asyncModifier; @override - bool get isConstructor => false; + bool get isAugmentation => modifiers.isAugment; + + @override + bool get isExternal => modifiers.isExternal; @override bool get isAbstract => modifiers.isAbstract; + @override + bool get isConst => modifiers.isConst; + + @override + bool get isStatic => modifiers.isStatic; + + @override + bool get isAugment => modifiers.isAugment; + + @override + bool get isConstructor => false; + @override bool get isRegularMethod => identical(ProcedureKind.Method, kind); @@ -176,9 +194,6 @@ abstract class SourceFunctionBuilderImpl extends SourceMemberBuilderImpl @override bool get isFactory => identical(ProcedureKind.Factory, kind); - @override - bool get isExternal => modifiers.isExternal; - @override // Coverage-ignore(suite): Not run. bool get isAssignable => false; @@ -461,26 +476,15 @@ abstract class SourceFunctionBuilderImpl extends SourceMemberBuilderImpl LookupScope parentScope = classOrExtensionBuilder?.scope ?? libraryBuilder.scope; for (Annotatable annotatable in annotatables) { - MetadataBuilder.buildAnnotations( - annotatable, - metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - libraryBuilder, - fileUri, - parentScope, + MetadataBuilder.buildAnnotations(annotatable, metadata, + createBodyBuilderContext(), libraryBuilder, fileUri, parentScope, createFileUriExpression: isAugmented); } if (typeParameters != null) { for (int i = 0; i < typeParameters!.length; i++) { typeParameters![i].buildOutlineExpressions( libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), classHierarchy, computeTypeParameterScope(parentScope)); } diff --git a/pkg/front_end/lib/src/source/source_library_builder.dart b/pkg/front_end/lib/src/source/source_library_builder.dart index e20a40250794..8542f9de4c9d 100644 --- a/pkg/front_end/lib/src/source/source_library_builder.dart +++ b/pkg/front_end/lib/src/source/source_library_builder.dart @@ -55,14 +55,7 @@ import '../kernel/body_builder_context.dart'; import '../kernel/internal_ast.dart'; import '../kernel/kernel_helper.dart'; import '../kernel/macro/macro.dart'; -import '../kernel/type_algorithms.dart' - show - NonSimplicityIssue, - calculateBounds, - findUnaliasedGenericFunctionTypes, - getInboundReferenceIssuesInType, - getNonSimplicityIssuesForDeclaration, - getNonSimplicityIssuesForTypeParameters; +import '../kernel/type_algorithms.dart' show ComputeDefaultTypeContext; import '../kernel/utils.dart' show compareProcedures, @@ -1237,14 +1230,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { } } - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new LibraryBodyBuilderContext(this, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new LibraryBodyBuilderContext(this); } void buildOutlineExpressions(ClassHierarchy classHierarchy, @@ -1259,15 +1246,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { } MetadataBuilder.buildAnnotations( - library, - metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), - this, - fileUri, - scope, + library, metadata, createBodyBuilderContext(), this, fileUri, scope, createFileUriExpression: isAugmenting); Iterator iterator = localMembersIterator; @@ -1725,6 +1704,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl { } } else { if (issueInferred) { + // Coverage-ignore-block(suite): Not run. message = templateIncorrectTypeArgumentInstantiationInferred .withArguments(argument, typeParameter.bound, typeParameter.name!, targetReceiver); diff --git a/pkg/front_end/lib/src/source/source_loader.dart b/pkg/front_end/lib/src/source/source_loader.dart index cc951d256a96..d86b2c2ae7a6 100644 --- a/pkg/front_end/lib/src/source/source_loader.dart +++ b/pkg/front_end/lib/src/source/source_loader.dart @@ -1386,10 +1386,7 @@ severity: $severity BodyBuilder listener = dietListener.createListener( new ExpressionCompilerProcedureBodyBuildContext( dietListener, builder, builder.invokeTarget!, - isDeclarationInstanceMember: isClassInstanceMember, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false), + isDeclarationInstanceMember: isClassInstanceMember), dietListener.memberScope, thisVariable: extensionThis); builder.procedure.function = parameters..parent = builder.procedure; diff --git a/pkg/front_end/lib/src/source/source_member_builder.dart b/pkg/front_end/lib/src/source/source_member_builder.dart index 1f31c6bdc192..435163a83a05 100644 --- a/pkg/front_end/lib/src/source/source_member_builder.dart +++ b/pkg/front_end/lib/src/source/source_member_builder.dart @@ -9,11 +9,12 @@ import 'package:kernel/class_hierarchy.dart'; import 'package:kernel/type_environment.dart'; import '../base/common.dart'; -import '../base/modifiers.dart'; import '../base/problems.dart' show unsupported; import '../builder/member_builder.dart'; +import '../builder/metadata_builder.dart'; import '../kernel/body_builder_context.dart'; import '../kernel/kernel_helper.dart'; +import '../kernel/type_algorithms.dart'; import '../type_inference/type_inference_engine.dart' show InferenceDataForTesting; import 'source_class_builder.dart'; @@ -25,6 +26,8 @@ typedef BuildNodesCallback = void Function( abstract class SourceMemberBuilder implements MemberBuilder { MemberDataForTesting? get dataForTesting; + Iterable? get metadataForTesting; + @override SourceLibraryBuilder get libraryBuilder; @@ -39,6 +42,9 @@ abstract class SourceMemberBuilder implements MemberBuilder { /// This includes adding augmented bodies and augmented members. int buildBodyNodes(BuildNodesCallback f); + int computeDefaultTypes(ComputeDefaultTypeContext context, + {required bool inErrorRecovery}); + /// Checks the variance of type parameters [sourceClassBuilder] used in the /// signature of this member. void checkVariance( @@ -58,10 +64,7 @@ abstract class SourceMemberBuilder implements MemberBuilder { AugmentSuperTarget? get augmentSuperTarget; - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}); + BodyBuilderContext createBodyBuilderContext(); } mixin SourceMemberBuilderMixin implements SourceMemberBuilder { @@ -100,10 +103,7 @@ mixin SourceMemberBuilderMixin implements SourceMemberBuilder { } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { + BodyBuilderContext createBodyBuilderContext() { throw new UnimplementedError('$runtimeType.bodyBuilderContext'); } } @@ -120,29 +120,6 @@ abstract class SourceMemberBuilderImpl extends MemberBuilderImpl new MemberDataForTesting() : null; - Modifiers get modifiers; - - @override - bool get isAugmentation => modifiers.isAugment; - - @override - bool get isExternal => modifiers.isExternal; - - @override - bool get isAbstract => modifiers.isAbstract; - - @override - bool get isConst => modifiers.isConst; - - @override - bool get isFinal => modifiers.isFinal; - - @override - bool get isStatic => modifiers.isStatic; - - @override - bool get isAugment => modifiers.isAugment; - bool? _isConflictingSetter; @override diff --git a/pkg/front_end/lib/src/source/source_procedure_builder.dart b/pkg/front_end/lib/src/source/source_procedure_builder.dart index 377d42f90860..7af894cba453 100644 --- a/pkg/front_end/lib/src/source/source_procedure_builder.dart +++ b/pkg/front_end/lib/src/source/source_procedure_builder.dart @@ -20,6 +20,7 @@ import '../kernel/hierarchy/class_member.dart'; import '../kernel/hierarchy/members_builder.dart'; import '../kernel/kernel_helper.dart'; import '../kernel/member_covariance.dart'; +import '../kernel/type_algorithms.dart'; import 'name_scheme.dart'; import 'source_builder_mixins.dart'; import 'source_class_builder.dart'; @@ -683,14 +684,22 @@ class SourceProcedureBuilder extends SourceFunctionBuilderImpl } @override - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new ProcedureBodyBuilderContext(this, procedure, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + int computeDefaultTypes(ComputeDefaultTypeContext context, + {required bool inErrorRecovery}) { + bool hasErrors = + context.reportSimplicityIssuesForTypeParameters(typeParameters); + context.reportGenericFunctionTypesForFormals(formals); + if (returnType is! OmittedTypeBuilder) { + hasErrors |= context.reportInboundReferenceIssuesForType(returnType); + context.recursivelyReportGenericFunctionTypesAsBoundsForType(returnType); + } + return context.computeDefaultTypesForVariables(typeParameters, + inErrorRecovery: hasErrors); + } + + @override + BodyBuilderContext createBodyBuilderContext() { + return new ProcedureBodyBuilderContext(this, procedure); } // TODO(johnniwinther): Add annotations to tear-offs. diff --git a/pkg/front_end/lib/src/source/source_type_alias_builder.dart b/pkg/front_end/lib/src/source/source_type_alias_builder.dart index cdeb295e4f6e..37a290ac12ac 100644 --- a/pkg/front_end/lib/src/source/source_type_alias_builder.dart +++ b/pkg/front_end/lib/src/source/source_type_alias_builder.dart @@ -24,6 +24,7 @@ import '../kernel/body_builder_context.dart'; import '../kernel/constructor_tearoff_lowering.dart'; import '../kernel/expression_generator_helper.dart'; import '../kernel/kernel_helper.dart'; +import '../kernel/type_algorithms.dart'; import 'source_library_builder.dart' show SourceLibraryBuilder; import 'source_loader.dart'; @@ -362,14 +363,8 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl { growable: true); } - BodyBuilderContext createBodyBuilderContext( - {required bool inOutlineBuildingPhase, - required bool inMetadata, - required bool inConstFields}) { - return new TypedefBodyBuilderContext(this, - inOutlineBuildingPhase: inOutlineBuildingPhase, - inMetadata: inMetadata, - inConstFields: inConstFields); + BodyBuilderContext createBodyBuilderContext() { + return new TypedefBodyBuilderContext(this); } void buildOutlineExpressions(ClassHierarchy classHierarchy, @@ -377,10 +372,7 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl { MetadataBuilder.buildAnnotations( typedef, _introductory.metadata, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), libraryBuilder, fileUri, libraryBuilder.scope); @@ -388,10 +380,7 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl { for (int i = 0; i < typeParameters!.length; i++) { typeParameters![i].buildOutlineExpressions( libraryBuilder, - createBodyBuilderContext( - inOutlineBuildingPhase: true, - inMetadata: true, - inConstFields: false), + createBodyBuilderContext(), classHierarchy, computeTypeParameterScope(libraryBuilder.scope)); } @@ -403,6 +392,15 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl { }); } + int computeDefaultType(ComputeDefaultTypeContext context) { + bool hasErrors = context.reportNonSimplicityIssues(this, typeParameters); + hasErrors |= context.reportInboundReferenceIssuesForType(type); + int count = context.computeDefaultTypesForVariables(typeParameters, + inErrorRecovery: hasErrors); + context.recursivelyReportGenericFunctionTypesAsBoundsForType(type); + return count; + } + LookupScope computeTypeParameterScope(LookupScope parent) { if (typeParameters == null) return parent; Map local = {}; diff --git a/pkg/front_end/lib/src/source/type_parameter_scope_builder.dart b/pkg/front_end/lib/src/source/type_parameter_scope_builder.dart index 858ce53f61b8..ad79ce9a1afb 100644 --- a/pkg/front_end/lib/src/source/type_parameter_scope_builder.dart +++ b/pkg/front_end/lib/src/source/type_parameter_scope_builder.dart @@ -1326,7 +1326,6 @@ class DeclarationBuilderScope implements LookupScope { } @override - // Coverage-ignore(suite): Not run. Builder? lookupSetable(String name, int charOffset, Uri fileUri) { return _declarationBuilder?.scope.lookupSetable(name, charOffset, fileUri); } diff --git a/pkg/front_end/lib/src/type_inference/inference_visitor.dart b/pkg/front_end/lib/src/type_inference/inference_visitor.dart index d0004ff94662..becb3f15699b 100644 --- a/pkg/front_end/lib/src/type_inference/inference_visitor.dart +++ b/pkg/front_end/lib/src/type_inference/inference_visitor.dart @@ -2864,6 +2864,8 @@ class InferenceVisitorImpl extends InferenceVisitorBase gatherer = typeSchemaEnvironment.setupGenericTypeInference( listType, typeParametersToInfer, typeContext, isConst: node.isConst, + inferenceUsingBoundsIsEnabled: + libraryFeatures.inferenceUsingBounds.isEnabled, typeOperations: operations, inferenceResultForTesting: dataForTesting // Coverage-ignore(suite): Not run. @@ -5294,6 +5296,8 @@ class InferenceVisitorImpl extends InferenceVisitorBase gatherer = typeSchemaEnvironment.setupGenericTypeInference( mapType, typeParametersToInfer, typeContext, isConst: node.isConst, + inferenceUsingBoundsIsEnabled: + libraryFeatures.inferenceUsingBounds.isEnabled, typeOperations: operations, inferenceResultForTesting: dataForTesting // Coverage-ignore(suite): Not run. @@ -5376,6 +5380,8 @@ class InferenceVisitorImpl extends InferenceVisitorBase typeSchemaEnvironment.setupGenericTypeInference( setType, typeParametersToInfer, typeContext, isConst: node.isConst, + inferenceUsingBoundsIsEnabled: + libraryFeatures.inferenceUsingBounds.isEnabled, typeOperations: operations, inferenceResultForTesting: dataForTesting // Coverage-ignore(suite): Not run. @@ -8670,6 +8676,8 @@ class InferenceVisitorImpl extends InferenceVisitorBase gatherer = typeSchemaEnvironment.setupGenericTypeInference( setType, typeParametersToInfer, typeContext, isConst: node.isConst, + inferenceUsingBoundsIsEnabled: + libraryFeatures.inferenceUsingBounds.isEnabled, typeOperations: operations, inferenceResultForTesting: dataForTesting // Coverage-ignore(suite): Not run. @@ -11796,6 +11804,8 @@ class InferenceVisitorImpl extends InferenceVisitorBase TypeConstraintGatherer gatherer = typeSchemaEnvironment.setupGenericTypeInference( declaredType, typeParametersToInfer, contextType, + inferenceUsingBoundsIsEnabled: + libraryFeatures.inferenceUsingBounds.isEnabled, typeOperations: operations, inferenceResultForTesting: dataForTesting // Coverage-ignore(suite): Not run. diff --git a/pkg/front_end/lib/src/type_inference/inference_visitor_base.dart b/pkg/front_end/lib/src/type_inference/inference_visitor_base.dart index 6e4cdc0188b1..222cf279108d 100644 --- a/pkg/front_end/lib/src/type_inference/inference_visitor_base.dart +++ b/pkg/front_end/lib/src/type_inference/inference_visitor_base.dart @@ -961,6 +961,8 @@ abstract class InferenceVisitorBase implements InferenceVisitor { TypeConstraintGatherer gatherer = typeSchemaEnvironment .setupGenericTypeInference(null, typeParameters, null, typeOperations: cfeOperations, + inferenceUsingBoundsIsEnabled: + libraryFeatures.inferenceUsingBounds.isEnabled, inferenceResultForTesting: dataForTesting // Coverage-ignore(suite): Not run. ?.typeInferenceResult, @@ -1643,6 +1645,8 @@ abstract class InferenceVisitorBase implements InferenceVisitor { } gatherer = typeSchemaEnvironment.setupGenericTypeInference( calleeType.returnType, calleeTypeParameters, typeContext, + inferenceUsingBoundsIsEnabled: + libraryFeatures.inferenceUsingBounds.isEnabled, typeOperations: cfeOperations, inferenceResultForTesting: dataForTesting // Coverage-ignore(suite): Not run. @@ -3614,6 +3618,8 @@ abstract class InferenceVisitorBase implements InferenceVisitor { TypeConstraintGatherer gatherer = typeSchemaEnvironment.setupGenericTypeInference( instantiatedType, typeParameters, context, + inferenceUsingBoundsIsEnabled: + libraryFeatures.inferenceUsingBounds.isEnabled, typeOperations: cfeOperations, inferenceResultForTesting: dataForTesting // Coverage-ignore(suite): Not run. diff --git a/pkg/front_end/lib/src/type_inference/type_constraint_gatherer.dart b/pkg/front_end/lib/src/type_inference/type_constraint_gatherer.dart index 21669723232e..ec33505d312d 100644 --- a/pkg/front_end/lib/src/type_inference/type_constraint_gatherer.dart +++ b/pkg/front_end/lib/src/type_inference/type_constraint_gatherer.dart @@ -50,7 +50,8 @@ class TypeConstraintGatherer extends shared.TypeConstraintGenerator< TypeConstraintGatherer( this._environment, Iterable typeParameters, {required OperationsCfe typeOperations, - required TypeInferenceResultForTesting? inferenceResultForTesting}) + required TypeInferenceResultForTesting? inferenceResultForTesting, + required super.inferenceUsingBoundsIsEnabled}) : typeOperations = typeOperations, _parametersToConstrain = new List.of(typeParameters), @@ -266,7 +267,12 @@ class TypeConstraintGatherer extends shared.TypeConstraintGenerator< if (typeOperations.matchInferableParameter(new SharedTypeView(q)) case StructuralParameter qParameter? when qNullability == NullabilitySuffix.none && - _parametersToConstrain.contains(qParameter)) { + _parametersToConstrain.contains(qParameter) && + (!inferenceUsingBoundsIsEnabled || + typeOperations.isSubtypeOfInternal( + p, + typeOperations.greatestClosureOfTypeInternal( + qParameter.bound, _parametersToConstrain)))) { _constrainParameterLower(qParameter, p, treeNodeForTesting: treeNodeForTesting); return true; diff --git a/pkg/front_end/lib/src/type_inference/type_inference_engine.dart b/pkg/front_end/lib/src/type_inference/type_inference_engine.dart index 61cbc99e78ba..b833a669c704 100644 --- a/pkg/front_end/lib/src/type_inference/type_inference_engine.dart +++ b/pkg/front_end/lib/src/type_inference/type_inference_engine.dart @@ -985,6 +985,17 @@ class OperationsCfe return type.unwrapTypeView() == typeEnvironment.coreTypes.functionNonNullableRawType; } + + @override + DartType greatestClosureOfTypeInternal(DartType type, + List> typeParametersToEliminate) { + return new NullabilityAwareFreeTypeParameterEliminator( + bottomType: const NeverType.nonNullable(), + topType: typeEnvironment.coreTypes.objectNullableRawType, + topFunctionType: typeEnvironment.coreTypes + .functionRawType(Nullability.nonNullable)) + .eliminateToGreatest(type); + } } /// Type inference results used for testing. diff --git a/pkg/front_end/lib/src/type_inference/type_schema_environment.dart b/pkg/front_end/lib/src/type_inference/type_schema_environment.dart index 8498a280af54..364aeab58049 100644 --- a/pkg/front_end/lib/src/type_inference/type_schema_environment.dart +++ b/pkg/front_end/lib/src/type_inference/type_schema_environment.dart @@ -233,6 +233,8 @@ class TypeSchemaEnvironment extends HierarchyBasedTypeEnvironment TypeConstraintGatherer extendsConstraintGatherer = new TypeConstraintGatherer(this, typeParametersToInfer, typeOperations: operations, + inferenceUsingBoundsIsEnabled: + inferenceUsingBoundsIsEnabled, inferenceResultForTesting: null); extendsConstraintGatherer.tryConstrainLower(typeParamBound, mergedTypeConstraint.lower.unwrapTypeSchemaView(), @@ -350,6 +352,7 @@ class TypeSchemaEnvironment extends HierarchyBasedTypeEnvironment DartType? returnContextType, {bool isConst = false, required OperationsCfe typeOperations, + required bool inferenceUsingBoundsIsEnabled, required TypeInferenceResultForTesting? inferenceResultForTesting, required TreeNode? treeNodeForTesting}) { assert(typeParametersToInfer.isNotEmpty); @@ -361,6 +364,7 @@ class TypeSchemaEnvironment extends HierarchyBasedTypeEnvironment TypeConstraintGatherer gatherer = new TypeConstraintGatherer( this, typeParametersToInfer, typeOperations: typeOperations, + inferenceUsingBoundsIsEnabled: inferenceUsingBoundsIsEnabled, inferenceResultForTesting: inferenceResultForTesting); if (!isEmptyContext(returnContextType)) { diff --git a/pkg/front_end/test/coverage_suite_expected.dart b/pkg/front_end/test/coverage_suite_expected.dart index 680e528ff833..d6dfa505efc6 100644 --- a/pkg/front_end/test/coverage_suite_expected.dart +++ b/pkg/front_end/test/coverage_suite_expected.dart @@ -290,7 +290,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/builder/formal_parameter_builder.dart": ( - hitCount: 188, + hitCount: 186, missCount: 0, ), // 100.0%. @@ -480,7 +480,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/constructor.dart": ( - hitCount: 45, + hitCount: 44, missCount: 0, ), // 100.0%. @@ -500,7 +500,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/factory.dart": ( - hitCount: 35, + hitCount: 34, missCount: 0, ), // 100.0%. @@ -510,12 +510,12 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/getter.dart": ( - hitCount: 41, + hitCount: 40, missCount: 0, ), // 100.0%. "package:front_end/src/fragment/method.dart": ( - hitCount: 41, + hitCount: 40, missCount: 0, ), // 100.0%. @@ -530,12 +530,12 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/fragment/primary_constructor.dart": ( - hitCount: 44, + hitCount: 43, missCount: 0, ), // 100.0%. "package:front_end/src/fragment/setter.dart": ( - hitCount: 41, + hitCount: 40, missCount: 0, ), // 100.0%. @@ -739,6 +739,11 @@ const Map _expect = { missCount: 0, ), // 100.0%. + "package:front_end/src/kernel/macro/metadata.dart": ( + hitCount: 1, + missCount: 0, + ), + // 100.0%. "package:front_end/src/kernel/macro/offsets.dart": ( hitCount: 0, missCount: 0, @@ -770,7 +775,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/kernel/type_algorithms.dart": ( - hitCount: 449, + hitCount: 533, missCount: 0, ), // 100.0%. @@ -835,7 +840,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/diet_listener.dart": ( - hitCount: 659, + hitCount: 658, missCount: 0, ), // 100.0%. @@ -855,7 +860,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/outline_builder.dart": ( - hitCount: 2121, + hitCount: 2119, missCount: 0, ), // 100.0%. @@ -865,27 +870,27 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/source_builder_factory.dart": ( - hitCount: 1261, + hitCount: 1275, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_builder_mixins.dart": ( - hitCount: 156, + hitCount: 172, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_class_builder.dart": ( - hitCount: 1263, + hitCount: 1279, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_compilation_unit.dart": ( - hitCount: 820, + hitCount: 642, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_constructor_builder.dart": ( - hitCount: 889, + hitCount: 894, missCount: 0, ), // 100.0%. @@ -906,22 +911,22 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/source_factory_builder.dart": ( - hitCount: 588, + hitCount: 593, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_field_builder.dart": ( - hitCount: 1209, + hitCount: 1235, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_function_builder.dart": ( - hitCount: 302, + hitCount: 314, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_library_builder.dart": ( - hitCount: 1360, + hitCount: 1356, missCount: 0, ), // 100.0%. @@ -931,17 +936,17 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/source_member_builder.dart": ( - hitCount: 35, + hitCount: 14, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_procedure_builder.dart": ( - hitCount: 528, + hitCount: 542, missCount: 0, ), // 100.0%. "package:front_end/src/source/source_type_alias_builder.dart": ( - hitCount: 348, + hitCount: 358, missCount: 0, ), // 100.0%. @@ -951,7 +956,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/source/type_parameter_scope_builder.dart": ( - hitCount: 786, + hitCount: 790, missCount: 0, ), // 100.0%. @@ -986,12 +991,12 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/type_inference/inference_visitor.dart": ( - hitCount: 8222, + hitCount: 8237, missCount: 0, ), // 100.0%. "package:front_end/src/type_inference/inference_visitor_base.dart": ( - hitCount: 2449, + hitCount: 2458, missCount: 0, ), // 100.0%. @@ -1021,7 +1026,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/type_inference/type_constraint_gatherer.dart": ( - hitCount: 304, + hitCount: 311, missCount: 0, ), // 100.0%. @@ -1031,7 +1036,7 @@ const Map _expect = { ), // 100.0%. "package:front_end/src/type_inference/type_inference_engine.dart": ( - hitCount: 510, + hitCount: 519, missCount: 0, ), // 100.0%. diff --git a/pkg/front_end/test/fasta/generator_to_string_test.dart b/pkg/front_end/test/fasta/generator_to_string_test.dart index e13ca1118f9c..a1107c2c159a 100644 --- a/pkg/front_end/test/fasta/generator_to_string_test.dart +++ b/pkg/front_end/test/fasta/generator_to_string_test.dart @@ -152,10 +152,7 @@ Future main() async { BodyBuilder helper = new BodyBuilder( libraryBuilder: libraryBuilder, - context: new LibraryBodyBuilderContext(libraryBuilder, - inOutlineBuildingPhase: false, - inMetadata: false, - inConstFields: false), + context: new LibraryBodyBuilderContext(libraryBuilder), uri: uri, enclosingScope: new FixedLocalScope(kind: ScopeKind.library, debugName: "dummy"), diff --git a/pkg/front_end/test/fasta/type_inference/type_constraint_gatherer_nnbd_test.dart b/pkg/front_end/test/fasta/type_inference/type_constraint_gatherer_nnbd_test.dart index 2022c981a743..6b613f30b777 100644 --- a/pkg/front_end/test/fasta/type_inference/type_constraint_gatherer_nnbd_test.dart +++ b/pkg/front_end/test/fasta/type_inference/type_constraint_gatherer_nnbd_test.dart @@ -28,6 +28,8 @@ class TypeConstraintGathererTest { 'UNKNOWN': () => new UnknownType() }; + final bool inferenceUsingBoundsIsEnabled = false; + late Library _coreLibrary; late Library _testLibrary; @@ -308,7 +310,8 @@ class TypeConstraintGathererTest { env.parseType(bound, additionalTypes: additionalTypes), testLibrary, expected, - typeParameterNodesToConstrain); + typeParameterNodesToConstrain, + inferenceUsingBoundsIsEnabled: inferenceUsingBoundsIsEnabled); }); } @@ -317,7 +320,8 @@ class TypeConstraintGathererTest { DartType bound, Library clientLibrary, List expectedConstraints, - List typeParameterNodesToConstrain) { + List typeParameterNodesToConstrain, + {required bool inferenceUsingBoundsIsEnabled}) { _checkConstraintsHelper( type, bound, @@ -325,7 +329,8 @@ class TypeConstraintGathererTest { expectedConstraints, (gatherer, type, bound) => gatherer.tryConstrainLower(type, bound, treeNodeForTesting: null), - typeParameterNodesToConstrain); + typeParameterNodesToConstrain, + inferenceUsingBoundsIsEnabled: inferenceUsingBoundsIsEnabled); } void checkConstraintsUpper(String type, String bound, List? expected, @@ -347,7 +352,8 @@ class TypeConstraintGathererTest { env.parseType(bound, additionalTypes: additionalTypes), testLibrary, expected, - typeParameterNodesToConstrain); + typeParameterNodesToConstrain, + inferenceUsingBoundsIsEnabled: inferenceUsingBoundsIsEnabled); }); } @@ -356,7 +362,8 @@ class TypeConstraintGathererTest { DartType bound, Library clientLibrary, List? expectedConstraints, - List typeParameterNodesToConstrain) { + List typeParameterNodesToConstrain, + {required bool inferenceUsingBoundsIsEnabled}) { _checkConstraintsHelper( type, bound, @@ -364,7 +371,8 @@ class TypeConstraintGathererTest { expectedConstraints, (gatherer, type, bound) => gatherer.tryConstrainUpper(type, bound, treeNodeForTesting: null), - typeParameterNodesToConstrain); + typeParameterNodesToConstrain, + inferenceUsingBoundsIsEnabled: inferenceUsingBoundsIsEnabled); } void _checkConstraintsHelper( @@ -373,7 +381,8 @@ class TypeConstraintGathererTest { Library clientLibrary, List? expectedConstraints, bool Function(TypeConstraintGatherer, DartType, DartType) tryConstrain, - List typeParameterNodesToConstrain) { + List typeParameterNodesToConstrain, + {required bool inferenceUsingBoundsIsEnabled}) { var typeSchemaEnvironment = new TypeSchemaEnvironment( coreTypes, new ClassHierarchy(component, coreTypes)); var typeConstraintGatherer = new TypeConstraintGatherer( @@ -384,7 +393,8 @@ class TypeConstraintGathererTest { typeCacheNonNullable: {}, typeCacheNullable: {}, typeCacheLegacy: {}), - inferenceResultForTesting: null); + inferenceResultForTesting: null, + inferenceUsingBoundsIsEnabled: inferenceUsingBoundsIsEnabled); var constraints = tryConstrain(typeConstraintGatherer, a, b) ? typeConstraintGatherer.computeConstraints() : null; diff --git a/pkg/front_end/test/fasta/type_inference/type_constraint_gatherer_test.dart b/pkg/front_end/test/fasta/type_inference/type_constraint_gatherer_test.dart index d3bcf142f206..5050c19e0c05 100644 --- a/pkg/front_end/test/fasta/type_inference/type_constraint_gatherer_test.dart +++ b/pkg/front_end/test/fasta/type_inference/type_constraint_gatherer_test.dart @@ -361,7 +361,8 @@ class TypeConstraintGathererTest { typeCacheNonNullable: {}, typeCacheNullable: {}, typeCacheLegacy: {}), - inferenceResultForTesting: null); + inferenceResultForTesting: null, + inferenceUsingBoundsIsEnabled: false); var constraints = tryConstrain(typeConstraintGatherer, a, b) ? typeConstraintGatherer.computeConstraints() : null; diff --git a/pkg/front_end/test/fasta/type_inference/type_schema_environment_test_base.dart b/pkg/front_end/test/fasta/type_inference/type_schema_environment_test_base.dart index 00ceaff19092..d9de904db0d8 100644 --- a/pkg/front_end/test/fasta/type_inference/type_schema_environment_test_base.dart +++ b/pkg/front_end/test/fasta/type_inference/type_schema_environment_test_base.dart @@ -173,6 +173,7 @@ abstract class TypeSchemaEnvironmentTestBase { declaredReturnTypeNode, typeParameterNodesToInfer, returnContextTypeNode, + inferenceUsingBoundsIsEnabled: false, typeOperations: new OperationsCfe(typeSchemaEnvironment, fieldNonPromotabilityInfo: new FieldNonPromotabilityInfo( fieldNameInfo: {}, individualPropertyReasons: {}), diff --git a/pkg/front_end/test/id_tests/metadata_test.dart b/pkg/front_end/test/id_tests/metadata_test.dart new file mode 100644 index 000000000000..4322869b9ce8 --- /dev/null +++ b/pkg/front_end/test/id_tests/metadata_test.dart @@ -0,0 +1,73 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io' show Directory, Platform; + +import 'package:_fe_analyzer_shared/src/testing/id.dart' show ActualData, Id; +import 'package:_fe_analyzer_shared/src/testing/id_testing.dart'; +import 'package:_fe_analyzer_shared/src/testing/metadata_helper.dart'; +import 'package:front_end/src/base/common.dart'; +import 'package:front_end/src/builder/member_builder.dart'; +import 'package:front_end/src/source/source_member_builder.dart'; +import 'package:front_end/src/testing/id_testing_helper.dart'; +import 'package:front_end/src/testing/id_testing_utils.dart'; +import 'package:kernel/ast.dart'; +import 'package:front_end/src/builder/metadata_builder.dart'; + +Future main(List args) async { + retainDataForTesting = true; + computeSharedExpressionForTesting = true; + + Directory dataDir = new Directory.fromUri(Platform.script + .resolve('../../../_fe_analyzer_shared/test/metadata/data')); + await runTests(dataDir, + args: args, + createUriForFileName: createUriForFileName, + onFailure: onFailure, + runTest: runTestFor(const MetadataDataComputer(), [defaultCfeConfig]), + preserveWhitespaceInAnnotations: true); +} + +class MetadataDataComputer extends CfeDataComputer { + const MetadataDataComputer(); + + @override + DataInterpreter get dataValidator => const StringDataInterpreter(); + + @override + bool get supportsErrors => true; + + /// Function that computes a data mapping for [member]. + /// + /// Fills [actualMap] with the data. + @override + void computeMemberData(CfeTestResultData testResultData, Member member, + Map> actualMap, + {bool? verbose}) { + member.accept( + new MetadataDataExtractor(testResultData.compilerResult, actualMap)); + } +} + +class MetadataDataExtractor extends CfeDataExtractor { + MetadataDataExtractor(InternalCompilerResult compilerResult, + Map> actualMap) + : super(compilerResult, actualMap); + + @override + String? computeMemberValue(Id id, Member member) { + MemberBuilder? memberBuilder = lookupMemberBuilder(compilerResult, member); + if (memberBuilder is SourceMemberBuilder) { + Iterable? metadata = memberBuilder.metadataForTesting; + if (metadata != null) { + List list = []; + for (MetadataBuilder metadataBuilder in metadata) { + list.add(expressionToText(unwrap(metadataBuilder.expression!))); + } + return '\n${list.join('\n')}'; + } + } + return null; + } +} diff --git a/pkg/front_end/test/lint_test.status b/pkg/front_end/test/lint_test.status index fc89cbf2be41..a7134911189d 100644 --- a/pkg/front_end/test/lint_test.status +++ b/pkg/front_end/test/lint_test.status @@ -2,6 +2,7 @@ # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. +_fe_analyzer_shared/lib/src/metadata/ast/Exports: Fail _fe_analyzer_shared/lib/src/parser/parser/Exports: Fail _fe_analyzer_shared/lib/src/scanner/scanner/Exports: Fail front_end/lib/src/api_prototype/codes/Exports: Fail diff --git a/pkg/front_end/test/spell_checking_list_code.txt b/pkg/front_end/test/spell_checking_list_code.txt index 97067c0c1862..b5758106d795 100644 --- a/pkg/front_end/test/spell_checking_list_code.txt +++ b/pkg/front_end/test/spell_checking_list_code.txt @@ -273,6 +273,7 @@ clil clock closurizing cls +clutter cm cmdline cmdlines @@ -533,6 +534,7 @@ dyn dynamically e eager +ease easy eb ecma @@ -1735,6 +1737,7 @@ stringify strip structs structurally +structured structures stub stubs @@ -1955,6 +1958,7 @@ unfiltered unfinalized unfold unfolds +unfortunately unfuture unfutured unguarded diff --git a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.expect index d401c7d4d638..c59c2db666bc 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.expect @@ -2,21 +2,18 @@ library; // // Problems in library: // -// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:40: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A Function(X)'. +// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:40: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. // - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // A Function(String) test5() => A.foo; // Error. // ^ // -// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:40: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A Function(X)'. +// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:40: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. // - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // A Function(String) test6() => A.new; // Error. // ^ // -// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:23:41: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A Function(X)'. +// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:23:41: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. // - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // A Function(String) test11() => A.bar; // Error. // ^ // @@ -40,21 +37,30 @@ static method test3() → (core::num) → self::A static method test4() → (core::int) → self::A return #C6; static method test5() → (core::String) → self::A - return #C7; + return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:40: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. + - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. +A Function(String) test5() => A.foo; // Error. + ^" in #C2 as{TypeError} (core::String) → self::A; static method test6() → (core::String) → self::A - return #C8; + return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:40: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. + - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. +A Function(String) test6() => A.new; // Error. + ^" in #C5 as{TypeError} (core::String) → self::A; static method test7() → (core::num) → self::A return #C2; static method test8() → (core::num) → self::A return #C5; static method test9() → (core::num) → self::A - return #C10; + return #C8; static method test10() → (core::int) → self::A - return #C11; + return #C9; static method test11() → (core::String) → self::A - return #C12; + return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:23:41: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. + - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. +A Function(String) test11() => A.bar; // Error. + ^" in #C8 as{TypeError} (core::String) → self::A; static method test12() → (core::num) → self::A - return #C10; + return #C8; static method main() → dynamic {} constants { @@ -64,10 +70,7 @@ constants { #C4 = constructor-tearoff self::A::• #C5 = instantiation #C4 #C6 = instantiation #C4 - #C7 = instantiation #C1 - #C8 = instantiation #C4 - #C9 = constructor-tearoff self::A::bar - #C10 = instantiation #C9 - #C11 = instantiation #C9 - #C12 = instantiation #C9 + #C7 = constructor-tearoff self::A::bar + #C8 = instantiation #C7 + #C9 = instantiation #C7 } diff --git a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.modular.expect b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.modular.expect index d401c7d4d638..c59c2db666bc 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.modular.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.modular.expect @@ -2,21 +2,18 @@ library; // // Problems in library: // -// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:40: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A Function(X)'. +// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:40: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. // - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // A Function(String) test5() => A.foo; // Error. // ^ // -// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:40: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A Function(X)'. +// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:40: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. // - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // A Function(String) test6() => A.new; // Error. // ^ // -// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:23:41: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A Function(X)'. +// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:23:41: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. // - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // A Function(String) test11() => A.bar; // Error. // ^ // @@ -40,21 +37,30 @@ static method test3() → (core::num) → self::A static method test4() → (core::int) → self::A return #C6; static method test5() → (core::String) → self::A - return #C7; + return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:40: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. + - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. +A Function(String) test5() => A.foo; // Error. + ^" in #C2 as{TypeError} (core::String) → self::A; static method test6() → (core::String) → self::A - return #C8; + return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:40: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. + - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. +A Function(String) test6() => A.new; // Error. + ^" in #C5 as{TypeError} (core::String) → self::A; static method test7() → (core::num) → self::A return #C2; static method test8() → (core::num) → self::A return #C5; static method test9() → (core::num) → self::A - return #C10; + return #C8; static method test10() → (core::int) → self::A - return #C11; + return #C9; static method test11() → (core::String) → self::A - return #C12; + return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:23:41: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. + - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. +A Function(String) test11() => A.bar; // Error. + ^" in #C8 as{TypeError} (core::String) → self::A; static method test12() → (core::num) → self::A - return #C10; + return #C8; static method main() → dynamic {} constants { @@ -64,10 +70,7 @@ constants { #C4 = constructor-tearoff self::A::• #C5 = instantiation #C4 #C6 = instantiation #C4 - #C7 = instantiation #C1 - #C8 = instantiation #C4 - #C9 = constructor-tearoff self::A::bar - #C10 = instantiation #C9 - #C11 = instantiation #C9 - #C12 = instantiation #C9 + #C7 = constructor-tearoff self::A::bar + #C8 = instantiation #C7 + #C9 = instantiation #C7 } diff --git a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.transformed.expect index d401c7d4d638..c59c2db666bc 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.transformed.expect @@ -2,21 +2,18 @@ library; // // Problems in library: // -// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:40: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A Function(X)'. +// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:40: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. // - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // A Function(String) test5() => A.foo; // Error. // ^ // -// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:40: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A Function(X)'. +// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:40: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. // - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // A Function(String) test6() => A.new; // Error. // ^ // -// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:23:41: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A Function(X)'. +// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:23:41: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. // - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // A Function(String) test11() => A.bar; // Error. // ^ // @@ -40,21 +37,30 @@ static method test3() → (core::num) → self::A static method test4() → (core::int) → self::A return #C6; static method test5() → (core::String) → self::A - return #C7; + return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:40: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. + - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. +A Function(String) test5() => A.foo; // Error. + ^" in #C2 as{TypeError} (core::String) → self::A; static method test6() → (core::String) → self::A - return #C8; + return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:40: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. + - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. +A Function(String) test6() => A.new; // Error. + ^" in #C5 as{TypeError} (core::String) → self::A; static method test7() → (core::num) → self::A return #C2; static method test8() → (core::num) → self::A return #C5; static method test9() → (core::num) → self::A - return #C10; + return #C8; static method test10() → (core::int) → self::A - return #C11; + return #C9; static method test11() → (core::String) → self::A - return #C12; + return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:23:41: Error: A value of type 'A Function(num)' can't be returned from a function with return type 'A Function(String)'. + - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'. +A Function(String) test11() => A.bar; // Error. + ^" in #C8 as{TypeError} (core::String) → self::A; static method test12() → (core::num) → self::A - return #C10; + return #C8; static method main() → dynamic {} constants { @@ -64,10 +70,7 @@ constants { #C4 = constructor-tearoff self::A::• #C5 = instantiation #C4 #C6 = instantiation #C4 - #C7 = instantiation #C1 - #C8 = instantiation #C4 - #C9 = constructor-tearoff self::A::bar - #C10 = instantiation #C9 - #C11 = instantiation #C9 - #C12 = instantiation #C9 + #C7 = constructor-tearoff self::A::bar + #C8 = instantiation #C7 + #C9 = instantiation #C7 } diff --git a/pkg/front_end/testcases/extension_types/external.dart.strong.expect b/pkg/front_end/testcases/extension_types/external.dart.strong.expect index 70df5d405312..a9426ada7aaa 100644 --- a/pkg/front_end/testcases/extension_types/external.dart.strong.expect +++ b/pkg/front_end/testcases/extension_types/external.dart.strong.expect @@ -2,8 +2,7 @@ library; // // Problems in library: // -// pkg/front_end/testcases/extension_types/external.dart:42:29: Error: Inferred type argument 'int' doesn't conform to the bound 'B' of the type variable 'T' on 'T Function(T)'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/extension_types/external.dart:42:29: Error: A value of type 'B Function(B)' can't be assigned to a variable of type 'int Function(int)'. // int Function(int) f3 = b2.genericMethod; // ^ // @@ -75,7 +74,9 @@ static method method(self::A a) → void { () → self::A f1 = self::B|get#method(b1); b2 = self::B|genericMethod(b2, b2); (T%) → T% f2 = self::B|get#genericMethod(b2); - (core::int) → core::int f3 = self::B|get#genericMethod(b2); + (core::int) → core::int f3 = invalid-expression "pkg/front_end/testcases/extension_types/external.dart:42:29: Error: A value of type 'B Function(B)' can't be assigned to a variable of type 'int Function(int)'. + int Function(int) f3 = b2.genericMethod; + ^" in (self::B|get#genericMethod(b2)) as{TypeError} (core::int) → core::int; b1 = self::B|get#getter(b2); self::B|set#setter(b1, b2); a = self::B|staticField; diff --git a/pkg/front_end/testcases/extension_types/external.dart.strong.modular.expect b/pkg/front_end/testcases/extension_types/external.dart.strong.modular.expect index 70df5d405312..a9426ada7aaa 100644 --- a/pkg/front_end/testcases/extension_types/external.dart.strong.modular.expect +++ b/pkg/front_end/testcases/extension_types/external.dart.strong.modular.expect @@ -2,8 +2,7 @@ library; // // Problems in library: // -// pkg/front_end/testcases/extension_types/external.dart:42:29: Error: Inferred type argument 'int' doesn't conform to the bound 'B' of the type variable 'T' on 'T Function(T)'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/extension_types/external.dart:42:29: Error: A value of type 'B Function(B)' can't be assigned to a variable of type 'int Function(int)'. // int Function(int) f3 = b2.genericMethod; // ^ // @@ -75,7 +74,9 @@ static method method(self::A a) → void { () → self::A f1 = self::B|get#method(b1); b2 = self::B|genericMethod(b2, b2); (T%) → T% f2 = self::B|get#genericMethod(b2); - (core::int) → core::int f3 = self::B|get#genericMethod(b2); + (core::int) → core::int f3 = invalid-expression "pkg/front_end/testcases/extension_types/external.dart:42:29: Error: A value of type 'B Function(B)' can't be assigned to a variable of type 'int Function(int)'. + int Function(int) f3 = b2.genericMethod; + ^" in (self::B|get#genericMethod(b2)) as{TypeError} (core::int) → core::int; b1 = self::B|get#getter(b2); self::B|set#setter(b1, b2); a = self::B|staticField; diff --git a/pkg/front_end/testcases/extension_types/external.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/external.dart.strong.transformed.expect index 70df5d405312..a9426ada7aaa 100644 --- a/pkg/front_end/testcases/extension_types/external.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/extension_types/external.dart.strong.transformed.expect @@ -2,8 +2,7 @@ library; // // Problems in library: // -// pkg/front_end/testcases/extension_types/external.dart:42:29: Error: Inferred type argument 'int' doesn't conform to the bound 'B' of the type variable 'T' on 'T Function(T)'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/extension_types/external.dart:42:29: Error: A value of type 'B Function(B)' can't be assigned to a variable of type 'int Function(int)'. // int Function(int) f3 = b2.genericMethod; // ^ // @@ -75,7 +74,9 @@ static method method(self::A a) → void { () → self::A f1 = self::B|get#method(b1); b2 = self::B|genericMethod(b2, b2); (T%) → T% f2 = self::B|get#genericMethod(b2); - (core::int) → core::int f3 = self::B|get#genericMethod(b2); + (core::int) → core::int f3 = invalid-expression "pkg/front_end/testcases/extension_types/external.dart:42:29: Error: A value of type 'B Function(B)' can't be assigned to a variable of type 'int Function(int)'. + int Function(int) f3 = b2.genericMethod; + ^" in (self::B|get#genericMethod(b2)) as{TypeError} (core::int) → core::int; b1 = self::B|get#getter(b2); self::B|set#setter(b1, b2); a = self::B|staticField; diff --git a/pkg/front_end/testcases/extensions/check_bounds.dart.strong.expect b/pkg/front_end/testcases/extensions/check_bounds.dart.strong.expect index 18bbe8b62597..f7df0c94e67b 100644 --- a/pkg/front_end/testcases/extensions/check_bounds.dart.strong.expect +++ b/pkg/front_end/testcases/extensions/check_bounds.dart.strong.expect @@ -9,15 +9,12 @@ library; // final field1 = classA.method(); // Error: Expect method not found. // ^^^^^^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:62:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. +// pkg/front_end/testcases/extensions/check_bounds.dart:62:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field2 = Extension(classA).method(); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:63:16: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -36,61 +33,54 @@ library; // final field4 = Extension(classA).method(); // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:65:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:65:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:65:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:65:48: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:66:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:66:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field6 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:66:16: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:66:34: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Try changing type arguments so that they conform to the bounds. // final field6 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ +// ^ // pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. // genericMethod(S s) {} // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:67:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:67:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:67:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:68:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// final field8 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:68:16: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -102,16 +92,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:68:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// final field8 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:70:5: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -148,15 +128,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:74:26: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:74:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:76:26: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -184,15 +160,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:84:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:84:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field18 = classB.genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:85:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -210,15 +182,11 @@ library; // final field20 = classB.genericMethod(a); // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:87:35: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:87:49: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field21 = Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:89:23: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -236,6 +204,12 @@ library; // final field23 = Extension(classB).genericMethod(a); // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:92:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:92:5: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -246,16 +220,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:92:5: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:94:5: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -292,15 +256,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:98:26: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:98:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:100:26: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -325,15 +285,12 @@ library; // classA.method(); // Error: Expect method not found. // ^^^^^^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:25:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. +// pkg/front_end/testcases/extensions/check_bounds.dart:25:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).method(); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:26:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -345,61 +302,54 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:28:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:28:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:28:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:28:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:29:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:29:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:29:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:29:21: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Try changing type arguments so that they conform to the bounds. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ +// ^ // pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. // genericMethod(S s) {} // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:30:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:30:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:30:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:31:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:31:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -411,16 +361,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:31:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:32:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -457,15 +397,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:34:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:34:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:35:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -493,15 +429,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:43:10: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:43:24: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // classB.genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:44:10: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -519,15 +451,11 @@ library; // classB.genericMethod(a); // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:46:21: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:46:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:47:21: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -545,6 +473,12 @@ library; // Extension(classB).genericMethod(a); // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:49:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:49:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -555,16 +489,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:49:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:50:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -601,15 +525,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:52:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:52:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:53:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -634,15 +554,12 @@ library; // classA.method(); // ^^^^^^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:12:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:12:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).method(); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:13:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -654,61 +571,54 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:21: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Try changing type arguments so that they conform to the bounds. // Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ +// ^ // pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. // genericMethod(S s) {} // ^ // +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classA).genericMethod(a); // Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Extension(classA).genericMethod(a); // Expect bounds mismatch. // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:18:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// Extension(classA).genericMethod(a); // Expect bounds mismatch. +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:18:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -720,16 +630,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:18:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds_lib.dart:19:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -766,15 +666,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:21:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:21:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:22:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -802,15 +698,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:30:10: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:30:24: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // classB.genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:31:10: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -828,15 +720,11 @@ library; // classB.genericMethod(a); // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:33:21: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:33:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:34:21: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -854,6 +742,12 @@ library; // Extension(classB).genericMethod(a); // ^ // +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:36:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classB).genericMethod(a); // Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds_lib.dart:36:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -864,16 +758,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:36:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classB).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds_lib.dart:37:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -910,15 +794,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:39:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:39:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:40:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -970,7 +850,12 @@ static final field dynamic field1 = invalid-expression "pkg/front_end/testcases/ Try correcting the name to the name of an existing method, or defining a method named 'method'. final field1 = classA.method(); // Error: Expect method not found. ^^^^^^" in self::classA{}.method(); -static final field dynamic field2 = self::Extension|method(self::classA); +static final field dynamic field2 = self::Extension|method(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:62:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field2 = Extension(classA).method(); // Error: Expect bounds mismatch. + ^" in self::classA as{TypeError} self::Class); static final field dynamic field3 = self::Extension|method(self::classA); static final field dynamic field4 = self::Extension|method(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:64:29: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -978,21 +863,48 @@ static final field dynamic field4 = self::Extension|method(invalid-expr - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. final field4 = Extension(classA).method(); ^" in self::classA as{TypeError} self::Class); -static final field dynamic field5 = self::Extension|genericMethod(self::classA, self::a); -static final field dynamic field6 = self::Extension|genericMethod(self::classA, self::a); -static final field dynamic field7 = self::Extension|genericMethod(self::classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:67:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +static final field dynamic field5 = self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:65:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:65:48: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); +static final field dynamic field6 = self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:66:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field6 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::classA as{TypeError} self::Class, self::a); +static final field dynamic field7 = self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:67:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:67:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); +static final field dynamic field8 = self::Extension|genericMethod(self::classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:68:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field8 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. ^" in self::a as{TypeError} self::B); -static final field dynamic field8 = self::Extension|genericMethod(self::classA, self::a); static final field dynamic field9 = self::Extension|genericMethod(self::classA, self::a); static final field dynamic field10 = self::Extension|genericMethod(self::classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:72:43: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. ^" in self::a as{TypeError} self::B); -static final field dynamic field11 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field11 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:74:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field12 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field13 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:77:55: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1003,28 +915,44 @@ static final field dynamic field14 = self::Extension|method(self::class static final field dynamic field15 = self::Extension|method(self::classB); static final field dynamic field16 = self::Extension|method(self::classB); static final field dynamic field17 = self::Extension|method(self::classB); -static final field dynamic field18 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field18 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:84:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field18 = classB.genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field19 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field20 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:86:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. final field20 = classB.genericMethod(a); ^" in self::a as{TypeError} self::B); -static final field dynamic field21 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field21 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:87:49: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field21 = Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field22 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field23 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:90:52: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. final field23 = Extension(classB).genericMethod(a); ^" in self::a as{TypeError} self::B); -static final field dynamic field24 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field24 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:92:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field25 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field26 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:96:43: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. ^" in self::a as{TypeError} self::B); -static final field dynamic field27 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field27 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:98:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field28 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field29 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:101:55: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1047,24 +975,56 @@ static method test(self::A a) → dynamic { Try correcting the name to the name of an existing method, or defining a method named 'method'. classA.method(); // Error: Expect method not found. ^^^^^^" in classA{}.method(); - self::Extension|method(classA); + self::Extension|method(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:25:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).method(); // Error: Expect bounds mismatch. + ^" in classA as{TypeError} self::Class); self::Extension|method(classA); self::Extension|method(classB); - self::Extension|genericMethod(classA, a); - self::Extension|genericMethod(classA, a); - self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:30:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:28:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:28:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:29:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, a); + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:30:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:30:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classA, a); + self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:31:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classA, a); self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:33:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:34:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:36:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1075,28 +1035,44 @@ Try correcting the name to the name of an existing method, or defining a method self::Extension|method(classB); self::Extension|method(classB); self::Extension|method(classB); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:43:24: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + classB.genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:45:27: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. classB.genericMethod(a); ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:46:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:48:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:49:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:51:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:52:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:54:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1113,24 +1089,56 @@ static method /* from org-dartlang-testcase:///check_bounds_lib.dart */ testInPa Try correcting the name to the name of an existing method, or defining a method named 'method'. classA.method(); ^^^^^^" in classA{}.method(); - self::Extension|method(classA); + self::Extension|method(invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:12:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).method(); // Expect bounds mismatch. + ^" in classA as{TypeError} self::Class); self::Extension|method(classA); self::Extension|method(classB); - self::Extension|genericMethod(classA, a); - self::Extension|genericMethod(classA, a); - self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, a); + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classA, a); + self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:18:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classA, a); self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:20:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:21:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:23:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1141,28 +1149,44 @@ Try correcting the name to the name of an existing method, or defining a method self::Extension|method(classB); self::Extension|method(classB); self::Extension|method(classB); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:30:24: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + classB.genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:32:27: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. classB.genericMethod(a); ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:33:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:35:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:36:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:38:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); // Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:39:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:41:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. diff --git a/pkg/front_end/testcases/extensions/check_bounds.dart.strong.modular.expect b/pkg/front_end/testcases/extensions/check_bounds.dart.strong.modular.expect index 18bbe8b62597..f7df0c94e67b 100644 --- a/pkg/front_end/testcases/extensions/check_bounds.dart.strong.modular.expect +++ b/pkg/front_end/testcases/extensions/check_bounds.dart.strong.modular.expect @@ -9,15 +9,12 @@ library; // final field1 = classA.method(); // Error: Expect method not found. // ^^^^^^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:62:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. +// pkg/front_end/testcases/extensions/check_bounds.dart:62:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field2 = Extension(classA).method(); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:63:16: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -36,61 +33,54 @@ library; // final field4 = Extension(classA).method(); // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:65:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:65:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:65:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:65:48: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:66:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:66:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field6 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:66:16: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:66:34: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Try changing type arguments so that they conform to the bounds. // final field6 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ +// ^ // pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. // genericMethod(S s) {} // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:67:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:67:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:67:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:68:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// final field8 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:68:16: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -102,16 +92,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:68:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// final field8 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:70:5: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -148,15 +128,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:74:26: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:74:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:76:26: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -184,15 +160,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:84:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:84:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field18 = classB.genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:85:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -210,15 +182,11 @@ library; // final field20 = classB.genericMethod(a); // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:87:35: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:87:49: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field21 = Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:89:23: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -236,6 +204,12 @@ library; // final field23 = Extension(classB).genericMethod(a); // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:92:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:92:5: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -246,16 +220,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:92:5: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:94:5: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -292,15 +256,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:98:26: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:98:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:100:26: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -325,15 +285,12 @@ library; // classA.method(); // Error: Expect method not found. // ^^^^^^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:25:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. +// pkg/front_end/testcases/extensions/check_bounds.dart:25:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).method(); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:26:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -345,61 +302,54 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:28:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:28:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:28:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:28:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:29:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:29:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:29:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:29:21: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Try changing type arguments so that they conform to the bounds. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ +// ^ // pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. // genericMethod(S s) {} // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:30:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:30:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:30:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:31:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:31:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -411,16 +361,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:31:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:32:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -457,15 +397,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:34:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:34:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:35:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -493,15 +429,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:43:10: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:43:24: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // classB.genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:44:10: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -519,15 +451,11 @@ library; // classB.genericMethod(a); // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:46:21: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:46:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:47:21: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -545,6 +473,12 @@ library; // Extension(classB).genericMethod(a); // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:49:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:49:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -555,16 +489,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:49:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:50:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -601,15 +525,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:52:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:52:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:53:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -634,15 +554,12 @@ library; // classA.method(); // ^^^^^^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:12:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:12:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).method(); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:13:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -654,61 +571,54 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:21: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Try changing type arguments so that they conform to the bounds. // Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ +// ^ // pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. // genericMethod(S s) {} // ^ // +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classA).genericMethod(a); // Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Extension(classA).genericMethod(a); // Expect bounds mismatch. // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:18:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// Extension(classA).genericMethod(a); // Expect bounds mismatch. +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:18:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -720,16 +630,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:18:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds_lib.dart:19:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -766,15 +666,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:21:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:21:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:22:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -802,15 +698,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:30:10: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:30:24: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // classB.genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:31:10: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -828,15 +720,11 @@ library; // classB.genericMethod(a); // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:33:21: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:33:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:34:21: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -854,6 +742,12 @@ library; // Extension(classB).genericMethod(a); // ^ // +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:36:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classB).genericMethod(a); // Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds_lib.dart:36:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -864,16 +758,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:36:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classB).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds_lib.dart:37:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -910,15 +794,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:39:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:39:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:40:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -970,7 +850,12 @@ static final field dynamic field1 = invalid-expression "pkg/front_end/testcases/ Try correcting the name to the name of an existing method, or defining a method named 'method'. final field1 = classA.method(); // Error: Expect method not found. ^^^^^^" in self::classA{}.method(); -static final field dynamic field2 = self::Extension|method(self::classA); +static final field dynamic field2 = self::Extension|method(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:62:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field2 = Extension(classA).method(); // Error: Expect bounds mismatch. + ^" in self::classA as{TypeError} self::Class); static final field dynamic field3 = self::Extension|method(self::classA); static final field dynamic field4 = self::Extension|method(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:64:29: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -978,21 +863,48 @@ static final field dynamic field4 = self::Extension|method(invalid-expr - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. final field4 = Extension(classA).method(); ^" in self::classA as{TypeError} self::Class); -static final field dynamic field5 = self::Extension|genericMethod(self::classA, self::a); -static final field dynamic field6 = self::Extension|genericMethod(self::classA, self::a); -static final field dynamic field7 = self::Extension|genericMethod(self::classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:67:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +static final field dynamic field5 = self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:65:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:65:48: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); +static final field dynamic field6 = self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:66:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field6 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::classA as{TypeError} self::Class, self::a); +static final field dynamic field7 = self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:67:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:67:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); +static final field dynamic field8 = self::Extension|genericMethod(self::classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:68:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field8 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. ^" in self::a as{TypeError} self::B); -static final field dynamic field8 = self::Extension|genericMethod(self::classA, self::a); static final field dynamic field9 = self::Extension|genericMethod(self::classA, self::a); static final field dynamic field10 = self::Extension|genericMethod(self::classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:72:43: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. ^" in self::a as{TypeError} self::B); -static final field dynamic field11 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field11 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:74:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field12 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field13 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:77:55: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1003,28 +915,44 @@ static final field dynamic field14 = self::Extension|method(self::class static final field dynamic field15 = self::Extension|method(self::classB); static final field dynamic field16 = self::Extension|method(self::classB); static final field dynamic field17 = self::Extension|method(self::classB); -static final field dynamic field18 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field18 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:84:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field18 = classB.genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field19 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field20 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:86:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. final field20 = classB.genericMethod(a); ^" in self::a as{TypeError} self::B); -static final field dynamic field21 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field21 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:87:49: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field21 = Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field22 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field23 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:90:52: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. final field23 = Extension(classB).genericMethod(a); ^" in self::a as{TypeError} self::B); -static final field dynamic field24 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field24 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:92:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field25 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field26 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:96:43: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. ^" in self::a as{TypeError} self::B); -static final field dynamic field27 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field27 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:98:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field28 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field29 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:101:55: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1047,24 +975,56 @@ static method test(self::A a) → dynamic { Try correcting the name to the name of an existing method, or defining a method named 'method'. classA.method(); // Error: Expect method not found. ^^^^^^" in classA{}.method(); - self::Extension|method(classA); + self::Extension|method(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:25:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).method(); // Error: Expect bounds mismatch. + ^" in classA as{TypeError} self::Class); self::Extension|method(classA); self::Extension|method(classB); - self::Extension|genericMethod(classA, a); - self::Extension|genericMethod(classA, a); - self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:30:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:28:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:28:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:29:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, a); + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:30:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:30:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classA, a); + self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:31:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classA, a); self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:33:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:34:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:36:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1075,28 +1035,44 @@ Try correcting the name to the name of an existing method, or defining a method self::Extension|method(classB); self::Extension|method(classB); self::Extension|method(classB); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:43:24: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + classB.genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:45:27: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. classB.genericMethod(a); ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:46:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:48:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:49:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:51:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:52:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:54:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1113,24 +1089,56 @@ static method /* from org-dartlang-testcase:///check_bounds_lib.dart */ testInPa Try correcting the name to the name of an existing method, or defining a method named 'method'. classA.method(); ^^^^^^" in classA{}.method(); - self::Extension|method(classA); + self::Extension|method(invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:12:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).method(); // Expect bounds mismatch. + ^" in classA as{TypeError} self::Class); self::Extension|method(classA); self::Extension|method(classB); - self::Extension|genericMethod(classA, a); - self::Extension|genericMethod(classA, a); - self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, a); + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classA, a); + self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:18:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classA, a); self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:20:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:21:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:23:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1141,28 +1149,44 @@ Try correcting the name to the name of an existing method, or defining a method self::Extension|method(classB); self::Extension|method(classB); self::Extension|method(classB); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:30:24: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + classB.genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:32:27: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. classB.genericMethod(a); ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:33:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:35:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:36:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:38:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); // Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:39:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:41:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. diff --git a/pkg/front_end/testcases/extensions/check_bounds.dart.strong.outline.expect b/pkg/front_end/testcases/extensions/check_bounds.dart.strong.outline.expect index eeefbde27b02..7eb5bbd86b2f 100644 --- a/pkg/front_end/testcases/extensions/check_bounds.dart.strong.outline.expect +++ b/pkg/front_end/testcases/extensions/check_bounds.dart.strong.outline.expect @@ -9,15 +9,12 @@ library; // final field1 = classA.method(); // Error: Expect method not found. // ^^^^^^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:62:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. +// pkg/front_end/testcases/extensions/check_bounds.dart:62:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field2 = Extension(classA).method(); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:63:16: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -36,61 +33,54 @@ library; // final field4 = Extension(classA).method(); // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:65:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:65:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:65:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:65:48: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:66:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:66:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field6 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:66:16: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:66:34: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Try changing type arguments so that they conform to the bounds. // final field6 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ +// ^ // pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. // genericMethod(S s) {} // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:67:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:67:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:67:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:68:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// final field8 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:68:16: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -102,16 +92,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:68:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// final field8 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:70:5: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -148,15 +128,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:74:26: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:74:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:76:26: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -184,15 +160,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:84:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:84:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field18 = classB.genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:85:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -210,15 +182,11 @@ library; // final field20 = classB.genericMethod(a); // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:87:35: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:87:49: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field21 = Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:89:23: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -236,6 +204,12 @@ library; // final field23 = Extension(classB).genericMethod(a); // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:92:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:92:5: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -246,16 +220,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:92:5: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:94:5: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -292,15 +256,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:98:26: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:98:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:100:26: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. diff --git a/pkg/front_end/testcases/extensions/check_bounds.dart.strong.transformed.expect b/pkg/front_end/testcases/extensions/check_bounds.dart.strong.transformed.expect index 18bbe8b62597..f7df0c94e67b 100644 --- a/pkg/front_end/testcases/extensions/check_bounds.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/extensions/check_bounds.dart.strong.transformed.expect @@ -9,15 +9,12 @@ library; // final field1 = classA.method(); // Error: Expect method not found. // ^^^^^^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:62:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. +// pkg/front_end/testcases/extensions/check_bounds.dart:62:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field2 = Extension(classA).method(); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:63:16: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -36,61 +33,54 @@ library; // final field4 = Extension(classA).method(); // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:65:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:65:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:65:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:65:48: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:66:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:66:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field6 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:66:16: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:66:34: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Try changing type arguments so that they conform to the bounds. // final field6 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ +// ^ // pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. // genericMethod(S s) {} // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:67:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:67:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:67:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:68:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// final field8 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:68:16: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -102,16 +92,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:68:16: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// final field8 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:70:5: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -148,15 +128,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:74:26: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:74:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:76:26: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -184,15 +160,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:84:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:84:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field18 = classB.genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:85:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -210,15 +182,11 @@ library; // final field20 = classB.genericMethod(a); // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:87:35: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:87:49: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // final field21 = Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:89:23: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -236,6 +204,12 @@ library; // final field23 = Extension(classB).genericMethod(a); // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:92:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:92:5: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -246,16 +220,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:92:5: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:94:5: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -292,15 +256,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:98:26: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:98:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:100:26: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -325,15 +285,12 @@ library; // classA.method(); // Error: Expect method not found. // ^^^^^^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:25:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. +// pkg/front_end/testcases/extensions/check_bounds.dart:25:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).method(); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:26:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -345,61 +302,54 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:28:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:28:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:28:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:28:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:29:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:29:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:29:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:29:21: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Try changing type arguments so that they conform to the bounds. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ +// ^ // pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. // genericMethod(S s) {} // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:30:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:30:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:30:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:31:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:31:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -411,16 +361,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:31:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:32:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -457,15 +397,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:34:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:34:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:35:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -493,15 +429,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:43:10: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:43:24: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // classB.genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:44:10: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -519,15 +451,11 @@ library; // classB.genericMethod(a); // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:46:21: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:46:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:47:21: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -545,6 +473,12 @@ library; // Extension(classB).genericMethod(a); // ^ // +// pkg/front_end/testcases/extensions/check_bounds.dart:49:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds.dart:49:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -555,16 +489,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:49:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds.dart:50:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -601,15 +525,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds.dart:52:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds.dart:52:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds.dart:53:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -634,15 +554,12 @@ library; // classA.method(); // ^^^^^^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:12:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:12:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).method(); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:13:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|method'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -654,61 +571,54 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:21: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Try changing type arguments so that they conform to the bounds. // Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ +// ^ // pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. // genericMethod(S s) {} // ^ // +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. +// - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classA).genericMethod(a); // Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // Extension(classA).genericMethod(a); // Expect bounds mismatch. // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:18:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:13:21: Context: This is the type variable whose bound isn't conformed to. -// extension Extension on Class { -// ^ +// Extension(classA).genericMethod(a); // Expect bounds mismatch. +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:18:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -720,16 +630,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:18:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classA).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds_lib.dart:19:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -766,15 +666,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:21:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:21:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:22:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -802,15 +698,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:30:10: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:30:24: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // classB.genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:31:10: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -828,15 +720,11 @@ library; // classB.genericMethod(a); // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:33:21: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:33:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:34:21: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -854,6 +742,12 @@ library; // Extension(classB).genericMethod(a); // ^ // +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:36:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +// Extension(classB).genericMethod(a); // Expect bounds mismatch. +// ^ +// // pkg/front_end/testcases/extensions/check_bounds_lib.dart:36:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -864,16 +758,6 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:36:3: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. -// - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// Extension(classB).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ -// // pkg/front_end/testcases/extensions/check_bounds_lib.dart:37:3: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'T' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -910,15 +794,11 @@ library; // extension Extension on Class { // ^ // -// pkg/front_end/testcases/extensions/check_bounds_lib.dart:39:24: Error: Inferred type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. +// pkg/front_end/testcases/extensions/check_bounds_lib.dart:39:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. // - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // Extension(classB).genericMethod(a); // Expect bounds mismatch. -// ^ -// pkg/front_end/testcases/extensions/check_bounds.dart:15:17: Context: This is the type variable whose bound isn't conformed to. -// genericMethod(S s) {} -// ^ +// ^ // // pkg/front_end/testcases/extensions/check_bounds_lib.dart:40:24: Error: Type argument 'A' doesn't conform to the bound 'B' of the type variable 'S' on 'Extension|genericMethod'. // - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -970,7 +850,12 @@ static final field dynamic field1 = invalid-expression "pkg/front_end/testcases/ Try correcting the name to the name of an existing method, or defining a method named 'method'. final field1 = classA.method(); // Error: Expect method not found. ^^^^^^" in self::classA{}.method(); -static final field dynamic field2 = self::Extension|method(self::classA); +static final field dynamic field2 = self::Extension|method(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:62:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field2 = Extension(classA).method(); // Error: Expect bounds mismatch. + ^" in self::classA as{TypeError} self::Class); static final field dynamic field3 = self::Extension|method(self::classA); static final field dynamic field4 = self::Extension|method(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:64:29: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -978,21 +863,48 @@ static final field dynamic field4 = self::Extension|method(invalid-expr - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. final field4 = Extension(classA).method(); ^" in self::classA as{TypeError} self::Class); -static final field dynamic field5 = self::Extension|genericMethod(self::classA, self::a); -static final field dynamic field6 = self::Extension|genericMethod(self::classA, self::a); -static final field dynamic field7 = self::Extension|genericMethod(self::classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:67:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. +static final field dynamic field5 = self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:65:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:65:48: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field5 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); +static final field dynamic field6 = self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:66:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field6 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::classA as{TypeError} self::Class, self::a); +static final field dynamic field7 = self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:67:26: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:67:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field7 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); +static final field dynamic field8 = self::Extension|genericMethod(self::classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:68:51: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field8 = Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. ^" in self::a as{TypeError} self::B); -static final field dynamic field8 = self::Extension|genericMethod(self::classA, self::a); static final field dynamic field9 = self::Extension|genericMethod(self::classA, self::a); static final field dynamic field10 = self::Extension|genericMethod(self::classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:72:43: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. ^" in self::a as{TypeError} self::B); -static final field dynamic field11 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field11 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:74:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field12 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field13 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:77:55: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1003,28 +915,44 @@ static final field dynamic field14 = self::Extension|method(self::class static final field dynamic field15 = self::Extension|method(self::classB); static final field dynamic field16 = self::Extension|method(self::classB); static final field dynamic field17 = self::Extension|method(self::classB); -static final field dynamic field18 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field18 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:84:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field18 = classB.genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field19 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field20 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:86:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. final field20 = classB.genericMethod(a); ^" in self::a as{TypeError} self::B); -static final field dynamic field21 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field21 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:87:49: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. +final field21 = Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field22 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field23 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:90:52: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. final field23 = Extension(classB).genericMethod(a); ^" in self::a as{TypeError} self::B); -static final field dynamic field24 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field24 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:92:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field25 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field26 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:96:43: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. ^" in self::a as{TypeError} self::B); -static final field dynamic field27 = self::Extension|genericMethod(self::classB, self::a); +static final field dynamic field27 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:98:40: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in self::a as{TypeError} self::B); static final field dynamic field28 = self::Extension|genericMethod(self::classB, self::a); static final field dynamic field29 = self::Extension|genericMethod(self::classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:101:55: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1047,24 +975,56 @@ static method test(self::A a) → dynamic { Try correcting the name to the name of an existing method, or defining a method named 'method'. classA.method(); // Error: Expect method not found. ^^^^^^" in classA{}.method(); - self::Extension|method(classA); + self::Extension|method(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:25:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).method(); // Error: Expect bounds mismatch. + ^" in classA as{TypeError} self::Class); self::Extension|method(classA); self::Extension|method(classB); - self::Extension|genericMethod(classA, a); - self::Extension|genericMethod(classA, a); - self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:30:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:28:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:28:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:29:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, a); + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:30:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:30:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classA, a); + self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:31:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classA, a); self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:33:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Error: Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:34:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:36:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1075,28 +1035,44 @@ Try correcting the name to the name of an existing method, or defining a method self::Extension|method(classB); self::Extension|method(classB); self::Extension|method(classB); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:43:24: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + classB.genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:45:27: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. classB.genericMethod(a); ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:46:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:48:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:49:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:51:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:52:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Error: Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds.dart:54:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1113,24 +1089,56 @@ static method /* from org-dartlang-testcase:///check_bounds_lib.dart */ testInPa Try correcting the name to the name of an existing method, or defining a method named 'method'. classA.method(); ^^^^^^" in classA{}.method(); - self::Extension|method(classA); + self::Extension|method(invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:12:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).method(); // Expect bounds mismatch. + ^" in classA as{TypeError} self::Class); self::Extension|method(classA); self::Extension|method(classB); - self::Extension|genericMethod(classA, a); - self::Extension|genericMethod(classA, a); - self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:15:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:16:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, a); + self::Extension|genericMethod(invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:13: Error: The argument type 'Class' can't be assigned to the parameter type 'Class'. + - 'Class' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in classA as{TypeError} self::Class, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:17:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classA, a); + self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:18:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classA).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classA, a); self::Extension|genericMethod(classA, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:20:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classA).genericMethod(a); // Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:21:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:23:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. @@ -1141,28 +1149,44 @@ Try correcting the name to the name of an existing method, or defining a method self::Extension|method(classB); self::Extension|method(classB); self::Extension|method(classB); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:30:24: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + classB.genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:32:27: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. classB.genericMethod(a); ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:33:35: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:35:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:36:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:38:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. Extension(classB).genericMethod(a); // Expect bounds mismatch. ^" in a as{TypeError} self::B); - self::Extension|genericMethod(classB, a); + self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:39:38: Error: The argument type 'A' can't be assigned to the parameter type 'B'. + - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + - 'B' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. + Extension(classB).genericMethod(a); // Expect bounds mismatch. + ^" in a as{TypeError} self::B); self::Extension|genericMethod(classB, a); self::Extension|genericMethod(classB, invalid-expression "pkg/front_end/testcases/extensions/check_bounds_lib.dart:41:41: Error: The argument type 'A' can't be assigned to the parameter type 'B'. - 'A' is from 'pkg/front_end/testcases/extensions/check_bounds.dart'. diff --git a/pkg/front_end/testcases/general/bounded_implicit_instantiation.dart.strong.expect b/pkg/front_end/testcases/general/bounded_implicit_instantiation.dart.strong.expect index 953c866d7a6a..43082f13e7a6 100644 --- a/pkg/front_end/testcases/general/bounded_implicit_instantiation.dart.strong.expect +++ b/pkg/front_end/testcases/general/bounded_implicit_instantiation.dart.strong.expect @@ -11,8 +11,7 @@ library; // String b = bounded(''); // ^ // -// pkg/front_end/testcases/general/bounded_implicit_instantiation.dart:9:31: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'X Function(X)'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/bounded_implicit_instantiation.dart:9:31: Error: A value of type 'num Function(num)' can't be assigned to a variable of type 'String Function(String)'. // String Function(String) c = bounded; // ^ // @@ -26,7 +25,9 @@ static method test() → dynamic { String a = bounded(''); ^" in "" as{TypeError} Never){(Never) → Never}; core::String b = bounded(""){(core::String) → core::String}; - (core::String) → core::String c = bounded; + (core::String) → core::String c = invalid-expression "pkg/front_end/testcases/general/bounded_implicit_instantiation.dart:9:31: Error: A value of type 'num Function(num)' can't be assigned to a variable of type 'String Function(String)'. + String Function(String) c = bounded; + ^" in (bounded) as{TypeError} (core::String) → core::String; core::String d = c(""){(core::String) → core::String}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/general/bounded_implicit_instantiation.dart.strong.modular.expect b/pkg/front_end/testcases/general/bounded_implicit_instantiation.dart.strong.modular.expect index 953c866d7a6a..43082f13e7a6 100644 --- a/pkg/front_end/testcases/general/bounded_implicit_instantiation.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/bounded_implicit_instantiation.dart.strong.modular.expect @@ -11,8 +11,7 @@ library; // String b = bounded(''); // ^ // -// pkg/front_end/testcases/general/bounded_implicit_instantiation.dart:9:31: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'X Function(X)'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/bounded_implicit_instantiation.dart:9:31: Error: A value of type 'num Function(num)' can't be assigned to a variable of type 'String Function(String)'. // String Function(String) c = bounded; // ^ // @@ -26,7 +25,9 @@ static method test() → dynamic { String a = bounded(''); ^" in "" as{TypeError} Never){(Never) → Never}; core::String b = bounded(""){(core::String) → core::String}; - (core::String) → core::String c = bounded; + (core::String) → core::String c = invalid-expression "pkg/front_end/testcases/general/bounded_implicit_instantiation.dart:9:31: Error: A value of type 'num Function(num)' can't be assigned to a variable of type 'String Function(String)'. + String Function(String) c = bounded; + ^" in (bounded) as{TypeError} (core::String) → core::String; core::String d = c(""){(core::String) → core::String}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/general/bounded_implicit_instantiation.dart.strong.transformed.expect b/pkg/front_end/testcases/general/bounded_implicit_instantiation.dart.strong.transformed.expect new file mode 100644 index 000000000000..43082f13e7a6 --- /dev/null +++ b/pkg/front_end/testcases/general/bounded_implicit_instantiation.dart.strong.transformed.expect @@ -0,0 +1,33 @@ +library; +// +// Problems in library: +// +// pkg/front_end/testcases/general/bounded_implicit_instantiation.dart:7:22: Error: The argument type 'String' can't be assigned to the parameter type 'Never'. +// String a = bounded(''); +// ^ +// +// pkg/front_end/testcases/general/bounded_implicit_instantiation.dart:8:21: Error: Type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'bounded'. +// Try changing type arguments so that they conform to the bounds. +// String b = bounded(''); +// ^ +// +// pkg/front_end/testcases/general/bounded_implicit_instantiation.dart:9:31: Error: A value of type 'num Function(num)' can't be assigned to a variable of type 'String Function(String)'. +// String Function(String) c = bounded; +// ^ +// +import self as self; +import "dart:core" as core; + +static method test() → dynamic { + function bounded(X x) → X + return x; + core::String a = bounded(invalid-expression "pkg/front_end/testcases/general/bounded_implicit_instantiation.dart:7:22: Error: The argument type 'String' can't be assigned to the parameter type 'Never'. + String a = bounded(''); + ^" in "" as{TypeError} Never){(Never) → Never}; + core::String b = bounded(""){(core::String) → core::String}; + (core::String) → core::String c = invalid-expression "pkg/front_end/testcases/general/bounded_implicit_instantiation.dart:9:31: Error: A value of type 'num Function(num)' can't be assigned to a variable of type 'String Function(String)'. + String Function(String) c = bounded; + ^" in (bounded) as{TypeError} (core::String) → core::String; + core::String d = c(""){(core::String) → core::String}; +} +static method main() → dynamic {} diff --git a/pkg/front_end/testcases/general/function_invocation_bounds.dart.strong.expect b/pkg/front_end/testcases/general/function_invocation_bounds.dart.strong.expect index b044cdf1aff1..0d5545bf6af2 100644 --- a/pkg/front_end/testcases/general/function_invocation_bounds.dart.strong.expect +++ b/pkg/front_end/testcases/general/function_invocation_bounds.dart.strong.expect @@ -2,10 +2,9 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/function_invocation_bounds.dart:9:8: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'local'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/function_invocation_bounds.dart:9:9: Error: The argument type 'String' can't be assigned to the parameter type 'num'. // local(""); -// ^ +// ^ // // pkg/front_end/testcases/general/function_invocation_bounds.dart:10:8: Error: Type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'local'. // Try changing type arguments so that they conform to the bounds. @@ -16,10 +15,9 @@ library; // local(throw ''); // ^ // -// pkg/front_end/testcases/general/function_invocation_bounds.dart:15:4: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'call'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/function_invocation_bounds.dart:15:5: Error: The argument type 'String' can't be assigned to the parameter type 'num'. // f(""); -// ^ +// ^ // // pkg/front_end/testcases/general/function_invocation_bounds.dart:16:4: Error: Type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'call'. // Try changing type arguments so that they conform to the bounds. @@ -37,7 +35,9 @@ typedef G = (T%) → T%; static method test() → dynamic { function local(T t) → T return t; - local(""){(core::String) → core::String}; + local(invalid-expression "pkg/front_end/testcases/general/function_invocation_bounds.dart:9:9: Error: The argument type 'String' can't be assigned to the parameter type 'num'. + local(\"\"); + ^" in "" as{TypeError} core::num){(core::num) → core::num}; local(throw ""){(core::String) → core::String}; local(0){(core::int) → core::int}; local(throw ""){(core::int) → core::int}; @@ -45,7 +45,9 @@ static method test() → dynamic { local(throw ''); ^" in local{}.(throw ""); (T) → T f = local; - f(""){(core::String) → core::String}; + f(invalid-expression "pkg/front_end/testcases/general/function_invocation_bounds.dart:15:5: Error: The argument type 'String' can't be assigned to the parameter type 'num'. + f(\"\"); + ^" in "" as{TypeError} core::num){(core::num) → core::num}; f(throw ""){(core::String) → core::String}; f(0){(core::int) → core::int}; f(throw ""){(core::int) → core::int}; diff --git a/pkg/front_end/testcases/general/function_invocation_bounds.dart.strong.modular.expect b/pkg/front_end/testcases/general/function_invocation_bounds.dart.strong.modular.expect index b044cdf1aff1..0d5545bf6af2 100644 --- a/pkg/front_end/testcases/general/function_invocation_bounds.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/function_invocation_bounds.dart.strong.modular.expect @@ -2,10 +2,9 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/function_invocation_bounds.dart:9:8: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'local'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/function_invocation_bounds.dart:9:9: Error: The argument type 'String' can't be assigned to the parameter type 'num'. // local(""); -// ^ +// ^ // // pkg/front_end/testcases/general/function_invocation_bounds.dart:10:8: Error: Type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'local'. // Try changing type arguments so that they conform to the bounds. @@ -16,10 +15,9 @@ library; // local(throw ''); // ^ // -// pkg/front_end/testcases/general/function_invocation_bounds.dart:15:4: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'call'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/function_invocation_bounds.dart:15:5: Error: The argument type 'String' can't be assigned to the parameter type 'num'. // f(""); -// ^ +// ^ // // pkg/front_end/testcases/general/function_invocation_bounds.dart:16:4: Error: Type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'call'. // Try changing type arguments so that they conform to the bounds. @@ -37,7 +35,9 @@ typedef G = (T%) → T%; static method test() → dynamic { function local(T t) → T return t; - local(""){(core::String) → core::String}; + local(invalid-expression "pkg/front_end/testcases/general/function_invocation_bounds.dart:9:9: Error: The argument type 'String' can't be assigned to the parameter type 'num'. + local(\"\"); + ^" in "" as{TypeError} core::num){(core::num) → core::num}; local(throw ""){(core::String) → core::String}; local(0){(core::int) → core::int}; local(throw ""){(core::int) → core::int}; @@ -45,7 +45,9 @@ static method test() → dynamic { local(throw ''); ^" in local{}.(throw ""); (T) → T f = local; - f(""){(core::String) → core::String}; + f(invalid-expression "pkg/front_end/testcases/general/function_invocation_bounds.dart:15:5: Error: The argument type 'String' can't be assigned to the parameter type 'num'. + f(\"\"); + ^" in "" as{TypeError} core::num){(core::num) → core::num}; f(throw ""){(core::String) → core::String}; f(0){(core::int) → core::int}; f(throw ""){(core::int) → core::int}; diff --git a/pkg/front_end/testcases/general/function_invocation_bounds.dart.strong.transformed.expect b/pkg/front_end/testcases/general/function_invocation_bounds.dart.strong.transformed.expect index b044cdf1aff1..0d5545bf6af2 100644 --- a/pkg/front_end/testcases/general/function_invocation_bounds.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/function_invocation_bounds.dart.strong.transformed.expect @@ -2,10 +2,9 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/function_invocation_bounds.dart:9:8: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'local'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/function_invocation_bounds.dart:9:9: Error: The argument type 'String' can't be assigned to the parameter type 'num'. // local(""); -// ^ +// ^ // // pkg/front_end/testcases/general/function_invocation_bounds.dart:10:8: Error: Type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'local'. // Try changing type arguments so that they conform to the bounds. @@ -16,10 +15,9 @@ library; // local(throw ''); // ^ // -// pkg/front_end/testcases/general/function_invocation_bounds.dart:15:4: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'call'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/function_invocation_bounds.dart:15:5: Error: The argument type 'String' can't be assigned to the parameter type 'num'. // f(""); -// ^ +// ^ // // pkg/front_end/testcases/general/function_invocation_bounds.dart:16:4: Error: Type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'call'. // Try changing type arguments so that they conform to the bounds. @@ -37,7 +35,9 @@ typedef G = (T%) → T%; static method test() → dynamic { function local(T t) → T return t; - local(""){(core::String) → core::String}; + local(invalid-expression "pkg/front_end/testcases/general/function_invocation_bounds.dart:9:9: Error: The argument type 'String' can't be assigned to the parameter type 'num'. + local(\"\"); + ^" in "" as{TypeError} core::num){(core::num) → core::num}; local(throw ""){(core::String) → core::String}; local(0){(core::int) → core::int}; local(throw ""){(core::int) → core::int}; @@ -45,7 +45,9 @@ static method test() → dynamic { local(throw ''); ^" in local{}.(throw ""); (T) → T f = local; - f(""){(core::String) → core::String}; + f(invalid-expression "pkg/front_end/testcases/general/function_invocation_bounds.dart:15:5: Error: The argument type 'String' can't be assigned to the parameter type 'num'. + f(\"\"); + ^" in "" as{TypeError} core::num){(core::num) → core::num}; f(throw ""){(core::String) → core::String}; f(0){(core::int) → core::int}; f(throw ""){(core::int) → core::int}; diff --git a/pkg/front_end/testcases/general/issue45660.dart.strong.expect b/pkg/front_end/testcases/general/issue45660.dart.strong.expect index 32ee7f1739a9..bd316b25d969 100644 --- a/pkg/front_end/testcases/general/issue45660.dart.strong.expect +++ b/pkg/front_end/testcases/general/issue45660.dart.strong.expect @@ -2,22 +2,24 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/issue45660.dart:8:22: Error: Inferred type argument 'Null' doesn't conform to the bound 'num' of the type variable 'T' on 'call'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/issue45660.dart:8:33: Error: The value 'null' can't be assigned to the parameter type 'num' because 'num' is not nullable. // extendsNumReturnArg/**/(null); -// ^ +// ^ // -// pkg/front_end/testcases/general/issue45660.dart:9:22: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'call'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/issue45660.dart:9:35: Error: The argument type 'String' can't be assigned to the parameter type 'num'. // extendsNumReturnArg/**/(""); -// ^ +// ^ // import self as self; import "dart:core" as core; static field (T) → T extendsNumReturnArg = (S s) → S => s; static method functionInvocations() → dynamic { - self::extendsNumReturnArg(null){(Null) → Null}; - self::extendsNumReturnArg(""){(core::String) → core::String}; + self::extendsNumReturnArg(invalid-expression "pkg/front_end/testcases/general/issue45660.dart:8:33: Error: The value 'null' can't be assigned to the parameter type 'num' because 'num' is not nullable. + extendsNumReturnArg/**/(null); + ^" in null as{TypeError} core::num){(core::num) → core::num}; + self::extendsNumReturnArg(invalid-expression "pkg/front_end/testcases/general/issue45660.dart:9:35: Error: The argument type 'String' can't be assigned to the parameter type 'num'. + extendsNumReturnArg/**/(\"\"); + ^" in "" as{TypeError} core::num){(core::num) → core::num}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/general/issue45660.dart.strong.modular.expect b/pkg/front_end/testcases/general/issue45660.dart.strong.modular.expect index 32ee7f1739a9..bd316b25d969 100644 --- a/pkg/front_end/testcases/general/issue45660.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/issue45660.dart.strong.modular.expect @@ -2,22 +2,24 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/issue45660.dart:8:22: Error: Inferred type argument 'Null' doesn't conform to the bound 'num' of the type variable 'T' on 'call'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/issue45660.dart:8:33: Error: The value 'null' can't be assigned to the parameter type 'num' because 'num' is not nullable. // extendsNumReturnArg/**/(null); -// ^ +// ^ // -// pkg/front_end/testcases/general/issue45660.dart:9:22: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'call'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/issue45660.dart:9:35: Error: The argument type 'String' can't be assigned to the parameter type 'num'. // extendsNumReturnArg/**/(""); -// ^ +// ^ // import self as self; import "dart:core" as core; static field (T) → T extendsNumReturnArg = (S s) → S => s; static method functionInvocations() → dynamic { - self::extendsNumReturnArg(null){(Null) → Null}; - self::extendsNumReturnArg(""){(core::String) → core::String}; + self::extendsNumReturnArg(invalid-expression "pkg/front_end/testcases/general/issue45660.dart:8:33: Error: The value 'null' can't be assigned to the parameter type 'num' because 'num' is not nullable. + extendsNumReturnArg/**/(null); + ^" in null as{TypeError} core::num){(core::num) → core::num}; + self::extendsNumReturnArg(invalid-expression "pkg/front_end/testcases/general/issue45660.dart:9:35: Error: The argument type 'String' can't be assigned to the parameter type 'num'. + extendsNumReturnArg/**/(\"\"); + ^" in "" as{TypeError} core::num){(core::num) → core::num}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/general/issue45660.dart.strong.transformed.expect b/pkg/front_end/testcases/general/issue45660.dart.strong.transformed.expect index 32ee7f1739a9..affb3dff400e 100644 --- a/pkg/front_end/testcases/general/issue45660.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/issue45660.dart.strong.transformed.expect @@ -2,22 +2,24 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/issue45660.dart:8:22: Error: Inferred type argument 'Null' doesn't conform to the bound 'num' of the type variable 'T' on 'call'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/issue45660.dart:8:33: Error: The value 'null' can't be assigned to the parameter type 'num' because 'num' is not nullable. // extendsNumReturnArg/**/(null); -// ^ +// ^ // -// pkg/front_end/testcases/general/issue45660.dart:9:22: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'call'. -// Try specifying type arguments explicitly so that they conform to the bounds. +// pkg/front_end/testcases/general/issue45660.dart:9:35: Error: The argument type 'String' can't be assigned to the parameter type 'num'. // extendsNumReturnArg/**/(""); -// ^ +// ^ // import self as self; import "dart:core" as core; static field (T) → T extendsNumReturnArg = (S s) → S => s; static method functionInvocations() → dynamic { - self::extendsNumReturnArg(null){(Null) → Null}; - self::extendsNumReturnArg(""){(core::String) → core::String}; + self::extendsNumReturnArg(invalid-expression "pkg/front_end/testcases/general/issue45660.dart:8:33: Error: The value 'null' can't be assigned to the parameter type 'num' because 'num' is not nullable. + extendsNumReturnArg/**/(null); + ^" in let Null #t1 = null in #t1 == null ?{core::num} #t1 as{TypeError} core::num : #t1{core::num}){(core::num) → core::num}; + self::extendsNumReturnArg(invalid-expression "pkg/front_end/testcases/general/issue45660.dart:9:35: Error: The argument type 'String' can't be assigned to the parameter type 'num'. + extendsNumReturnArg/**/(\"\"); + ^" in "" as{TypeError} core::num){(core::num) → core::num}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.expect b/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.expect index 6367ec09faea..fa4b357a3f5c 100644 --- a/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.expect +++ b/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.expect @@ -2,23 +2,19 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:16:14: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'Column' of the type variable 'F' on 'TableSchema'. +// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:16:34: Error: The argument type 'List' can't be assigned to the parameter type 'Iterable'. +// - 'List' is from 'dart:core'. +// - 'Iterable' is from 'dart:core'. // - 'Column' is from 'pkg/front_end/testcases/general/top_level_vs_local_inference.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // var schema = TableSchema(fields: []); -// ^ -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:9:19: Context: This is the type variable whose bound isn't conformed to. -// class TableSchema { -// ^ +// ^ // -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:19:16: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'Column' of the type variable 'F' on 'TableSchema'. +// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:19:36: Error: The argument type 'List' can't be assigned to the parameter type 'Iterable'. +// - 'List' is from 'dart:core'. +// - 'Iterable' is from 'dart:core'. // - 'Column' is from 'pkg/front_end/testcases/general/top_level_vs_local_inference.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // var schema = TableSchema(fields: []); -// ^ -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:9:19: Context: This is the type variable whose bound isn't conformed to. -// class TableSchema { -// ^ +// ^ // import self as self; import "dart:core" as core; @@ -40,9 +36,14 @@ class TableSchema extends static factory •({required core::Iterable fields, self::TableSchema::•::C? context = #C1}) → self::TableSchema return new self::TableSchema::_(); } -static field self::TableSchema schema = self::TableSchema::•(fields: []); +static field self::TableSchema schema = self::TableSchema::•(fields: []); static method method() → void { - self::TableSchema schema = self::TableSchema::•(fields: []); + self::TableSchema schema = self::TableSchema::•(fields: invalid-expression "pkg/front_end/testcases/general/top_level_vs_local_inference.dart:19:36: Error: The argument type 'List' can't be assigned to the parameter type 'Iterable'. + - 'List' is from 'dart:core'. + - 'Iterable' is from 'dart:core'. + - 'Column' is from 'pkg/front_end/testcases/general/top_level_vs_local_inference.dart'. + var schema = TableSchema(fields: []); + ^" in [] as{TypeError} core::Iterable); } constants { diff --git a/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.modular.expect b/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.modular.expect index 6367ec09faea..fa4b357a3f5c 100644 --- a/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.modular.expect +++ b/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.modular.expect @@ -2,23 +2,19 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:16:14: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'Column' of the type variable 'F' on 'TableSchema'. +// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:16:34: Error: The argument type 'List' can't be assigned to the parameter type 'Iterable'. +// - 'List' is from 'dart:core'. +// - 'Iterable' is from 'dart:core'. // - 'Column' is from 'pkg/front_end/testcases/general/top_level_vs_local_inference.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // var schema = TableSchema(fields: []); -// ^ -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:9:19: Context: This is the type variable whose bound isn't conformed to. -// class TableSchema { -// ^ +// ^ // -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:19:16: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'Column' of the type variable 'F' on 'TableSchema'. +// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:19:36: Error: The argument type 'List' can't be assigned to the parameter type 'Iterable'. +// - 'List' is from 'dart:core'. +// - 'Iterable' is from 'dart:core'. // - 'Column' is from 'pkg/front_end/testcases/general/top_level_vs_local_inference.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // var schema = TableSchema(fields: []); -// ^ -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:9:19: Context: This is the type variable whose bound isn't conformed to. -// class TableSchema { -// ^ +// ^ // import self as self; import "dart:core" as core; @@ -40,9 +36,14 @@ class TableSchema extends static factory •({required core::Iterable fields, self::TableSchema::•::C? context = #C1}) → self::TableSchema return new self::TableSchema::_(); } -static field self::TableSchema schema = self::TableSchema::•(fields: []); +static field self::TableSchema schema = self::TableSchema::•(fields: []); static method method() → void { - self::TableSchema schema = self::TableSchema::•(fields: []); + self::TableSchema schema = self::TableSchema::•(fields: invalid-expression "pkg/front_end/testcases/general/top_level_vs_local_inference.dart:19:36: Error: The argument type 'List' can't be assigned to the parameter type 'Iterable'. + - 'List' is from 'dart:core'. + - 'Iterable' is from 'dart:core'. + - 'Column' is from 'pkg/front_end/testcases/general/top_level_vs_local_inference.dart'. + var schema = TableSchema(fields: []); + ^" in [] as{TypeError} core::Iterable); } constants { diff --git a/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.outline.expect b/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.outline.expect index d18b7d18cdd3..eebd4a35103d 100644 --- a/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.outline.expect +++ b/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.outline.expect @@ -2,14 +2,12 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:16:14: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'Column' of the type variable 'F' on 'TableSchema'. +// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:16:34: Error: The argument type 'List' can't be assigned to the parameter type 'Iterable'. +// - 'List' is from 'dart:core'. +// - 'Iterable' is from 'dart:core'. // - 'Column' is from 'pkg/front_end/testcases/general/top_level_vs_local_inference.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // var schema = TableSchema(fields: []); -// ^ -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:9:19: Context: This is the type variable whose bound isn't conformed to. -// class TableSchema { -// ^ +// ^ // import self as self; import "dart:core" as core; @@ -28,6 +26,6 @@ class TableSchema extends static factory •({required core::Iterable fields, self::TableSchema::•::C? context = null}) → self::TableSchema ; } -static field self::TableSchema schema; +static field self::TableSchema schema; static method method() → void ; diff --git a/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.transformed.expect b/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.transformed.expect index 70f86c656a2e..281a4f43a576 100644 --- a/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/general/top_level_vs_local_inference.dart.strong.transformed.expect @@ -2,23 +2,19 @@ library; // // Problems in library: // -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:16:14: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'Column' of the type variable 'F' on 'TableSchema'. +// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:16:34: Error: The argument type 'List' can't be assigned to the parameter type 'Iterable'. +// - 'List' is from 'dart:core'. +// - 'Iterable' is from 'dart:core'. // - 'Column' is from 'pkg/front_end/testcases/general/top_level_vs_local_inference.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // var schema = TableSchema(fields: []); -// ^ -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:9:19: Context: This is the type variable whose bound isn't conformed to. -// class TableSchema { -// ^ +// ^ // -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:19:16: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'Column' of the type variable 'F' on 'TableSchema'. +// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:19:36: Error: The argument type 'List' can't be assigned to the parameter type 'Iterable'. +// - 'List' is from 'dart:core'. +// - 'Iterable' is from 'dart:core'. // - 'Column' is from 'pkg/front_end/testcases/general/top_level_vs_local_inference.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. // var schema = TableSchema(fields: []); -// ^ -// pkg/front_end/testcases/general/top_level_vs_local_inference.dart:9:19: Context: This is the type variable whose bound isn't conformed to. -// class TableSchema { -// ^ +// ^ // import self as self; import "dart:core" as core; @@ -40,9 +36,14 @@ class TableSchema extends static factory •({required core::Iterable fields, self::TableSchema::•::C? context = #C1}) → self::TableSchema return new self::TableSchema::_(); } -static field self::TableSchema schema = self::TableSchema::•(fields: core::_GrowableList::•(0)); +static field self::TableSchema schema = self::TableSchema::•(fields: core::_GrowableList::•(0)); static method method() → void { - self::TableSchema schema = self::TableSchema::•(fields: core::_GrowableList::•(0)); + self::TableSchema schema = self::TableSchema::•(fields: invalid-expression "pkg/front_end/testcases/general/top_level_vs_local_inference.dart:19:36: Error: The argument type 'List' can't be assigned to the parameter type 'Iterable'. + - 'List' is from 'dart:core'. + - 'Iterable' is from 'dart:core'. + - 'Column' is from 'pkg/front_end/testcases/general/top_level_vs_local_inference.dart'. + var schema = TableSchema(fields: []); + ^" in core::_GrowableList::•(0) as{TypeError} core::Iterable); } constants { diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart index 5b492504ca8c..d8fd3a15046d 100644 --- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart +++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart @@ -18,6 +18,5 @@ class NotA {} NotA myF() => throw ''; test() { - var /*@type=C*/ x = - new /*error:COULD_NOT_INFER*/ /*@typeArgs=NotA*/ C(myF); + var /*@type=C*/ x = new /*error:COULD_NOT_INFER*/ /*@typeArgs=A*/ C(myF); } diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.strong.expect index c5e116e703e8..03d33854e5e7 100644 --- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.strong.expect +++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.strong.expect @@ -2,15 +2,11 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart:22:56: Error: Inferred type argument 'NotA' doesn't conform to the bound 'A' of the type variable 'T' on 'C'. +// pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart:21:74: Error: The argument type 'NotA Function()' can't be assigned to the parameter type 'A Function()'. // - 'NotA' is from 'pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart'. // - 'A' is from 'pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// new /*error:COULD_NOT_INFER*/ /*@typeArgs=NotA*/ C(myF); -// ^ -// pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart:12:9: Context: This is the type variable whose bound isn't conformed to. -// class C { -// ^ +// var /*@type=C*/ x = new /*error:COULD_NOT_INFER*/ /*@typeArgs=A*/ C(myF); +// ^ // import self as self; import "dart:core" as core; @@ -34,7 +30,11 @@ class NotA extends core::Object { static method myF() → self::NotA return throw ""; static method test() → dynamic { - self::C x = new self::C::•(#C1); + self::C x = new self::C::•(invalid-expression "pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart:21:74: Error: The argument type 'NotA Function()' can't be assigned to the parameter type 'A Function()'. + - 'NotA' is from 'pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart'. + - 'A' is from 'pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart'. + var /*@type=C*/ x = new /*error:COULD_NOT_INFER*/ /*@typeArgs=A*/ C(myF); + ^" in #C1 as{TypeError} () → self::A); } constants { diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.strong.modular.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.strong.modular.expect index c5e116e703e8..03d33854e5e7 100644 --- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.strong.modular.expect +++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.strong.modular.expect @@ -2,15 +2,11 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart:22:56: Error: Inferred type argument 'NotA' doesn't conform to the bound 'A' of the type variable 'T' on 'C'. +// pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart:21:74: Error: The argument type 'NotA Function()' can't be assigned to the parameter type 'A Function()'. // - 'NotA' is from 'pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart'. // - 'A' is from 'pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// new /*error:COULD_NOT_INFER*/ /*@typeArgs=NotA*/ C(myF); -// ^ -// pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart:12:9: Context: This is the type variable whose bound isn't conformed to. -// class C { -// ^ +// var /*@type=C*/ x = new /*error:COULD_NOT_INFER*/ /*@typeArgs=A*/ C(myF); +// ^ // import self as self; import "dart:core" as core; @@ -34,7 +30,11 @@ class NotA extends core::Object { static method myF() → self::NotA return throw ""; static method test() → dynamic { - self::C x = new self::C::•(#C1); + self::C x = new self::C::•(invalid-expression "pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart:21:74: Error: The argument type 'NotA Function()' can't be assigned to the parameter type 'A Function()'. + - 'NotA' is from 'pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart'. + - 'A' is from 'pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart'. + var /*@type=C*/ x = new /*error:COULD_NOT_INFER*/ /*@typeArgs=A*/ C(myF); + ^" in #C1 as{TypeError} () → self::A); } constants { diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.strong.transformed.expect index c5e116e703e8..03d33854e5e7 100644 --- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart.strong.transformed.expect @@ -2,15 +2,11 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart:22:56: Error: Inferred type argument 'NotA' doesn't conform to the bound 'A' of the type variable 'T' on 'C'. +// pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart:21:74: Error: The argument type 'NotA Function()' can't be assigned to the parameter type 'A Function()'. // - 'NotA' is from 'pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart'. // - 'A' is from 'pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// new /*error:COULD_NOT_INFER*/ /*@typeArgs=NotA*/ C(myF); -// ^ -// pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart:12:9: Context: This is the type variable whose bound isn't conformed to. -// class C { -// ^ +// var /*@type=C*/ x = new /*error:COULD_NOT_INFER*/ /*@typeArgs=A*/ C(myF); +// ^ // import self as self; import "dart:core" as core; @@ -34,7 +30,11 @@ class NotA extends core::Object { static method myF() → self::NotA return throw ""; static method test() → dynamic { - self::C x = new self::C::•(#C1); + self::C x = new self::C::•(invalid-expression "pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart:21:74: Error: The argument type 'NotA Function()' can't be assigned to the parameter type 'A Function()'. + - 'NotA' is from 'pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart'. + - 'A' is from 'pkg/front_end/testcases/inference/constructors_infer_from_arguments_argument_not_assignable.dart'. + var /*@type=C*/ x = new /*error:COULD_NOT_INFER*/ /*@typeArgs=A*/ C(myF); + ^" in #C1 as{TypeError} () → self::A); } constants { diff --git a/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart b/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart index b66480aa3e06..3f79e931016d 100644 --- a/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart +++ b/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart @@ -9,15 +9,11 @@ import 'dart:math'; // T max(T x, T y); f(num x, dynamic y) { - num a = /*@typeArgs=num*/ max( - x, - /*info:DYNAMIC_CAST*/ y); - Object b = /*@typeArgs=num*/ max( - x, - /*info:DYNAMIC_CAST*/ y); - dynamic c = /*error:COULD_NOT_INFER*/ /*@ typeArgs=dynamic */ max(x, y); - var /*@ type=dynamic */ d = /*error:COULD_NOT_INFER*/ /*@ typeArgs=dynamic */ max( - x, y); + num a = /*@typeArgs=num*/ max(x, /*info:DYNAMIC_CAST*/ y); + Object b = /*@typeArgs=num*/ max(x, /*info:DYNAMIC_CAST*/ y); + dynamic c = /*@ typeArgs=num */ max(x, y); + var /*@ type=num */ d = /*@ typeArgs=num */ + max(x, y); } main() {} diff --git a/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.expect b/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.expect index 264593759444..007b099caf09 100644 --- a/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.expect +++ b/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.expect @@ -1,19 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart:18:65: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'num' of the type variable 'T' on 'max'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// dynamic c = /*error:COULD_NOT_INFER*/ /*@ typeArgs=dynamic */ max(x, y); -// ^ -// sdk/lib/_internal/vm/lib/math_patch.dart: Context: This is the type variable whose bound isn't conformed to. -// -// pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart:19:81: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'num' of the type variable 'T' on 'max'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// var /*@ type=dynamic */ d = /*error:COULD_NOT_INFER*/ /*@ typeArgs=dynamic */ max( -// ^ -// sdk/lib/_internal/vm/lib/math_patch.dart: Context: This is the type variable whose bound isn't conformed to. -// import self as self; import "dart:core" as core; import "dart:math" as math; @@ -23,7 +8,7 @@ import "dart:math"; static method f(core::num x, dynamic y) → dynamic { core::num a = math::max(x, y as{TypeError,ForDynamic} core::num); core::Object b = math::max(x, y as{TypeError,ForDynamic} core::num); - dynamic c = math::max(x, y); - dynamic d = math::max(x, y); + dynamic c = math::max(x, y); + core::num d = math::max(x, y); } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.modular.expect b/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.modular.expect index 264593759444..007b099caf09 100644 --- a/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.modular.expect +++ b/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.modular.expect @@ -1,19 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart:18:65: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'num' of the type variable 'T' on 'max'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// dynamic c = /*error:COULD_NOT_INFER*/ /*@ typeArgs=dynamic */ max(x, y); -// ^ -// sdk/lib/_internal/vm/lib/math_patch.dart: Context: This is the type variable whose bound isn't conformed to. -// -// pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart:19:81: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'num' of the type variable 'T' on 'max'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// var /*@ type=dynamic */ d = /*error:COULD_NOT_INFER*/ /*@ typeArgs=dynamic */ max( -// ^ -// sdk/lib/_internal/vm/lib/math_patch.dart: Context: This is the type variable whose bound isn't conformed to. -// import self as self; import "dart:core" as core; import "dart:math" as math; @@ -23,7 +8,7 @@ import "dart:math"; static method f(core::num x, dynamic y) → dynamic { core::num a = math::max(x, y as{TypeError,ForDynamic} core::num); core::Object b = math::max(x, y as{TypeError,ForDynamic} core::num); - dynamic c = math::max(x, y); - dynamic d = math::max(x, y); + dynamic c = math::max(x, y); + core::num d = math::max(x, y); } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.transformed.expect index 264593759444..007b099caf09 100644 --- a/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart.strong.transformed.expect @@ -1,19 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart:18:65: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'num' of the type variable 'T' on 'max'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// dynamic c = /*error:COULD_NOT_INFER*/ /*@ typeArgs=dynamic */ max(x, y); -// ^ -// sdk/lib/_internal/vm/lib/math_patch.dart: Context: This is the type variable whose bound isn't conformed to. -// -// pkg/front_end/testcases/inference/downward_inference_fixes_no_upwards_errors.dart:19:81: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'num' of the type variable 'T' on 'max'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// var /*@ type=dynamic */ d = /*error:COULD_NOT_INFER*/ /*@ typeArgs=dynamic */ max( -// ^ -// sdk/lib/_internal/vm/lib/math_patch.dart: Context: This is the type variable whose bound isn't conformed to. -// import self as self; import "dart:core" as core; import "dart:math" as math; @@ -23,7 +8,7 @@ import "dart:math"; static method f(core::num x, dynamic y) → dynamic { core::num a = math::max(x, y as{TypeError,ForDynamic} core::num); core::Object b = math::max(x, y as{TypeError,ForDynamic} core::num); - dynamic c = math::max(x, y); - dynamic d = math::max(x, y); + dynamic c = math::max(x, y); + core::num d = math::max(x, y); } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart b/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart index e80dbe999bd8..70b1a19e2f2e 100644 --- a/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart +++ b/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart @@ -22,7 +22,5 @@ test() { s = c; */ - new Foo() - . /*error:COULD_NOT_INFER*/ /*@typeArgs=int*/ /*@target=Foo.method*/ method( - 42); + new Foo(). /*@typeArgs=String*/ /*@target=Foo.method*/ method(42); } diff --git a/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.expect b/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.expect index 4c85d0218e10..d6ef270e8324 100644 --- a/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.expect +++ b/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.expect @@ -2,11 +2,9 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart:26:76: Error: Inferred type argument 'int' doesn't conform to the bound 'String' of the type variable 'U' on 'Foo.method'. -// - 'Foo' is from 'pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// . /*error:COULD_NOT_INFER*/ /*@typeArgs=int*/ /*@target=Foo.method*/ method( -// ^ +// pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart:25:73: Error: The argument type 'int' can't be assigned to the parameter type 'String'. +// new Foo(). /*@typeArgs=String*/ /*@target=Foo.method*/ method(42); +// ^ // import self as self; import "dart:core" as core; @@ -19,5 +17,7 @@ class Foo extends core::Object { return u; } static method test() → dynamic { - new self::Foo::•().{self::Foo::method}(42){(core::int) → core::int}; + new self::Foo::•().{self::Foo::method}(invalid-expression "pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart:25:73: Error: The argument type 'int' can't be assigned to the parameter type 'String'. + new Foo(). /*@typeArgs=String*/ /*@target=Foo.method*/ method(42); + ^" in 42 as{TypeError} core::String){(core::String) → core::String}; } diff --git a/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.modular.expect b/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.modular.expect index 4c85d0218e10..d6ef270e8324 100644 --- a/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.modular.expect +++ b/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.modular.expect @@ -2,11 +2,9 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart:26:76: Error: Inferred type argument 'int' doesn't conform to the bound 'String' of the type variable 'U' on 'Foo.method'. -// - 'Foo' is from 'pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// . /*error:COULD_NOT_INFER*/ /*@typeArgs=int*/ /*@target=Foo.method*/ method( -// ^ +// pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart:25:73: Error: The argument type 'int' can't be assigned to the parameter type 'String'. +// new Foo(). /*@typeArgs=String*/ /*@target=Foo.method*/ method(42); +// ^ // import self as self; import "dart:core" as core; @@ -19,5 +17,7 @@ class Foo extends core::Object { return u; } static method test() → dynamic { - new self::Foo::•().{self::Foo::method}(42){(core::int) → core::int}; + new self::Foo::•().{self::Foo::method}(invalid-expression "pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart:25:73: Error: The argument type 'int' can't be assigned to the parameter type 'String'. + new Foo(). /*@typeArgs=String*/ /*@target=Foo.method*/ method(42); + ^" in 42 as{TypeError} core::String){(core::String) → core::String}; } diff --git a/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.transformed.expect index 4c85d0218e10..d6ef270e8324 100644 --- a/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.transformed.expect @@ -2,11 +2,9 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart:26:76: Error: Inferred type argument 'int' doesn't conform to the bound 'String' of the type variable 'U' on 'Foo.method'. -// - 'Foo' is from 'pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// . /*error:COULD_NOT_INFER*/ /*@typeArgs=int*/ /*@target=Foo.method*/ method( -// ^ +// pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart:25:73: Error: The argument type 'int' can't be assigned to the parameter type 'String'. +// new Foo(). /*@typeArgs=String*/ /*@target=Foo.method*/ method(42); +// ^ // import self as self; import "dart:core" as core; @@ -19,5 +17,7 @@ class Foo extends core::Object { return u; } static method test() → dynamic { - new self::Foo::•().{self::Foo::method}(42){(core::int) → core::int}; + new self::Foo::•().{self::Foo::method}(invalid-expression "pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart:25:73: Error: The argument type 'int' can't be assigned to the parameter type 'String'. + new Foo(). /*@typeArgs=String*/ /*@target=Foo.method*/ method(42); + ^" in 42 as{TypeError} core::String){(core::String) → core::String}; } diff --git a/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.expect b/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.expect index dbfbb785917c..54748f26558a 100644 --- a/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.expect +++ b/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.expect @@ -2,13 +2,7 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); // ^ @@ -21,35 +15,17 @@ library test; // /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. // takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. -// - 'Object' is from 'dart:core'. -// takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); // ^ @@ -62,57 +38,27 @@ library test; // takeDID(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. // takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. -// - 'Object' is from 'dart:core'. -// takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOON(new C() . /*@target=C.m*/ m); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOON(new C() . /*@target=C.m*/ m); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOO(new C() . /*@target=C.m*/ m); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOO(new C() . /*@target=C.m*/ m); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOI(new C() . /*@target=C.m*/ m); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOI(new C() . /*@target=C.m*/ m); // ^ @@ -148,51 +94,51 @@ static method test() → dynamic { self::takeDDN(#C3); self::takeIIO(#C2); self::takeDDO(#C3); - self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. + self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); - ^" in #C5 as{TypeError} (core::Object, core::Object) → core::int); + ^" in #C4 as{TypeError} (core::Object, core::Object) → core::int); self::takeIDI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:28:73: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(double, int)'. /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max); ^" in #C4 as{TypeError} (core::double, core::int) → core::int); self::takeDID(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:30:73: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'double Function(int, double)'. /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max); ^" in #C4 as{TypeError} (core::int, core::double) → core::double); - self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); - ^" in #C5 as{TypeError} (core::Object, core::Object) → core::num); - self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + ^" in #C4 as{TypeError} (core::Object, core::Object) → core::num); + self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); - ^" in #C5 as{TypeError} (core::Object, core::Object) → core::num); - self::takeIII(#C7); - self::takeDDD(#C8); - self::takeNNN(#C9); - self::takeIDN(#C9); - self::takeDIN(#C9); - self::takeIIN(#C7); - self::takeDDN(#C8); - self::takeIIO(#C7); - self::takeDDO(#C8); - self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. + ^" in #C4 as{TypeError} (core::Object, core::Object) → core::num); + self::takeIII(#C6); + self::takeDDD(#C7); + self::takeNNN(#C8); + self::takeIDN(#C8); + self::takeDIN(#C8); + self::takeIIN(#C6); + self::takeDDN(#C7); + self::takeIIO(#C6); + self::takeDDO(#C7); + self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); - ^" in #C10 as{TypeError} (core::Object, core::Object) → core::int); + ^" in #C8 as{TypeError} (core::Object, core::Object) → core::int); self::takeIDI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:46:72: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(double, int)'. takeIDI(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min); - ^" in #C9 as{TypeError} (core::double, core::int) → core::int); + ^" in #C8 as{TypeError} (core::double, core::int) → core::int); self::takeDID(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:47:72: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'double Function(int, double)'. takeDID(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min); - ^" in #C9 as{TypeError} (core::int, core::double) → core::double); - self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + ^" in #C8 as{TypeError} (core::int, core::double) → core::double); + self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); - ^" in #C10 as{TypeError} (core::Object, core::Object) → core::num); - self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + ^" in #C8 as{TypeError} (core::Object, core::Object) → core::num); + self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); - ^" in #C10 as{TypeError} (core::Object, core::Object) → core::num); + ^" in #C8 as{TypeError} (core::Object, core::Object) → core::num); self::takeIII(new self::C::•().{self::C::m}{(T, T) → T}); self::takeDDD(new self::C::•().{self::C::m}{(T, T) → T}); self::takeNNN(new self::C::•().{self::C::m}{(T, T) → T}); @@ -202,18 +148,18 @@ static method test() → dynamic { self::takeDDN(new self::C::•().{self::C::m}{(T, T) → T}); self::takeIIO(new self::C::•().{self::C::m}{(T, T) → T}); self::takeDDO(new self::C::•().{self::C::m}{(T, T) → T}); - self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOON(new C() . /*@target=C.m*/ m); - ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::num); - self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::num); + self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOO(new C() . /*@target=C.m*/ m); - ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::num); - self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. + ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::num); + self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOI(new C() . /*@target=C.m*/ m); - ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::int); + ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::int); self::takeIDI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:85:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(double, int)'. takeIDI(new C() . /*@target=C.m*/ m); ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::double, core::int) → core::int); @@ -242,10 +188,8 @@ constants { #C2 = instantiation #C1 #C3 = instantiation #C1 #C4 = instantiation #C1 - #C5 = instantiation #C1 - #C6 = static-tearoff math::min - #C7 = instantiation #C6 - #C8 = instantiation #C6 - #C9 = instantiation #C6 - #C10 = instantiation #C6 + #C5 = static-tearoff math::min + #C6 = instantiation #C5 + #C7 = instantiation #C5 + #C8 = instantiation #C5 } diff --git a/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.modular.expect b/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.modular.expect index dbfbb785917c..54748f26558a 100644 --- a/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.modular.expect +++ b/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.modular.expect @@ -2,13 +2,7 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); // ^ @@ -21,35 +15,17 @@ library test; // /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. // takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. -// - 'Object' is from 'dart:core'. -// takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); // ^ @@ -62,57 +38,27 @@ library test; // takeDID(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. // takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. -// - 'Object' is from 'dart:core'. -// takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOON(new C() . /*@target=C.m*/ m); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOON(new C() . /*@target=C.m*/ m); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOO(new C() . /*@target=C.m*/ m); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOO(new C() . /*@target=C.m*/ m); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOI(new C() . /*@target=C.m*/ m); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOI(new C() . /*@target=C.m*/ m); // ^ @@ -148,51 +94,51 @@ static method test() → dynamic { self::takeDDN(#C3); self::takeIIO(#C2); self::takeDDO(#C3); - self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. + self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); - ^" in #C5 as{TypeError} (core::Object, core::Object) → core::int); + ^" in #C4 as{TypeError} (core::Object, core::Object) → core::int); self::takeIDI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:28:73: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(double, int)'. /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max); ^" in #C4 as{TypeError} (core::double, core::int) → core::int); self::takeDID(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:30:73: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'double Function(int, double)'. /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max); ^" in #C4 as{TypeError} (core::int, core::double) → core::double); - self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); - ^" in #C5 as{TypeError} (core::Object, core::Object) → core::num); - self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + ^" in #C4 as{TypeError} (core::Object, core::Object) → core::num); + self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); - ^" in #C5 as{TypeError} (core::Object, core::Object) → core::num); - self::takeIII(#C7); - self::takeDDD(#C8); - self::takeNNN(#C9); - self::takeIDN(#C9); - self::takeDIN(#C9); - self::takeIIN(#C7); - self::takeDDN(#C8); - self::takeIIO(#C7); - self::takeDDO(#C8); - self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. + ^" in #C4 as{TypeError} (core::Object, core::Object) → core::num); + self::takeIII(#C6); + self::takeDDD(#C7); + self::takeNNN(#C8); + self::takeIDN(#C8); + self::takeDIN(#C8); + self::takeIIN(#C6); + self::takeDDN(#C7); + self::takeIIO(#C6); + self::takeDDO(#C7); + self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); - ^" in #C10 as{TypeError} (core::Object, core::Object) → core::int); + ^" in #C8 as{TypeError} (core::Object, core::Object) → core::int); self::takeIDI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:46:72: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(double, int)'. takeIDI(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min); - ^" in #C9 as{TypeError} (core::double, core::int) → core::int); + ^" in #C8 as{TypeError} (core::double, core::int) → core::int); self::takeDID(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:47:72: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'double Function(int, double)'. takeDID(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min); - ^" in #C9 as{TypeError} (core::int, core::double) → core::double); - self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + ^" in #C8 as{TypeError} (core::int, core::double) → core::double); + self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); - ^" in #C10 as{TypeError} (core::Object, core::Object) → core::num); - self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + ^" in #C8 as{TypeError} (core::Object, core::Object) → core::num); + self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); - ^" in #C10 as{TypeError} (core::Object, core::Object) → core::num); + ^" in #C8 as{TypeError} (core::Object, core::Object) → core::num); self::takeIII(new self::C::•().{self::C::m}{(T, T) → T}); self::takeDDD(new self::C::•().{self::C::m}{(T, T) → T}); self::takeNNN(new self::C::•().{self::C::m}{(T, T) → T}); @@ -202,18 +148,18 @@ static method test() → dynamic { self::takeDDN(new self::C::•().{self::C::m}{(T, T) → T}); self::takeIIO(new self::C::•().{self::C::m}{(T, T) → T}); self::takeDDO(new self::C::•().{self::C::m}{(T, T) → T}); - self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOON(new C() . /*@target=C.m*/ m); - ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::num); - self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::num); + self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOO(new C() . /*@target=C.m*/ m); - ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::num); - self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. + ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::num); + self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOI(new C() . /*@target=C.m*/ m); - ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::int); + ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::int); self::takeIDI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:85:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(double, int)'. takeIDI(new C() . /*@target=C.m*/ m); ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::double, core::int) → core::int); @@ -242,10 +188,8 @@ constants { #C2 = instantiation #C1 #C3 = instantiation #C1 #C4 = instantiation #C1 - #C5 = instantiation #C1 - #C6 = static-tearoff math::min - #C7 = instantiation #C6 - #C8 = instantiation #C6 - #C9 = instantiation #C6 - #C10 = instantiation #C6 + #C5 = static-tearoff math::min + #C6 = instantiation #C5 + #C7 = instantiation #C5 + #C8 = instantiation #C5 } diff --git a/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.transformed.expect index dbfbb785917c..54748f26558a 100644 --- a/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.transformed.expect @@ -2,13 +2,7 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); // ^ @@ -21,35 +15,17 @@ library test; // /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. // takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. -// - 'Object' is from 'dart:core'. -// takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); // ^ @@ -62,57 +38,27 @@ library test; // takeDID(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. // takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. -// - 'Object' is from 'dart:core'. -// takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOON(new C() . /*@target=C.m*/ m); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOON(new C() . /*@target=C.m*/ m); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOO(new C() . /*@target=C.m*/ m); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOO(new C() . /*@target=C.m*/ m); // ^ // -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: Inferred type argument 'Object' doesn't conform to the bound 'num' of the type variable 'T' on 'T Function(T, T)'. -// - 'Object' is from 'dart:core'. -// Try specifying type arguments explicitly so that they conform to the bounds. -// takeOOI(new C() . /*@target=C.m*/ m); -// ^ -// -// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. +// pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. // - 'Object' is from 'dart:core'. // takeOOI(new C() . /*@target=C.m*/ m); // ^ @@ -148,51 +94,51 @@ static method test() → dynamic { self::takeDDN(#C3); self::takeIIO(#C2); self::takeDDO(#C3); - self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. + self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); - ^" in #C5 as{TypeError} (core::Object, core::Object) → core::int); + ^" in #C4 as{TypeError} (core::Object, core::Object) → core::int); self::takeIDI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:28:73: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(double, int)'. /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max); ^" in #C4 as{TypeError} (core::double, core::int) → core::int); self::takeDID(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:30:73: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'double Function(int, double)'. /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max); ^" in #C4 as{TypeError} (core::int, core::double) → core::double); - self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); - ^" in #C5 as{TypeError} (core::Object, core::Object) → core::num); - self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + ^" in #C4 as{TypeError} (core::Object, core::Object) → core::num); + self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max); - ^" in #C5 as{TypeError} (core::Object, core::Object) → core::num); - self::takeIII(#C7); - self::takeDDD(#C8); - self::takeNNN(#C9); - self::takeIDN(#C9); - self::takeDIN(#C9); - self::takeIIN(#C7); - self::takeDDN(#C8); - self::takeIIO(#C7); - self::takeDDO(#C8); - self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. + ^" in #C4 as{TypeError} (core::Object, core::Object) → core::num); + self::takeIII(#C6); + self::takeDDD(#C7); + self::takeNNN(#C8); + self::takeIDN(#C8); + self::takeDIN(#C8); + self::takeIIN(#C6); + self::takeDDN(#C7); + self::takeIIO(#C6); + self::takeDDO(#C7); + self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); - ^" in #C10 as{TypeError} (core::Object, core::Object) → core::int); + ^" in #C8 as{TypeError} (core::Object, core::Object) → core::int); self::takeIDI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:46:72: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(double, int)'. takeIDI(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min); - ^" in #C9 as{TypeError} (core::double, core::int) → core::int); + ^" in #C8 as{TypeError} (core::double, core::int) → core::int); self::takeDID(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:47:72: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'double Function(int, double)'. takeDID(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min); - ^" in #C9 as{TypeError} (core::int, core::double) → core::double); - self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + ^" in #C8 as{TypeError} (core::int, core::double) → core::double); + self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); - ^" in #C10 as{TypeError} (core::Object, core::Object) → core::num); - self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + ^" in #C8 as{TypeError} (core::Object, core::Object) → core::num); + self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min); - ^" in #C10 as{TypeError} (core::Object, core::Object) → core::num); + ^" in #C8 as{TypeError} (core::Object, core::Object) → core::num); self::takeIII(new self::C::•().{self::C::m}{(T, T) → T}); self::takeDDD(new self::C::•().{self::C::m}{(T, T) → T}); self::takeNNN(new self::C::•().{self::C::m}{(T, T) → T}); @@ -202,18 +148,18 @@ static method test() → dynamic { self::takeDDN(new self::C::•().{self::C::m}{(T, T) → T}); self::takeIIO(new self::C::•().{self::C::m}{(T, T) → T}); self::takeDDO(new self::C::•().{self::C::m}{(T, T) → T}); - self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + self::takeOON(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOON(new C() . /*@target=C.m*/ m); - ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::num); - self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'num Function(Object, Object)'. + ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::num); + self::takeOOO(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOO(new C() . /*@target=C.m*/ m); - ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::num); - self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: The argument type 'Object Function(Object, Object)' can't be assigned to the parameter type 'int Function(Object, Object)'. + ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::num); + self::takeOOI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'. - 'Object' is from 'dart:core'. takeOOI(new C() . /*@target=C.m*/ m); - ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::int); + ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::Object, core::Object) → core::int); self::takeIDI(invalid-expression "pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:85:37: Error: The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(double, int)'. takeIDI(new C() . /*@target=C.m*/ m); ^" in (new self::C::•().{self::C::m}{(T, T) → T}) as{TypeError} (core::double, core::int) → core::int); @@ -242,10 +188,8 @@ constants { #C2 = instantiation #C1 #C3 = instantiation #C1 #C4 = instantiation #C1 - #C5 = instantiation #C1 - #C6 = static-tearoff math::min - #C7 = instantiation #C6 - #C8 = instantiation #C6 - #C9 = instantiation #C6 - #C10 = instantiation #C6 + #C5 = static-tearoff math::min + #C6 = instantiation #C5 + #C7 = instantiation #C5 + #C8 = instantiation #C5 } diff --git a/pkg/front_end/testcases/modular.status b/pkg/front_end/testcases/modular.status index dfb43cbde9dc..fa6464520f5e 100644 --- a/pkg/front_end/testcases/modular.status +++ b/pkg/front_end/testcases/modular.status @@ -22,7 +22,6 @@ extension_types/simple_show_hide: ExpectationFileMismatchSerialized # Expected. extension_types/type_variable_in_static_context: ExpectationFileMismatchSerialized # Expected. extensions/extension_setter_error: TypeCheckError general/abstract_members: TypeCheckError -general/bounded_implicit_instantiation: TypeCheckError general/bug30695: TypeCheckError general/covariant_field: TypeCheckError general/crashes/crash_02/main: Crash diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.strong.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.strong.expect index d001566b22ff..003de958866f 100644 --- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.strong.expect +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.strong.expect @@ -22,37 +22,67 @@ library; // typedef C> = A; // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:7: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'call'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:8: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// f1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:7: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'call'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // f1(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:35:7: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'call'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:35:8: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// f2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:35:7: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'call'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // f2(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:36:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'local1'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:36:12: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// local1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:36:11: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'local1'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // local1(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:37:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'local2'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:37:12: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// local2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:37:11: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'local2'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // local2(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:38:5: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'topLevel1'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:38:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// topLevel1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:38:5: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'topLevel1'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // topLevel1(() => captureTypeArgument()); // ^ @@ -60,9 +90,15 @@ library; // void topLevel1>(A Function() g) => g(); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:39:5: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'topLevel2'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:39:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// topLevel2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:39:5: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'topLevel2'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // topLevel2(() => captureTypeArgument()); // ^ @@ -70,33 +106,57 @@ library; // void topLevel2>(C Function() g) => g(); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:40:5: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'Class.instance1'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:40:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// instance1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:40:5: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'Class.instance1'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // - 'Class' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // Try specifying type arguments explicitly so that they conform to the bounds. // instance1(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:41:5: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'Class.instance2'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:41:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// instance2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:41:5: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'Class.instance2'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // - 'Class' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // Try specifying type arguments explicitly so that they conform to the bounds. // instance2(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'Subclass.instance1'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:21: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// super.instance1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:11: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'Subclass.instance1'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // - 'Subclass' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // Try specifying type arguments explicitly so that they conform to the bounds. // super.instance1(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:48:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'Subclass.instance2'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:48:21: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// super.instance2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:48:11: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'Subclass.instance2'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // - 'Subclass' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // Try specifying type arguments explicitly so that they conform to the bounds. // super.instance2(() => captureTypeArgument()); @@ -128,14 +188,46 @@ class Class extends core::Object { = self::A>(() → self::A) → void f2 = local2; new self::A::•>(); new self::A::•>(); - f1(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - f2(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - local1(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - local2(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - self::topLevel1(() → self::A => self::captureTypeArgument>()); - self::topLevel2(() → self::A => self::captureTypeArgument>()); - this.{self::Class::instance1}(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - this.{self::Class::instance2}(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; + f1>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:8: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + f1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + f2>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:35:8: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + f2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + local1>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:36:12: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + local1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + local2>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:37:12: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + local2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + self::topLevel1>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:38:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + topLevel1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>); + self::topLevel2>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:39:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + topLevel2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>); + this.{self::Class::instance1}>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:40:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + instance1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + this.{self::Class::instance2}>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:41:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + instance2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; } } class Subclass extends self::Class { @@ -143,8 +235,16 @@ class Subclass extends self::Class { : super self::Class::•() ; method test() → void { - super.{self::Class::instance1}(() → self::A => self::captureTypeArgument>()); - super.{self::Class::instance2}(() → self::A => self::captureTypeArgument>()); + super.{self::Class::instance1}>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:21: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + super.instance1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>); + super.{self::Class::instance2}>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:48:21: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + super.instance2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>); } } static field core::Type? _capturedTypeArgument; diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.strong.modular.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.strong.modular.expect index d001566b22ff..003de958866f 100644 --- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.strong.modular.expect +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.strong.modular.expect @@ -22,37 +22,67 @@ library; // typedef C> = A; // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:7: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'call'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:8: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// f1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:7: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'call'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // f1(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:35:7: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'call'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:35:8: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// f2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:35:7: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'call'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // f2(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:36:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'local1'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:36:12: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// local1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:36:11: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'local1'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // local1(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:37:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'local2'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:37:12: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// local2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:37:11: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'local2'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // local2(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:38:5: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'topLevel1'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:38:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// topLevel1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:38:5: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'topLevel1'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // topLevel1(() => captureTypeArgument()); // ^ @@ -60,9 +90,15 @@ library; // void topLevel1>(A Function() g) => g(); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:39:5: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'topLevel2'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:39:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// topLevel2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:39:5: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'topLevel2'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // topLevel2(() => captureTypeArgument()); // ^ @@ -70,33 +106,57 @@ library; // void topLevel2>(C Function() g) => g(); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:40:5: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'Class.instance1'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:40:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// instance1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:40:5: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'Class.instance1'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // - 'Class' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // Try specifying type arguments explicitly so that they conform to the bounds. // instance1(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:41:5: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'Class.instance2'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:41:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// instance2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:41:5: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'Class.instance2'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // - 'Class' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // Try specifying type arguments explicitly so that they conform to the bounds. // instance2(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'Subclass.instance1'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:21: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// super.instance1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:11: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'Subclass.instance1'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // - 'Subclass' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // Try specifying type arguments explicitly so that they conform to the bounds. // super.instance1(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:48:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'Subclass.instance2'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:48:21: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// super.instance2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:48:11: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'Subclass.instance2'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // - 'Subclass' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // Try specifying type arguments explicitly so that they conform to the bounds. // super.instance2(() => captureTypeArgument()); @@ -128,14 +188,46 @@ class Class extends core::Object { = self::A>(() → self::A) → void f2 = local2; new self::A::•>(); new self::A::•>(); - f1(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - f2(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - local1(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - local2(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - self::topLevel1(() → self::A => self::captureTypeArgument>()); - self::topLevel2(() → self::A => self::captureTypeArgument>()); - this.{self::Class::instance1}(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - this.{self::Class::instance2}(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; + f1>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:8: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + f1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + f2>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:35:8: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + f2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + local1>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:36:12: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + local1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + local2>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:37:12: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + local2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + self::topLevel1>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:38:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + topLevel1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>); + self::topLevel2>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:39:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + topLevel2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>); + this.{self::Class::instance1}>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:40:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + instance1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + this.{self::Class::instance2}>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:41:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + instance2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; } } class Subclass extends self::Class { @@ -143,8 +235,16 @@ class Subclass extends self::Class { : super self::Class::•() ; method test() → void { - super.{self::Class::instance1}(() → self::A => self::captureTypeArgument>()); - super.{self::Class::instance2}(() → self::A => self::captureTypeArgument>()); + super.{self::Class::instance1}>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:21: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + super.instance1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>); + super.{self::Class::instance2}>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:48:21: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + super.instance2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>); } } static field core::Type? _capturedTypeArgument; diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.strong.transformed.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.strong.transformed.expect index d001566b22ff..003de958866f 100644 --- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.strong.transformed.expect @@ -22,37 +22,67 @@ library; // typedef C> = A; // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:7: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'call'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:8: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// f1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:7: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'call'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // f1(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:35:7: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'call'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:35:8: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// f2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:35:7: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'call'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // f2(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:36:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'local1'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:36:12: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// local1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:36:11: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'local1'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // local1(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:37:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'local2'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:37:12: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// local2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:37:11: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'local2'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // local2(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:38:5: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'topLevel1'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:38:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// topLevel1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:38:5: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'topLevel1'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // topLevel1(() => captureTypeArgument()); // ^ @@ -60,9 +90,15 @@ library; // void topLevel1>(A Function() g) => g(); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:39:5: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'topLevel2'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:39:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// topLevel2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:39:5: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'topLevel2'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // Try specifying type arguments explicitly so that they conform to the bounds. // topLevel2(() => captureTypeArgument()); // ^ @@ -70,33 +106,57 @@ library; // void topLevel2>(C Function() g) => g(); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:40:5: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'Class.instance1'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:40:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// instance1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:40:5: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'Class.instance1'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // - 'Class' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // Try specifying type arguments explicitly so that they conform to the bounds. // instance1(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:41:5: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'Class.instance2'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:41:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// instance2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:41:5: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'Class.instance2'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // - 'Class' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // Try specifying type arguments explicitly so that they conform to the bounds. // instance2(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'Subclass.instance1'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:21: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// super.instance1(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:11: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'Subclass.instance1'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // - 'Subclass' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // Try specifying type arguments explicitly so that they conform to the bounds. // super.instance1(() => captureTypeArgument()); // ^ // -// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:48:11: Error: Inferred type argument 'Object?' doesn't conform to the bound 'A' of the type variable 'X' on 'Subclass.instance2'. +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:48:21: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. +// - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // - 'Object' is from 'dart:core'. +// super.instance2(() => captureTypeArgument()); +// ^ +// +// pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:48:11: Error: Inferred type argument 'A' doesn't conform to the bound 'A' of the type variable 'X' on 'Subclass.instance2'. // - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. +// - 'Object' is from 'dart:core'. // - 'Subclass' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. // Try specifying type arguments explicitly so that they conform to the bounds. // super.instance2(() => captureTypeArgument()); @@ -128,14 +188,46 @@ class Class extends core::Object { = self::A>(() → self::A) → void f2 = local2; new self::A::•>(); new self::A::•>(); - f1(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - f2(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - local1(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - local2(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - self::topLevel1(() → self::A => self::captureTypeArgument>()); - self::topLevel2(() → self::A => self::captureTypeArgument>()); - this.{self::Class::instance1}(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; - this.{self::Class::instance2}(() → self::A => self::captureTypeArgument>()){(() → self::A) → void}; + f1>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:34:8: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + f1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + f2>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:35:8: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + f2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + local1>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:36:12: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + local1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + local2>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:37:12: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + local2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + self::topLevel1>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:38:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + topLevel1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>); + self::topLevel2>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:39:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + topLevel2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>); + this.{self::Class::instance1}>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:40:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + instance1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; + this.{self::Class::instance2}>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:41:15: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + instance2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>){(() → self::A>) → void}; } } class Subclass extends self::Class { @@ -143,8 +235,16 @@ class Subclass extends self::Class { : super self::Class::•() ; method test() → void { - super.{self::Class::instance1}(() → self::A => self::captureTypeArgument>()); - super.{self::Class::instance2}(() → self::A => self::captureTypeArgument>()); + super.{self::Class::instance1}>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:47:21: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + super.instance1(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>); + super.{self::Class::instance2}>(invalid-expression "pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart:48:21: Error: The argument type 'A Function()' can't be assigned to the parameter type 'A> Function()'. + - 'A' is from 'pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart'. + - 'Object' is from 'dart:core'. + super.instance2(() => captureTypeArgument()); + ^" in (() → self::A => self::captureTypeArgument>()) as{TypeError} () → self::A>); } } static field core::Type? _capturedTypeArgument; diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status index d5690ef640f6..c7fa2a4a2642 100644 --- a/pkg/front_end/testcases/strong.status +++ b/pkg/front_end/testcases/strong.status @@ -190,7 +190,6 @@ extensions/static_access_of_instance: RuntimeError general/abstract_members: TypeCheckError general/accessors: RuntimeError general/await_in_non_async: RuntimeError -general/bounded_implicit_instantiation: TypeCheckError general/bug30695: TypeCheckError general/call: RuntimeError general/cascade: RuntimeError diff --git a/tests/language/inference_using_bounds/pre_experiment/restricting_choices_using_bounds_error_test.dart b/tests/language/inference_using_bounds/pre_experiment/restricting_choices_using_bounds_error_test.dart new file mode 100644 index 000000000000..6172db680aa0 --- /dev/null +++ b/tests/language/inference_using_bounds/pre_experiment/restricting_choices_using_bounds_error_test.dart @@ -0,0 +1,154 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// @dart=3.5 + +import '../../static_type_helper.dart'; + +// For the motivational issue, see +// https://github.com/dart-lang/language/issues/1194 + +import 'dart:async'; + +class A {} + +class A2 extends A {} + +extension type EA(A? it) {} + +class B {} + +T foo1(T? t, dynamic r) => r as T; +bar1(FutureOr x) => foo1(x, "")..expectStaticType>(); +// ^^^^ +// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER +// [cfe] Inferred type argument 'FutureOr' doesn't conform to the bound 'Object' of the type variable 'T' on 'foo1'. +// ^ +// [cfe] Type argument 'Object Function(Object)' doesn't conform to the bound 'T Function(T)' of the type variable 'R' on 'StaticType|expectStaticType'. +// ^^^^^^^^^^^^^^^ +// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS + +T foo2(T? t, dynamic r) => r as T; +bar2(Null x) => foo2(x, 0)..expectStaticType>(); +// ^^^^ +// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER +// [cfe] Inferred type argument 'Null' doesn't conform to the bound 'num' of the type variable 'T' on 'foo2'. +// ^ +// [cfe] Type argument 'num Function(num)' doesn't conform to the bound 'T Function(T)' of the type variable 'R' on 'StaticType|expectStaticType'. +// ^^^^^^^^^^^^ +// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS + +T foo3(T? t, dynamic r) => r as T; +bar3(EA x) => foo3(x, false)..expectStaticType>(); +// ^^^^ +// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER +// [cfe] Inferred type argument 'EA' doesn't conform to the bound 'Object' of the type variable 'T' on 'foo3'. +// ^ +// [cfe] Type argument 'Object Function(Object)' doesn't conform to the bound 'T Function(T)' of the type variable 'R' on 'StaticType|expectStaticType'. +// ^^^^^^^^^^^^^^^ +// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS + +T foo4(T? t, dynamic r) => r as T; +bar4(S x) => foo4(x, A())..expectStaticType>(); +// ^^^^ +// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER +// [cfe] Inferred type argument 'S' doesn't conform to the bound 'A' of the type variable 'T' on 'foo4'. +// ^ +// [cfe] Type argument 'A Function(A)' doesn't conform to the bound 'T Function(T)' of the type variable 'R' on 'StaticType|expectStaticType'. +// ^^^^^^^^^^ +// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS + +T foo5, S>(T? t, dynamic r) => r as T; +bar5?>(U x) => + foo5(x, B())..expectStaticType>>(); +// ^^^^ +// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER +// [cfe] Inferred type argument 'U' doesn't conform to the bound 'B' of the type variable 'T' on 'foo5'. +// ^ +// [cfe] Type argument 'B Function(B)' doesn't conform to the bound 'T Function(T)' of the type variable 'R' on 'StaticType|expectStaticType'. +// ^^^^^^^^^^^^^ +// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS + +// The following test case checks that the implementations use `Object?` as the +// covariant replacement in the greatest closure of a type. +T foo6, S>(T? t, dynamic r) => r as T; +bar6(Null x) => foo6(x, B())..expectStaticType>>(); +// ^^^^ +// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER +// [cfe] Inferred type argument 'Null' doesn't conform to the bound 'B' of the type variable 'T' on 'foo6'. +// ^ +// [cfe] Type argument 'B Function(B)' doesn't conform to the bound 'T Function(T)' of the type variable 'R' on 'StaticType|expectStaticType'. +// ^^^^^^^^^^^^^^^^^^^ +// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS + +T foo7, S>(T? t, dynamic r) => r as T; +bar7?>(U x) => + foo7(x, B())..expectStaticType>>(); +// ^^^^ +// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER +// [cfe] Inferred type argument 'U' doesn't conform to the bound 'B' of the type variable 'T' on 'foo7'. +// ^ +// [cfe] Type argument 'B Function(B)' doesn't conform to the bound 'T Function(T)' of the type variable 'R' on 'StaticType|expectStaticType'. +// ^^^^^^^^^^^^^^^^^^^^^^^ +// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS + +// The following test case checks that the implementations use `Never` as the +// covariant replacement in the greatest closure of a type.p +T foo8, S extends A2>(T? t, dynamic r) => r as T; +bar8?>(U? x) => + foo8(x, B())..expectStaticType>>(); +// ^^^^ +// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER +// [cfe] Inferred type argument 'U' doesn't conform to the bound 'B' of the type variable 'T' on 'foo8'. +// ^ +// [cfe] Type argument 'B Function(B)' doesn't conform to the bound 'T Function(T)' of the type variable 'R' on 'StaticType|expectStaticType'. +// ^^^^^^^^^^^^^^^^^^^^^^^ +// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS + +T foo9(T? t, dynamic r) => r as T; +bar9(S? x) => foo9(x, 0)..expectStaticType>(); +// ^^^^ +// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER +// [cfe] Inferred type argument 'S' doesn't conform to the bound 'Object' of the type variable 'T' on 'foo9'. +// ^ +// [cfe] Type argument 'num Function(num)' doesn't conform to the bound 'T Function(T)' of the type variable 'R' on 'StaticType|expectStaticType'. +// ^^^^^^^^^^^^ +// [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS + +// The following checks that the trivial case of the absent bound of the +// variable being inferred isn't affected. +T foo10(T? t, dynamic r) => r as T; +bar10?>(U? x) => foo10(x, B()); + +main() { + bar1(null); + bar1(""); + bar1(0); + + bar2(null); + + bar3(EA(null)); + bar3(EA(A())); + + bar4(null); + bar4(A()); + + bar5(null); + bar5(B()); + bar5(B>()); + + bar6(null); + + bar7(null); + bar7(B()); + bar7(B)>()); + + bar8(null); + bar8(B()); + bar8(B()); + + bar9(null); + bar9(0); + bar9(.1); +} diff --git a/tests/language/inference_using_bounds/restricting_choices_using_bounds_test.dart b/tests/language/inference_using_bounds/restricting_choices_using_bounds_test.dart new file mode 100644 index 000000000000..91514e1e9a83 --- /dev/null +++ b/tests/language/inference_using_bounds/restricting_choices_using_bounds_test.dart @@ -0,0 +1,91 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// SharedOptions=--enable-experiment=inference-using-bounds + +import '../static_type_helper.dart'; + +// For the motivational issue, see +// https://github.com/dart-lang/language/issues/1194 + +import 'dart:async'; + +class A {} + +class A2 extends A {} + +extension type EA(A? it) {} + +class B {} + +T foo1(T? t, dynamic r) => r as T; +bar1(FutureOr x) => foo1(x, "")..expectStaticType>(); + +T foo2(T? t, dynamic r) => r as T; +bar2(Null x) => foo2(x, 0)..expectStaticType>(); + +T foo3(T? t, dynamic r) => r as T; +bar3(EA x) => foo3(x, false)..expectStaticType>(); + +T foo4(T? t, dynamic r) => r as T; +bar4(S x) => foo4(x, A())..expectStaticType>(); + +T foo5, S>(T? t, dynamic r) => r as T; +bar5?>(U x) => + foo5(x, B())..expectStaticType>>(); + +// The following test case checks that the implementations use `Object?` as the +// covariant replacement in the greatest closure of a type. +T foo6, S>(T? t, dynamic r) => r as T; +bar6(Null x) => foo6(x, B())..expectStaticType>>(); + +T foo7, S>(T? t, dynamic r) => r as T; +bar7?>(U x) => + foo7(x, B())..expectStaticType>>(); + +// The following test case checks that the implementations use `Never` as the +// covariant replacement in the greatest closure of a type.p +T foo8, S extends A2>(T? t, dynamic r) => r as T; +bar8?>(U? x) => + foo8(x, B())..expectStaticType>>(); + +T foo9(T? t, dynamic r) => r as T; +bar9(S? x) => foo9(x, 0)..expectStaticType>(); + +// The following checks that the trivial case of the absent bound of the +// variable being inferred isn't affected. +T foo10(T? t, dynamic r) => r as T; +bar10?>(U? x) => foo10(x, B()); + +main() { + bar1(null); + bar1(""); + bar1(0); + + bar2(null); + + bar3(EA(null)); + bar3(EA(A())); + + bar4(null); + bar4(A()); + + bar5(null); + bar5(B()); + bar5(B>()); + + bar6(null); + + bar7(null); + bar7(B()); + bar7(B)>()); + + bar8(null); + bar8(B()); + bar8(B()); + + bar9(null); + bar9(0); + bar9(.1); +} diff --git a/tools/VERSION b/tools/VERSION index f0303fb36d85..950951cce792 100644 --- a/tools/VERSION +++ b/tools/VERSION @@ -27,5 +27,5 @@ CHANNEL dev MAJOR 3 MINOR 7 PATCH 0 -PRERELEASE 57 +PRERELEASE 58 PRERELEASE_PATCH 0