Version 2.15.0-88.0.dev
Merge commit 'e161187728c824d062be8282a7c6de9b703d12e5' into 'dev'
diff --git a/DEPS b/DEPS
index 503c2f8..0719a0f 100644
--- a/DEPS
+++ b/DEPS
@@ -44,7 +44,7 @@
# co19 is a cipd package. Use update.sh in tests/co19[_2] to update these
# hashes. It requires access to the dart-build-access group, which EngProd
# has.
- "co19_rev": "a4f77a02a3676b1c2e7390c860cb0486c8515d3f",
+ "co19_rev": "4aae571b0358e2f063ab68f2eb92857e31deb0b9",
"co19_2_rev": "3e1ea1af9ef293d7f6a8f3332b5c71c7072a30e0",
# The internal benchmarks to use. See go/dart-benchmarks-internal
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
index 93ebfdc..613e335 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
@@ -651,9 +651,9 @@
@override
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
- Token onKeyword, Token endToken) {
- listener?.endExtensionDeclaration(
- extensionKeyword, typeKeyword, onKeyword, endToken);
+ Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
+ listener?.endExtensionDeclaration(extensionKeyword, typeKeyword, onKeyword,
+ showKeyword, hideKeyword, endToken);
}
@override
@@ -1160,6 +1160,13 @@
}
@override
+ void handleExtensionShowHide(Token? showKeyword, int showElementCount,
+ Token? hideKeyword, int hideElementCount) {
+ listener?.handleExtensionShowHide(
+ showKeyword, showElementCount, hideKeyword, hideElementCount);
+ }
+
+ @override
void handleClassWithClause(Token withKeyword) {
listener?.handleClassWithClause(withKeyword);
}
@@ -1281,6 +1288,11 @@
}
@override
+ void handleShowHideIdentifier(Token? modifier, Token identifier) {
+ listener?.handleShowHideIdentifier(modifier, identifier);
+ }
+
+ @override
void handleIdentifier(Token token, IdentifierContext context) {
listener?.handleIdentifier(token, context);
}
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context.dart b/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context.dart
index 4615974..5236661 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context.dart
@@ -226,6 +226,30 @@
static const ExpressionIdentifierContext expressionContinuation =
const ExpressionIdentifierContext.continuation();
+ /// Identifier appears in a show or a hide clause of an extension type
+ /// declaration preceded by 'get'.
+ static const ExtensionShowHideElementIdentifierContext
+ extensionShowHideElementGetter =
+ const ExtensionShowHideElementIdentifierContext.getter();
+
+ /// Identifier appears in a show or a hide clause of an extension type
+ /// declaration, not preceded by 'get', 'set', or 'operator'.
+ static const ExtensionShowHideElementIdentifierContext
+ extensionShowHideElementMemberOrType =
+ const ExtensionShowHideElementIdentifierContext.memberOrType();
+
+ /// Identifier appears in a show or a hide clause of an extension type
+ /// declaration preceded by 'operator'.
+ static const ExtensionShowHideElementIdentifierContext
+ extensionShowHideElementOperator =
+ const ExtensionShowHideElementIdentifierContext.operator();
+
+ /// Identifier appears in a show or a hide clause of an extension type
+ /// declaration preceded by 'set'.
+ static const ExtensionShowHideElementIdentifierContext
+ extensionShowHideElementSetter =
+ const ExtensionShowHideElementIdentifierContext.setter();
+
/// Identifier is a reference to a named argument of a function or method
/// invocation (e.g. `foo` in `f(foo: 0);`.
static const NamedArgumentReferenceIdentifierContext namedArgumentReference =
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart
index 68721e0..6e224d0 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart
@@ -371,6 +371,84 @@
}
}
+/// See [IdentifierContext.extensionShowHideElementGetter],
+/// [IdentifierContext.extensionShowHideElementMemberOrType],
+/// [IdentifierContext.extensionShowHideElementOperator],
+/// [IdentifierContext.extensionShowHideElementSetter].
+class ExtensionShowHideElementIdentifierContext extends IdentifierContext {
+ static const int _getterKind = 0;
+ static const int _memberOrTypeKind = 1;
+ static const int _operator = 2;
+ static const int _setterKind = 3;
+
+ final int _kind;
+
+ const ExtensionShowHideElementIdentifierContext.getter()
+ : _kind = _getterKind,
+ super('extensionShowHideElementGetter', inDeclaration: true);
+
+ const ExtensionShowHideElementIdentifierContext.memberOrType()
+ : _kind = _memberOrTypeKind,
+ super('extensionShowHideElementMemberOrType', inDeclaration: true);
+
+ const ExtensionShowHideElementIdentifierContext.operator()
+ : _kind = _operator,
+ super('extensionShowHideElementOperator', inDeclaration: true);
+
+ const ExtensionShowHideElementIdentifierContext.setter()
+ : _kind = _setterKind,
+ super('extensionShowHideElementSetter', inDeclaration: true);
+
+ @override
+ Token ensureIdentifier(Token token, Parser parser) {
+ Token identifier = token.next!;
+ if (identifier.isIdentifier ||
+ _kind == _operator && identifier.isOperator) {
+ return identifier;
+ }
+
+ // Recovery
+ const List<String> afterIdentifier = const [
+ '<',
+ '{',
+ 'extends',
+ 'with',
+ 'implements',
+ 'on',
+ '=',
+ ];
+ if (identifier.isEof ||
+ (looksLikeStartOfNextTopLevelDeclaration(identifier) &&
+ (identifier.next == null ||
+ !isOneOfOrEof(identifier.next!, afterIdentifier))) ||
+ (isOneOfOrEof(identifier, afterIdentifier) &&
+ (identifier.next == null ||
+ !isOneOfOrEof(identifier.next!, afterIdentifier)))) {
+ identifier = parser.insertSyntheticIdentifier(token, this,
+ message: codes.templateExpectedIdentifier.withArguments(identifier));
+ } else {
+ if (!identifier.isKeywordOrIdentifier) {
+ parser.reportRecoverableErrorWithToken(
+ identifier, codes.templateExpectedIdentifier);
+ // When in doubt, consume the token to ensure we make progress
+ // but insert a synthetic identifier to satisfy listeners.
+ identifier = parser.rewriter.insertSyntheticIdentifier(identifier);
+ } else {
+ // Use the keyword as the identifier.
+ parser.reportRecoverableErrorWithToken(
+ identifier, codes.templateExpectedIdentifierButGotKeyword);
+ }
+ }
+ return identifier;
+ }
+
+ @override
+ bool operator ==(dynamic other) {
+ return other is ExtensionShowHideElementIdentifierContext &&
+ _kind == other._kind;
+ }
+}
+
/// See [IdentifierContext.fieldDeclaration].
class FieldDeclarationIdentifierContext extends IdentifierContext {
const FieldDeclarationIdentifierContext()
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
index 564eaaa..d597b3a 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
@@ -144,6 +144,14 @@
logEvent("ClassImplements");
}
+ /// Handle a show clause in an extension declaration.
+ /// Substructures:
+ /// - shown types and instance members
+ void handleExtensionShowHide(Token? showKeyword, int showElementCount,
+ Token? hideKeyword, int hideElementCount) {
+ logEvent("ExtensionShowHide");
+ }
+
/// Handle the header of a class declaration. Substructures:
/// - metadata
/// - modifiers
@@ -238,7 +246,7 @@
/// - on type
/// - body
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
- Token onKeyword, Token endToken) {
+ Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
logEvent('ExtensionDeclaration');
}
@@ -1445,6 +1453,13 @@
logEvent("Identifier");
}
+ /// Handle an identifier token in a show or hide clause.
+ ///
+ /// [context] indicates what kind of construct the identifier appears in.
+ void handleShowHideIdentifier(Token? modifier, Token identifier) {
+ logEvent("ShowHideIdentifier");
+ }
+
void handleIndexedExpression(
Token? question, Token openSquareBracket, Token closeSquareBracket) {
logEvent("IndexedExpression");
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
index f35035f..c59af84 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
@@ -2391,6 +2391,63 @@
}
TypeInfo typeInfo = computeType(onKeyword, /* required = */ true);
token = typeInfo.ensureTypeOrVoid(onKeyword, this);
+
+ int handleShowHideElements() {
+ int elementCount = 0;
+ do {
+ Token next = token.next!.next!;
+ if (optional('get', next)) {
+ token = IdentifierContext.extensionShowHideElementGetter
+ .ensureIdentifier(next, this);
+ listener.handleShowHideIdentifier(next, token);
+ } else if (optional('operator', next)) {
+ token = IdentifierContext.extensionShowHideElementOperator
+ .ensureIdentifier(next, this);
+ listener.handleShowHideIdentifier(next, token);
+ } else if (optional('set', next)) {
+ token = IdentifierContext.extensionShowHideElementSetter
+ .ensureIdentifier(next, this);
+ listener.handleShowHideIdentifier(next, token);
+ } else {
+ TypeInfo typeInfo = computeType(
+ token.next!,
+ /* required = */ true,
+ /* inDeclaration = */ true,
+ /* acceptKeywordForSimpleType = */ true);
+ final bool isUnambiguouslyType =
+ typeInfo.hasTypeArguments || typeInfo is PrefixedType;
+ if (isUnambiguouslyType) {
+ token = typeInfo.ensureTypeOrVoid(token.next!, this);
+ } else {
+ token = IdentifierContext.extensionShowHideElementMemberOrType
+ .ensureIdentifier(token.next!, this);
+ listener.handleShowHideIdentifier(null, token);
+ }
+ }
+ ++elementCount;
+ } while (optional(',', token.next!));
+ return elementCount;
+ }
+
+ Token? showKeyword = token.next!;
+ int showElementCount = 0;
+ if (optional('show', showKeyword)) {
+ showElementCount = handleShowHideElements();
+ } else {
+ showKeyword = null;
+ }
+
+ Token? hideKeyword = token.next!;
+ int hideElementCount = 0;
+ if (optional('hide', hideKeyword)) {
+ hideElementCount = handleShowHideElements();
+ } else {
+ hideKeyword = null;
+ }
+
+ listener.handleExtensionShowHide(
+ showKeyword, showElementCount, hideKeyword, hideElementCount);
+
if (!optional('{', token.next!)) {
// Recovery
Token next = token.next!;
@@ -2417,8 +2474,8 @@
}
token = parseClassOrMixinOrExtensionBody(
token, DeclarationKind.Extension, name?.lexeme);
- listener.endExtensionDeclaration(
- extensionKeyword, typeKeyword, onKeyword, token);
+ listener.endExtensionDeclaration(extensionKeyword, typeKeyword, onKeyword,
+ showKeyword, hideKeyword, token);
return token;
}
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart
index 96a61a4..d475eed 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart
@@ -48,6 +48,7 @@
FunctionBody,
FunctionBodyAsyncToken,
FunctionBodyStarToken,
+ HideClause,
Identifier,
IdentifierList,
Initializers,
@@ -55,8 +56,10 @@
Metadata,
Modifiers,
Name,
+ OperatorList,
ParameterDefaultValue,
Prefix,
+ ShowClause,
StringLiteral,
SwitchScope,
Token,
@@ -346,6 +349,12 @@
}
@override
+ void handleExtensionShowHide(Token? showKeyword, int showElementCount,
+ Token? hideKeyword, int hideElementCount) {
+ debugEvent("ExtensionShow");
+ }
+
+ @override
void handleNoTypeArguments(Token token) {
debugEvent("NoTypeArguments");
push(NullValue.TypeArguments);
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/type_info.dart b/pkg/_fe_analyzer_shared/lib/src/parser/type_info.dart
index 2546579..84f65f6 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/type_info.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/type_info.dart
@@ -36,6 +36,9 @@
/// void Function foo(int x);
bool get isFunctionType;
+ /// Returns true if the type has type arguments.
+ bool get hasTypeArguments;
+
/// Call this function when the token after [token] must be a type (not void).
/// This function will call the appropriate event methods on the [Parser]'s
/// listener to handle the type, inserting a synthetic type reference if
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart
index 899bbd4..939bcc0 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/type_info_impl.dart
@@ -99,6 +99,9 @@
bool get couldBeExpression => false;
@override
+ bool get hasTypeArguments => false;
+
+ @override
bool get isNullable => false;
@override
@@ -143,6 +146,9 @@
bool get couldBeExpression => true;
@override
+ bool get hasTypeArguments => false;
+
+ @override
bool get isNullable => false;
@override
@@ -229,6 +235,9 @@
bool get couldBeExpression => false;
@override
+ bool get hasTypeArguments => true;
+
+ @override
bool get isNullable => false;
@override
@@ -306,6 +315,9 @@
bool get couldBeExpression => true;
@override
+ bool get hasTypeArguments => false;
+
+ @override
bool get isNullable => false;
@override
@@ -354,6 +366,9 @@
bool get couldBeExpression => false;
@override
+ bool get hasTypeArguments => false;
+
+ @override
bool get isNullable => false;
@override
@@ -493,6 +508,9 @@
typeArguments == noTypeParamOrArg && typeVariableStarters.isEmpty;
@override
+ bool get hasTypeArguments => typeArguments is! NoTypeParamOrArg;
+
+ @override
bool get isNullable => beforeQuestionMark != null;
@override
@@ -828,11 +846,8 @@
listener.beginTypeVariable(token);
listener.handleTypeVariablesDefined(token, /* count = */ 1);
listener.handleNoType(token);
- listener.endTypeVariable(
- endGroup,
- /* index = */ 0,
- /* extendsOrSuper = */ null,
- /* variance = */ null);
+ listener.endTypeVariable(endGroup, /* index = */ 0,
+ /* extendsOrSuper = */ null, /* variance = */ null);
listener.endTypeVariables(beginGroup, endGroup);
return endGroup;
}
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 2df5ebb..bfbb493 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -469,6 +469,8 @@
R? visitGenericTypeAlias(GenericTypeAlias node);
+ R? visitHideClause(HideClause node);
+
R? visitHideCombinator(HideCombinator node);
R? visitIfElement(IfElement node);
@@ -544,8 +546,12 @@
R? visitSetOrMapLiteral(SetOrMapLiteral node);
+ R? visitShowClause(ShowClause node);
+
R? visitShowCombinator(ShowCombinator node);
+ R? visitShowHideElement(ShowHideElement node);
+
R? visitSimpleFormalParameter(SimpleFormalParameter node);
R? visitSimpleIdentifier(SimpleIdentifier node);
@@ -1683,7 +1689,8 @@
///
/// extension ::=
/// 'extension' [SimpleIdentifier]? [TypeParameterList]?
-/// 'on' [TypeAnnotation] '{' [ClassMember]* '}'
+/// 'on' [TypeAnnotation] [ShowClause]? [HideClause]?
+/// '{' [ClassMember]* '}'
///
/// Clients may not extend, implement or mix-in this class.
abstract class ExtensionDeclaration implements CompilationUnitMember {
@@ -1696,6 +1703,10 @@
/// Return the token representing the 'extension' keyword.
Token get extensionKeyword;
+ /// Return the hide clause, or `null` if the extension does not have a hide
+ /// clause.
+ HideClause? get hideClause;
+
/// Return the left curly bracket.
Token get leftBracket;
@@ -1712,6 +1723,10 @@
/// Return the right curly bracket.
Token get rightBracket;
+ /// Return the show clause, or `null` if the extension does not have a show
+ /// clause.
+ ShowClause? get showClause;
+
/// Return the token representing the 'type' keyword.
Token? get typeKeyword;
@@ -2437,6 +2452,20 @@
TypeParameterList? get typeParameters;
}
+/// The "hide" clause in an extension declaration.
+///
+/// hideClause ::=
+/// 'hide' [TypeName] (',' [TypeName])*
+///
+/// Clients may not extend, implement or mix-in this class.
+abstract class HideClause implements AstNode {
+ /// Return the list of the elements that are being shown.
+ NodeList<ShowHideClauseElement> get elements;
+
+ /// Return the token representing the 'hide' keyword.
+ Token get hideKeyword;
+}
+
/// A combinator that restricts the names being imported to those that are not
/// in a given list.
///
@@ -3667,6 +3696,20 @@
Token get rightBracket;
}
+/// The "show" clause in an extension declaration.
+///
+/// showClause ::=
+/// 'show' [TypeName] (',' [TypeName])*
+///
+/// Clients may not extend, implement or mix-in this class.
+abstract class ShowClause implements AstNode {
+ /// Return the list of the elements that are being shown.
+ NodeList<ShowHideClauseElement> get elements;
+
+ /// Return the token representing the 'show' keyword.
+ Token get showKeyword;
+}
+
/// A combinator that restricts the names being imported to those in a given list.
///
/// showCombinator ::=
@@ -3679,6 +3722,29 @@
NodeList<SimpleIdentifier> get shownNames;
}
+/// A node that can appear in the show or hide clauses.
+///
+/// Clients may not extend, implement or mix-in this class.
+abstract class ShowHideClauseElement implements AstNode {}
+
+/// A potentially non-type element of a show or a hide clause.
+///
+/// showHideElement ::=
+/// 'get' [SimpleIdentifier] |
+/// 'set' [SimpleIdentifier] |
+/// 'operator' [SimpleIdentifier] |
+/// [SimpleIdentifier]
+///
+/// Clients may not extend, implement or mix-in this class.
+abstract class ShowHideElement implements AstNode, ShowHideClauseElement {
+ /// Return the 'get', 'set', or 'operator' modifier that appears before the
+ /// name, or `null` if there is no modifier.
+ Token? get modifier;
+
+ /// Return the name of the member the element refers to.
+ SimpleIdentifier get name;
+}
+
/// A simple formal parameter.
///
/// simpleFormalParameter ::=
@@ -4182,7 +4248,7 @@
/// [Identifier] typeArguments?
///
/// Clients may not extend, implement or mix-in this class.
-abstract class TypeName implements NamedType {}
+abstract class TypeName implements NamedType, ShowHideClauseElement {}
/// A type parameter.
///
diff --git a/pkg/analyzer/lib/dart/ast/ast_factory.dart b/pkg/analyzer/lib/dart/ast/ast_factory.dart
index d8469f2..7dc28ed 100644
--- a/pkg/analyzer/lib/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/dart/ast/ast_factory.dart
@@ -545,6 +545,11 @@
TypeAnnotation type,
Token semicolon);
+ /// Returns a newly created hide clause.
+ HideClause hideClause(
+ {required Token hideKeyword,
+ required List<ShowHideClauseElement> elements});
+
/// Returns a newly created import show combinator.
HideCombinator hideCombinator(
Token keyword, List<SimpleIdentifier> hiddenNames);
@@ -792,10 +797,19 @@
required List<CollectionElement> elements,
required Token rightBracket});
+ /// Returns a newly created show clause.
+ ShowClause showClause(
+ {required Token showKeyword,
+ required List<ShowHideClauseElement> elements});
+
/// Returns a newly created import show combinator.
ShowCombinator showCombinator(
Token keyword, List<SimpleIdentifier> shownNames);
+ /// Returns a newly created element of a show or hide clause.
+ ShowHideElement showHideElement(
+ {required Token? modifier, required SimpleIdentifier name});
+
/// Returns a newly created formal parameter. Either or both of the
/// [comment] and [metadata] can be `null` if the parameter does not have the
/// corresponding attribute. The [keyword] can be `null` if a type was
diff --git a/pkg/analyzer/lib/dart/ast/visitor.dart b/pkg/analyzer/lib/dart/ast/visitor.dart
index a10cb66d..5129ab3 100644
--- a/pkg/analyzer/lib/dart/ast/visitor.dart
+++ b/pkg/analyzer/lib/dart/ast/visitor.dart
@@ -366,6 +366,9 @@
R? visitGenericTypeAlias(GenericTypeAlias node) => visitTypeAlias(node);
@override
+ R? visitHideClause(HideClause node) => visitNode(node);
+
+ @override
R? visitHideCombinator(HideCombinator node) => visitCombinator(node);
R? visitIdentifier(Identifier node) => visitExpression(node);
@@ -510,9 +513,15 @@
R? visitSetOrMapLiteral(SetOrMapLiteral node) => visitTypedLiteral(node);
@override
+ R? visitShowClause(ShowClause node) => visitNode(node);
+
+ @override
R? visitShowCombinator(ShowCombinator node) => visitCombinator(node);
@override
+ R? visitShowHideElement(ShowHideElement node) => visitNode(node);
+
+ @override
R? visitSimpleFormalParameter(SimpleFormalParameter node) =>
visitNormalFormalParameter(node);
@@ -991,6 +1000,12 @@
}
@override
+ R? visitHideClause(HideClause node) {
+ node.visitChildren(this);
+ return null;
+ }
+
+ @override
R? visitHideCombinator(HideCombinator node) {
node.visitChildren(this);
return null;
@@ -1214,12 +1229,24 @@
}
@override
+ R? visitShowClause(ShowClause node) {
+ node.visitChildren(this);
+ return null;
+ }
+
+ @override
R? visitShowCombinator(ShowCombinator node) {
node.visitChildren(this);
return null;
}
@override
+ R? visitShowHideElement(ShowHideElement node) {
+ node.visitChildren(this);
+ return null;
+ }
+
+ @override
R? visitSimpleFormalParameter(SimpleFormalParameter node) {
node.visitChildren(this);
return null;
@@ -1570,6 +1597,9 @@
R? visitGenericTypeAlias(GenericTypeAlias node) => null;
@override
+ R? visitHideClause(HideClause node) => null;
+
+ @override
R? visitHideCombinator(HideCombinator node) => null;
@override
@@ -1683,9 +1713,15 @@
R? visitSetOrMapLiteral(SetOrMapLiteral node) => null;
@override
+ R? visitShowClause(ShowClause node) => null;
+
+ @override
R? visitShowCombinator(ShowCombinator node) => null;
@override
+ R? visitShowHideElement(ShowHideElement node) => null;
+
+ @override
R? visitSimpleFormalParameter(SimpleFormalParameter node) => null;
@override
@@ -1964,6 +2000,9 @@
R? visitGenericTypeAlias(GenericTypeAlias node) => _throw(node);
@override
+ R? visitHideClause(HideClause node) => _throw(node);
+
+ @override
R? visitHideCombinator(HideCombinator node) => _throw(node);
@override
@@ -2078,9 +2117,15 @@
R? visitSetOrMapLiteral(SetOrMapLiteral node) => _throw(node);
@override
+ R? visitShowClause(ShowClause node) => _throw(node);
+
+ @override
R? visitShowCombinator(ShowCombinator node) => _throw(node);
@override
+ R? visitShowHideElement(ShowHideElement node) => _throw(node);
+
+ @override
R? visitSimpleFormalParameter(SimpleFormalParameter node) => _throw(node);
@override
@@ -2662,6 +2707,14 @@
}
@override
+ T? visitHideClause(HideClause node) {
+ stopwatch.start();
+ T? result = _baseVisitor.visitHideClause(node);
+ stopwatch.stop();
+ return result;
+ }
+
+ @override
T? visitHideCombinator(HideCombinator node) {
stopwatch.start();
T? result = _baseVisitor.visitHideCombinator(node);
@@ -2959,6 +3012,14 @@
}
@override
+ T? visitShowClause(ShowClause node) {
+ stopwatch.start();
+ T? result = _baseVisitor.visitShowClause(node);
+ stopwatch.stop();
+ return result;
+ }
+
+ @override
T? visitShowCombinator(ShowCombinator node) {
stopwatch.start();
T? result = _baseVisitor.visitShowCombinator(node);
@@ -2967,6 +3028,14 @@
}
@override
+ T? visitShowHideElement(ShowHideElement node) {
+ stopwatch.start();
+ T? result = _baseVisitor.visitShowHideElement(node);
+ stopwatch.stop();
+ return result;
+ }
+
+ @override
T? visitSimpleFormalParameter(SimpleFormalParameter node) {
stopwatch.start();
T? result = _baseVisitor.visitSimpleFormalParameter(node);
@@ -3383,6 +3452,9 @@
R? visitGenericTypeAlias(GenericTypeAlias node) => visitNode(node);
@override
+ R? visitHideClause(HideClause node) => visitNode(node);
+
+ @override
R? visitHideCombinator(HideCombinator node) => visitNode(node);
@override
@@ -3504,9 +3576,15 @@
R? visitSetOrMapLiteral(SetOrMapLiteral node) => visitNode(node);
@override
+ R? visitShowClause(ShowClause node) => visitNode(node);
+
+ @override
R? visitShowCombinator(ShowCombinator node) => visitNode(node);
@override
+ R? visitShowHideElement(ShowHideElement node) => visitNode(node);
+
+ @override
R? visitSimpleFormalParameter(SimpleFormalParameter node) => visitNode(node);
@override
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index af436f5..a62d6d3 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -3679,10 +3679,18 @@
@override
Token? typeKeyword;
+ /// The hide clause for the extension or `null` if the declaration does not
+ /// hide any elements.
+ HideClauseImpl? _hideClause;
+
/// The name of the extension, or `null` if the extension does not have a
/// name.
SimpleIdentifierImpl? _name;
+ /// The show clause for the extension or `null` if the declaration does not
+ /// show any elements.
+ ShowClauseImpl? _showClause;
+
/// The type parameters for the extension, or `null` if the extension does not
/// have any type parameters.
TypeParameterListImpl? _typeParameters;
@@ -3713,6 +3721,8 @@
this._typeParameters,
this.onKeyword,
this._extendedType,
+ this._showClause,
+ this._hideClause,
this.leftBracket,
List<ClassMember> members,
this.rightBracket)
@@ -3756,6 +3766,13 @@
Token get firstTokenAfterCommentAndMetadata => extensionKeyword;
@override
+ HideClauseImpl? get hideClause => _hideClause;
+
+ set hideClause(HideClause? hideClause) {
+ _hideClause = _becomeParentOf(hideClause as HideClauseImpl?);
+ }
+
+ @override
NodeListImpl<ClassMember> get members => _members;
@override
@@ -3766,6 +3783,13 @@
}
@override
+ ShowClauseImpl? get showClause => _showClause;
+
+ set showClause(ShowClause? showClause) {
+ _showClause = _becomeParentOf(showClause as ShowClauseImpl?);
+ }
+
+ @override
TypeParameterListImpl? get typeParameters => _typeParameters;
set typeParameters(TypeParameterList? typeParameters) {
@@ -5457,6 +5481,46 @@
}
}
+/// The "hide" clause in an extension declaration.
+///
+/// hideClause ::=
+/// 'hide' [TypeName] (',' [TypeName])*
+class HideClauseImpl extends AstNodeImpl implements HideClause {
+ /// The token representing the 'hide' keyword.
+ @override
+ Token hideKeyword;
+
+ /// The elements that are being shown.
+ final NodeListImpl<ShowHideClauseElement> _elements = NodeListImpl._();
+
+ /// Initialize a newly created show clause.
+ HideClauseImpl(this.hideKeyword, List<ShowHideClauseElement> elements) {
+ _elements._initialize(this, elements);
+ }
+
+ @override
+ Token get beginToken => hideKeyword;
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => ChildEntities()
+ ..add(hideKeyword)
+ ..addAll(elements);
+
+ @override
+ NodeListImpl<ShowHideClauseElement> get elements => _elements;
+
+ @override
+ Token get endToken => _elements.endToken!;
+
+ @override
+ E? accept<E>(AstVisitor<E> visitor) => visitor.visitHideClause(this);
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _elements.accept(visitor);
+ }
+}
+
/// A combinator that restricts the names being imported to those that are not
/// in a given list.
///
@@ -8620,6 +8684,46 @@
}
}
+/// The "show" clause in an extension declaration.
+///
+/// showClause ::=
+/// 'show' [TypeName] (',' [TypeName])*
+class ShowClauseImpl extends AstNodeImpl implements ShowClause {
+ /// The token representing the 'show' keyword.
+ @override
+ Token showKeyword;
+
+ /// The elements that are being shown.
+ final NodeListImpl<ShowHideClauseElement> _elements = NodeListImpl._();
+
+ /// Initialize a newly created show clause.
+ ShowClauseImpl(this.showKeyword, List<ShowHideClauseElement> elements) {
+ _elements._initialize(this, elements);
+ }
+
+ @override
+ Token get beginToken => showKeyword;
+
+ @override
+ Iterable<SyntacticEntity> get childEntities => ChildEntities()
+ ..add(showKeyword)
+ ..addAll(elements);
+
+ @override
+ NodeListImpl<ShowHideClauseElement> get elements => _elements;
+
+ @override
+ Token get endToken => _elements.endToken!;
+
+ @override
+ E? accept<E>(AstVisitor<E> visitor) => visitor.visitShowClause(this);
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ _elements.accept(visitor);
+ }
+}
+
/// A combinator that restricts the names being imported to those in a given
/// list.
///
@@ -8657,6 +8761,45 @@
}
}
+/// A potentially non-type element of a show or a hide clause.
+///
+/// showHideElement ::=
+/// 'get' [SimpleIdentifier] |
+/// 'set' [SimpleIdentifier] |
+/// 'operator' [SimpleIdentifier] |
+/// [SimpleIdentifier]
+///
+/// Clients may not extend, implement or mix-in this class.
+class ShowHideElementImpl extends AstNodeImpl implements ShowHideElement {
+ @override
+ Token? modifier;
+
+ @override
+ SimpleIdentifier name;
+
+ ShowHideElementImpl(this.modifier, this.name) {
+ _becomeParentOf<SimpleIdentifierImpl>(name as SimpleIdentifierImpl);
+ }
+
+ @override
+ Token get beginToken => modifier ?? name.beginToken;
+
+ @override
+ Iterable<SyntacticEntity> get childEntities =>
+ ChildEntities()..addAll([if (modifier != null) modifier!, name]);
+
+ @override
+ Token get endToken => name.endToken;
+
+ @override
+ E? accept<E>(AstVisitor<E> visitor) => visitor.visitShowHideElement(this);
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ name.accept(visitor);
+ }
+}
+
/// A simple formal parameter.
///
/// simpleFormalParameter ::=
diff --git a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
index bc7287e..0b36161 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
@@ -446,6 +446,8 @@
TypeParameterList? typeParameters,
required Token onKeyword,
required TypeAnnotation extendedType,
+ ShowClause? showClause,
+ HideClause? hideClause,
required Token leftBracket,
required List<ClassMember> members,
required Token rightBracket}) =>
@@ -458,6 +460,8 @@
typeParameters as TypeParameterListImpl?,
onKeyword,
extendedType as TypeAnnotationImpl,
+ showClause as ShowClauseImpl?,
+ hideClause as HideClauseImpl?,
leftBracket,
members,
rightBracket);
@@ -730,6 +734,12 @@
semicolon);
@override
+ HideClauseImpl hideClause(
+ {required Token hideKeyword,
+ required List<ShowHideClauseElement> elements}) =>
+ HideClauseImpl(hideKeyword, elements);
+
+ @override
HideCombinatorImpl hideCombinator(
Token keyword, List<SimpleIdentifier> hiddenNames) =>
HideCombinatorImpl(keyword, hiddenNames);
@@ -1077,11 +1087,22 @@
leftBracket, elements, rightBracket);
@override
+ ShowClauseImpl showClause(
+ {required Token showKeyword,
+ required List<ShowHideClauseElement> elements}) =>
+ ShowClauseImpl(showKeyword, elements);
+
+ @override
ShowCombinatorImpl showCombinator(
Token keyword, List<SimpleIdentifier> shownNames) =>
ShowCombinatorImpl(keyword, shownNames);
@override
+ ShowHideElementImpl showHideElement(
+ {required Token? modifier, required SimpleIdentifier name}) =>
+ ShowHideElementImpl(modifier, name);
+
+ @override
SimpleFormalParameterImpl simpleFormalParameter2(
{Comment? comment,
List<Annotation>? metadata,
diff --git a/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart b/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
index b5929ae..1731023 100644
--- a/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
@@ -368,6 +368,8 @@
_visitToken(node.onKeyword);
sink.write(' ');
_visitNode(node.extendedType, suffix: ' ');
+ _visitNode(node.showClause, suffix: ' ');
+ _visitNode(node.hideClause, suffix: ' ');
_visitToken(node.leftBracket);
_visitNodeList(node.members, separator: ' ');
_visitToken(node.rightBracket);
@@ -565,6 +567,12 @@
}
@override
+ void visitHideClause(HideClause node) {
+ sink.write('hide ');
+ _visitNodeList(node.elements, separator: ', ');
+ }
+
+ @override
void visitHideCombinator(HideCombinator node) {
sink.write('hide ');
_visitNodeList(node.hiddenNames, separator: ', ');
@@ -870,12 +878,24 @@
}
@override
+ void visitShowClause(ShowClause node) {
+ sink.write('show ');
+ _visitNodeList(node.elements, separator: ', ');
+ }
+
+ @override
void visitShowCombinator(ShowCombinator node) {
sink.write('show ');
_visitNodeList(node.shownNames, separator: ', ');
}
@override
+ void visitShowHideElement(ShowHideElement node) {
+ _visitToken(node.modifier, suffix: ' ');
+ _visitNode(node.name);
+ }
+
+ @override
void visitSimpleFormalParameter(SimpleFormalParameter node) {
_visitNodeList(node.metadata, separator: ' ', suffix: ' ');
_visitToken(node.requiredKeyword, suffix: ' ');
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index a40e33a..e066a65 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -677,6 +677,13 @@
}
@override
+ bool visitHideClause(HideClause node) {
+ HideClause other = _other as HideClause;
+ return isEqualTokens(node.hideKeyword, other.hideKeyword) &&
+ _isEqualNodeLists(node.elements, other.elements);
+ }
+
+ @override
bool visitHideCombinator(HideCombinator node) {
HideCombinator other = _other as HideCombinator;
return isEqualTokens(node.keyword, other.keyword) &&
@@ -1007,6 +1014,13 @@
}
@override
+ bool visitShowClause(ShowClause node) {
+ ShowClause other = _other as ShowClause;
+ return isEqualTokens(node.showKeyword, other.showKeyword) &&
+ _isEqualNodeLists(node.elements, other.elements);
+ }
+
+ @override
bool visitShowCombinator(ShowCombinator node) {
ShowCombinator other = _other as ShowCombinator;
return isEqualTokens(node.keyword, other.keyword) &&
@@ -1014,6 +1028,13 @@
}
@override
+ bool visitShowHideElement(ShowHideElement node) {
+ ShowHideElement other = _other as ShowHideElement;
+ return isEqualTokens(node.modifier, other.modifier) &&
+ isEqualNodes(node.name, other.name);
+ }
+
+ @override
bool visitSimpleFormalParameter(SimpleFormalParameter node) {
SimpleFormalParameter other = _other as SimpleFormalParameter;
return isEqualNodes(
@@ -2257,6 +2278,14 @@
}
@override
+ bool visitHideClause(covariant HideClauseImpl node) {
+ if (_replaceInList(node.elements)) {
+ return true;
+ }
+ return visitNode(node);
+ }
+
+ @override
bool visitHideCombinator(covariant HideCombinatorImpl node) {
if (_replaceInList(node.hiddenNames)) {
return true;
@@ -2646,6 +2675,14 @@
}
@override
+ bool visitShowClause(covariant ShowClauseImpl node) {
+ if (_replaceInList(node.elements)) {
+ return true;
+ }
+ return visitNode(node);
+ }
+
+ @override
bool visitShowCombinator(covariant ShowCombinatorImpl node) {
if (_replaceInList(node.shownNames)) {
return true;
@@ -2654,6 +2691,15 @@
}
@override
+ bool visitShowHideElement(covariant ShowHideElementImpl node) {
+ if (identical(node.name, _oldNode)) {
+ node.name = _newNode as SimpleIdentifier;
+ return true;
+ }
+ return visitNode(node);
+ }
+
+ @override
bool visitSimpleFormalParameter(covariant SimpleFormalParameterImpl node) {
if (identical(node.type, _oldNode)) {
node.type = _newNode as TypeAnnotation;
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 9968a05..75bd8ed 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -258,6 +258,8 @@
_tmpSimpleIdentifier(),
null,
), // extendedType is set in [endExtensionDeclaration]
+ showClause: null,
+ hideClause: null,
leftBracket: Tokens.openCurlyBracket(),
rightBracket: Tokens.closeCurlyBracket(),
members: [],
@@ -1192,7 +1194,7 @@
@override
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
- Token onKeyword, Token token) {
+ Token onKeyword, Token? showKeyword, Token? hideKeyword, Token token) {
if (typeKeyword != null && !enableExtensionTypes) {
var feature = ExperimentalFeatures.extension_types;
handleRecoverableError(
@@ -1203,11 +1205,29 @@
typeKeyword,
typeKeyword);
}
+
+ if ((showKeyword != null || hideKeyword != null) && !enableExtensionTypes) {
+ var feature = ExperimentalFeatures.extension_types;
+ handleRecoverableError(
+ templateExperimentNotEnabled.withArguments(
+ feature.enableString,
+ _versionAsString(ExperimentStatus.currentVersion),
+ ),
+ (showKeyword ?? hideKeyword)!,
+ (showKeyword ?? hideKeyword)!);
+ }
+
+ ShowClause? showClause = pop(NullValue.ShowClause) as ShowClause?;
+ HideClause? hideClause = pop(NullValue.HideClause) as HideClause?;
+
var type = pop() as TypeAnnotation;
+
extensionDeclaration!
..extendedType = type
..onKeyword = onKeyword
- ..typeKeyword = typeKeyword;
+ ..typeKeyword = typeKeyword
+ ..showClause = showClause
+ ..hideClause = hideClause;
extensionDeclaration = null;
}
@@ -2706,6 +2726,29 @@
}
@override
+ void handleExtensionShowHide(Token? showKeyword, int showElementCount,
+ Token? hideKeyword, int hideElementCount) {
+ assert(optionalOrNull('hide', hideKeyword));
+ assert(optionalOrNull('show', showKeyword));
+ debugEvent("ExtensionShowHide");
+
+ HideClause? hideClause;
+ if (hideKeyword != null) {
+ var elements = popTypedList2<ShowHideClauseElement>(hideElementCount);
+ hideClause = ast.hideClause(hideKeyword: hideKeyword, elements: elements);
+ }
+
+ ShowClause? showClause;
+ if (showKeyword != null) {
+ var elements = popTypedList2<ShowHideClauseElement>(showElementCount);
+ showClause = ast.showClause(showKeyword: showKeyword, elements: elements);
+ }
+
+ push(hideClause ?? NullValue.HideClause);
+ push(showClause ?? NullValue.ShowClause);
+ }
+
+ @override
void handleFinallyBlock(Token finallyKeyword) {
debugEvent("FinallyBlock");
// The finally block is popped in "endTryStatement".
@@ -3479,6 +3522,22 @@
}
@override
+ void handleShowHideIdentifier(Token? modifier, Token identifier) {
+ debugEvent("handleShowHideIdentifier");
+
+ assert(modifier == null ||
+ modifier.stringValue! == "get" ||
+ modifier.stringValue! == "set" ||
+ modifier.stringValue! == "operator");
+
+ SimpleIdentifier name = ast.simpleIdentifier(identifier);
+ ShowHideElement element =
+ ast.showHideElement(modifier: modifier, name: name);
+
+ push(element);
+ }
+
+ @override
void handleSpreadExpression(Token spreadToken) {
var expression = pop() as Expression;
if (enableSpreadCollections) {
diff --git a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
index 71aab4d..ed3e329 100644
--- a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
@@ -519,6 +519,8 @@
required bool isExtensionTypeDeclaration,
TypeParameterList? typeParameters,
required TypeAnnotation extendedType,
+ ShowClause? showClause,
+ HideClause? hideClause,
List<ClassMember> members = const []}) =>
astFactory.extensionDeclaration(
comment: null,
@@ -531,6 +533,8 @@
typeParameters: typeParameters,
onKeyword: TokenFactory.tokenFromKeyword(Keyword.ON),
extendedType: extendedType,
+ showClause: showClause,
+ hideClause: hideClause,
leftBracket: TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET),
members: members,
rightBracket:
@@ -720,6 +724,11 @@
functionType,
TokenFactory.tokenFromType(TokenType.SEMICOLON));
+ static HideClauseImpl hideClause(List<ShowHideClauseElement> elements) =>
+ astFactory.hideClause(
+ hideKeyword: TokenFactory.tokenFromString("hide"),
+ elements: elements);
+
static HideCombinatorImpl hideCombinator(
List<SimpleIdentifier> identifiers) =>
astFactory.hideCombinator(
@@ -1205,6 +1214,11 @@
rightBracket: TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET),
);
+ static ShowClauseImpl showClause(List<ShowHideClauseElement> elements) =>
+ astFactory.showClause(
+ showKeyword: TokenFactory.tokenFromString("show"),
+ elements: elements);
+
static ShowCombinatorImpl showCombinator(
List<SimpleIdentifier> identifiers) =>
astFactory.showCombinator(
@@ -1214,6 +1228,24 @@
astFactory.showCombinator(
TokenFactory.tokenFromString("show"), identifierList(identifiers));
+ static ShowHideElementImpl showHideElement(String name) =>
+ astFactory.showHideElement(modifier: null, name: identifier3(name));
+
+ static ShowHideElementImpl showHideElementGetter(String name) =>
+ astFactory.showHideElement(
+ modifier: TokenFactory.tokenFromString("get"),
+ name: identifier3(name));
+
+ static ShowHideElementImpl showHideElementOperator(String name) =>
+ astFactory.showHideElement(
+ modifier: TokenFactory.tokenFromString("operator"),
+ name: identifier3(name));
+
+ static ShowHideElementImpl showHideElementSetter(String name) =>
+ astFactory.showHideElement(
+ modifier: TokenFactory.tokenFromString("set"),
+ name: identifier3(name));
+
static SimpleFormalParameterImpl simpleFormalParameter(
Keyword keyword, String parameterName) =>
simpleFormalParameter2(keyword, null, parameterName);
diff --git a/pkg/analyzer/lib/src/summary2/ast_text_printer.dart b/pkg/analyzer/lib/src/summary2/ast_text_printer.dart
index 52f9b94e..4269b08 100644
--- a/pkg/analyzer/lib/src/summary2/ast_text_printer.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_text_printer.dart
@@ -342,6 +342,8 @@
node.typeParameters?.accept(this);
_token(node.onKeyword);
node.extendedType.accept(this);
+ node.showClause?.accept(this);
+ node.hideClause?.accept(this);
_token(node.leftBracket);
node.members.accept(this);
_token(node.rightBracket);
diff --git a/pkg/analyzer/test/generated/parser_fasta_listener.dart b/pkg/analyzer/test/generated/parser_fasta_listener.dart
index 48ea92e..5d366e2 100644
--- a/pkg/analyzer/test/generated/parser_fasta_listener.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_listener.dart
@@ -750,9 +750,9 @@
@override
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
- Token onKeyword, Token token) {
- super.endExtensionDeclaration(
- extensionKeyword, typeKeyword, onKeyword, token);
+ Token onKeyword, Token? showKeyword, Token? hideKeyword, Token token) {
+ super.endExtensionDeclaration(extensionKeyword, typeKeyword, onKeyword,
+ showKeyword, hideKeyword, token);
end('ExtensionDeclaration');
}
diff --git a/pkg/analyzer/test/src/dart/ast/to_source_visitor_test.dart b/pkg/analyzer/test/src/dart/ast/to_source_visitor_test.dart
index 88e81b9..b14053b 100644
--- a/pkg/analyzer/test/src/dart/ast/to_source_visitor_test.dart
+++ b/pkg/analyzer/test/src/dart/ast/to_source_visitor_test.dart
@@ -895,6 +895,201 @@
isExtensionTypeDeclaration: false));
}
+ void test_visitExtensionDeclarationHideClause_empty() {
+ _assertSource(
+ 'extension type E on C hide B {}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ hideClause:
+ AstTestFactory.hideClause([AstTestFactory.typeName4("B")]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationHideClause_multipleMember() {
+ _assertSource(
+ 'extension type E on C hide B {var a; var b;}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ members: [
+ AstTestFactory.fieldDeclaration2(false, Keyword.VAR,
+ [AstTestFactory.variableDeclaration('a')]),
+ AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration('b')])
+ ],
+ hideClause:
+ AstTestFactory.hideClause([AstTestFactory.typeName4("B")]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationHideClause_parameters() {
+ _assertSource(
+ 'extension type E<T> on C hide B {}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ typeParameters: AstTestFactory.typeParameterList(['T']),
+ extendedType: AstTestFactory.typeName4('C'),
+ hideClause:
+ AstTestFactory.hideClause([AstTestFactory.typeName4("B")]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationHideClause_singleMember() {
+ _assertSource(
+ 'extension type E on C hide B {var a;}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ members: [
+ AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration('a')])
+ ],
+ hideClause:
+ AstTestFactory.hideClause([AstTestFactory.typeName4("B")]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationShowClause_ambiguousElement() {
+ _assertSource(
+ 'extension type E on C show foo {}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ showClause: AstTestFactory.showClause(
+ [AstTestFactory.showHideElement("foo")]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationShowClause_empty() {
+ _assertSource(
+ 'extension type E on C show B {}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ showClause:
+ AstTestFactory.showClause([AstTestFactory.typeName4("B")]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationShowClause_getterElement() {
+ _assertSource(
+ 'extension type E on C show get foo {}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ showClause: AstTestFactory.showClause(
+ [AstTestFactory.showHideElementGetter("foo")]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationShowClause_multipleMember() {
+ _assertSource(
+ 'extension type E on C show B {var a; var b;}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ members: [
+ AstTestFactory.fieldDeclaration2(false, Keyword.VAR,
+ [AstTestFactory.variableDeclaration('a')]),
+ AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration('b')])
+ ],
+ showClause:
+ AstTestFactory.showClause([AstTestFactory.typeName4("B")]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationShowClause_operatorElement() {
+ _assertSource(
+ 'extension type E on C show operator * {}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ showClause: AstTestFactory.showClause(
+ [AstTestFactory.showHideElementOperator("*")]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationShowClause_parameters() {
+ _assertSource(
+ 'extension type E<T> on C show B {}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ typeParameters: AstTestFactory.typeParameterList(['T']),
+ extendedType: AstTestFactory.typeName4('C'),
+ showClause:
+ AstTestFactory.showClause([AstTestFactory.typeName4("B")]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationShowClause_qualifiedTypeElement() {
+ _assertSource(
+ 'extension type E on C show prefix.B {}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ showClause: AstTestFactory.showClause([
+ AstTestFactory.typeName3(
+ AstTestFactory.identifier5('prefix', 'B'))
+ ]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationShowClause_setterElement() {
+ _assertSource(
+ 'extension type E on C show set foo {}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ showClause: AstTestFactory.showClause(
+ [AstTestFactory.showHideElementSetter("foo")]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationShowClause_singleMember() {
+ _assertSource(
+ 'extension type E on C show B {var a;}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ members: [
+ AstTestFactory.fieldDeclaration2(
+ false, Keyword.VAR, [AstTestFactory.variableDeclaration('a')])
+ ],
+ showClause:
+ AstTestFactory.showClause([AstTestFactory.typeName4("B")]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationShowClause_typeWithArgumentsElement() {
+ _assertSource(
+ 'extension type E on C show B<int, String> {}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ showClause: AstTestFactory.showClause([
+ AstTestFactory.typeName3(AstTestFactory.identifier3('B'), [
+ AstTestFactory.typeName4('int'),
+ AstTestFactory.typeName4('String')
+ ])
+ ]),
+ isExtensionTypeDeclaration: true));
+ }
+
+ void test_visitExtensionDeclarationShowHideClause_empty() {
+ _assertSource(
+ 'extension type E on C show B hide foo {}',
+ AstTestFactory.extensionDeclaration(
+ name: 'E',
+ extendedType: AstTestFactory.typeName4('C'),
+ showClause:
+ AstTestFactory.showClause([AstTestFactory.typeName4("B")]),
+ hideClause: AstTestFactory.hideClause(
+ [AstTestFactory.showHideElement("foo")]),
+ isExtensionTypeDeclaration: true));
+ }
+
void test_visitExtensionOverride_prefixedName_noTypeArgs() {
_assertSource(
'p.E(o)',
diff --git a/pkg/dds/lib/src/dap/adapters/dart.dart b/pkg/dds/lib/src/dap/adapters/dart.dart
index 5099eef..1343db2 100644
--- a/pkg/dds/lib/src/dap/adapters/dart.dart
+++ b/pkg/dds/lib/src/dap/adapters/dart.dart
@@ -1654,10 +1654,18 @@
/// enabling debugging.
final bool? noDebug;
+ /// The program/Dart script to be run.
final String program;
+
+ /// Arguments to be passed to [program].
final List<String>? args;
+
+ /// Arguments to be passed to the tool that will run [program] (for example,
+ /// the VM or Flutter tool).
+ final List<String>? toolArgs;
+
final int? vmServicePort;
- final List<String>? vmAdditionalArgs;
+
final bool? enableAsserts;
/// Which console to run the program in.
@@ -1678,7 +1686,7 @@
required this.program,
this.args,
this.vmServicePort,
- this.vmAdditionalArgs,
+ this.toolArgs,
this.console,
this.enableAsserts,
String? name,
@@ -1705,7 +1713,7 @@
noDebug = obj['noDebug'] as bool?,
program = obj['program'] as String,
args = (obj['args'] as List?)?.cast<String>(),
- vmAdditionalArgs = (obj['vmAdditionalArgs'] as List?)?.cast<String>(),
+ toolArgs = (obj['toolArgs'] as List?)?.cast<String>(),
vmServicePort = obj['vmServicePort'] as int?,
console = obj['console'] as String?,
enableAsserts = obj['enableAsserts'] as bool?,
@@ -1718,7 +1726,7 @@
if (noDebug != null) 'noDebug': noDebug,
'program': program,
if (args != null) 'args': args,
- if (vmAdditionalArgs != null) 'vmAdditionalArgs': vmAdditionalArgs,
+ if (toolArgs != null) 'toolArgs': toolArgs,
if (vmServicePort != null) 'vmServicePort': vmServicePort,
if (console != null) 'console': console,
if (enableAsserts != null) 'enableAsserts': enableAsserts,
diff --git a/pkg/dds/lib/src/dap/adapters/dart_cli.dart b/pkg/dds/lib/src/dap/adapters/dart_cli.dart
index bf0eab9..2a3f351 100644
--- a/pkg/dds/lib/src/dap/adapters/dart_cli.dart
+++ b/pkg/dds/lib/src/dap/adapters/dart_cli.dart
@@ -10,25 +10,18 @@
import 'package:pedantic/pedantic.dart';
import 'package:vm_service/vm_service.dart' as vm;
-import '../exceptions.dart';
import '../logging.dart';
import '../protocol_generated.dart';
import '../protocol_stream.dart';
import 'dart.dart';
+import 'mixins.dart';
/// A DAP Debug Adapter for running and debugging Dart CLI scripts.
class DartCliDebugAdapter extends DartDebugAdapter<DartLaunchRequestArguments,
- DartAttachRequestArguments> {
+ DartAttachRequestArguments>
+ with PidTracker, VmServiceInfoFileUtils, PackageConfigUtils {
Process? _process;
- /// Process IDs to terminate during shutdown.
- ///
- /// This may be populated with pids from the VM Service to ensure we clean up
- /// properly where signals may not be passed through the shell to the
- /// underlying VM process.
- /// https://github.com/Dart-Code/Dart-Code/issues/907
- final pidsToTerminate = <int>{};
-
@override
final parseLaunchArgs = DartLaunchRequestArguments.fromJson;
@@ -75,45 +68,7 @@
/// Called by [disconnectRequest] to request that we forcefully shut down the
/// app being run (or in the case of an attach, disconnect).
Future<void> disconnectImpl() async {
- // TODO(dantup): In Dart-Code DAP, we first try again with sigint and wait
- // for a few seconds before sending sigkill.
- pidsToTerminate.forEach(
- (pid) => Process.killPid(pid, ProcessSignal.sigkill),
- );
- }
-
- /// Waits for [vmServiceInfoFile] to exist and become valid before returning
- /// the VM Service URI contained within.
- Future<Uri> waitForVmServiceInfoFile(File vmServiceInfoFile) async {
- final completer = Completer<Uri>();
- late final StreamSubscription<FileSystemEvent> vmServiceInfoFileWatcher;
-
- Uri? tryParseServiceInfoFile(FileSystemEvent event) {
- final uri = _readVmServiceInfoFile(vmServiceInfoFile);
- if (uri != null && !completer.isCompleted) {
- vmServiceInfoFileWatcher.cancel();
- completer.complete(uri);
- }
- }
-
- vmServiceInfoFileWatcher = vmServiceInfoFile.parent
- .watch(events: FileSystemEvent.all)
- .where((event) => event.path == vmServiceInfoFile.path)
- .listen(
- tryParseServiceInfoFile,
- onError: (e) => logger?.call('Ignoring exception from watcher: $e'),
- );
-
- // After setting up the watcher, also check if the file already exists to
- // ensure we don't miss it if it was created right before we set the
- // watched up.
- final uri = _readVmServiceInfoFile(vmServiceInfoFile);
- if (uri != null && !completer.isCompleted) {
- unawaited(vmServiceInfoFileWatcher.cancel());
- completer.complete(uri);
- }
-
- return completer.future;
+ terminatePids(ProcessSignal.sigkill);
}
/// Called by [launchRequest] to request that we actually start the app to be
@@ -128,25 +83,15 @@
final debug = !(args.noDebug ?? false);
if (debug) {
- // Create a temp folder for the VM to write the service-info-file into.
- // Using tmpDir.createTempory() is flakey on Windows+Linux (at least
- // on GitHub Actions) complaining the file does not exist when creating a
- // watcher. Creating/watching a folder and writing the file into it seems
- // to be reliable.
- final serviceInfoFilePath = path.join(
- Directory.systemTemp.createTempSync('dart-vm-service').path,
- 'vm.json',
- );
-
- vmServiceInfoFile = File(serviceInfoFilePath);
- unawaited(waitForVmServiceInfoFile(vmServiceInfoFile)
+ vmServiceInfoFile = generateVmServiceInfoFile();
+ unawaited(waitForVmServiceInfoFile(logger, vmServiceInfoFile)
.then((uri) => connectDebugger(uri, resumeIfStarting: true)));
}
final vmArgs = <String>[
if (debug) ...[
'--enable-vm-service=${args.vmServicePort ?? 0}${ipv6 ? '/::1' : ''}',
- '--pause_isolates_on_start=true',
+ '--pause_isolates_on_start',
if (!enableAuthCodes) '--disable-service-auth-codes'
],
'--disable-dart-dev',
@@ -156,10 +101,11 @@
],
// Default to asserts on, this seems like the most useful behaviour for
// editor-spawned debug sessions.
- if (args.enableAsserts ?? true) '--enable-asserts'
+ if (args.enableAsserts ?? true) '--enable-asserts',
];
final processArgs = [
...vmArgs,
+ ...?args.toolArgs,
args.program,
...?args.args,
];
@@ -171,7 +117,7 @@
var possibleRoot = path.isAbsolute(args.program)
? path.dirname(args.program)
: path.dirname(path.normalize(path.join(args.cwd ?? '', args.program)));
- final packageConfig = _findPackageConfigFile(possibleRoot);
+ final packageConfig = findPackageConfigFile(possibleRoot);
if (packageConfig != null) {
this.usePackageConfigFile(packageConfig);
}
@@ -209,9 +155,12 @@
final vmServiceInfoFile = args.vmServiceInfoFile;
if ((vmServiceUri == null) == (vmServiceInfoFile == null)) {
- throw DebugAdapterException(
- 'To attach, provide exactly one of vmServiceUri/vmServiceInfoFile',
+ sendOutput(
+ 'console',
+ '\nTo attach, provide exactly one of vmServiceUri/vmServiceInfoFile',
);
+ handleSessionTerminate();
+ return;
}
// Find the package_config file for this script.
@@ -220,7 +169,7 @@
// necessary.
final cwd = args.cwd;
if (cwd != null) {
- final packageConfig = _findPackageConfigFile(cwd);
+ final packageConfig = findPackageConfigFile(cwd);
if (packageConfig != null) {
this.usePackageConfigFile(packageConfig);
}
@@ -228,7 +177,7 @@
final uri = vmServiceUri != null
? Uri.parse(vmServiceUri)
- : await waitForVmServiceInfoFile(File(vmServiceInfoFile!));
+ : await waitForVmServiceInfoFile(logger, File(vmServiceInfoFile!));
unawaited(connectDebugger(uri, resumeIfStarting: false));
}
@@ -297,42 +246,10 @@
unawaited(process.exitCode.then(_handleExitCode));
}
- /// Find the `package_config.json` file for the program being launched.
- ///
- /// TODO(dantup): Remove this once
- /// https://github.com/dart-lang/sdk/issues/45530 is done as it will not be
- /// necessary.
- File? _findPackageConfigFile(String possibleRoot) {
- File? packageConfig;
- while (true) {
- packageConfig =
- File(path.join(possibleRoot, '.dart_tool', 'package_config.json'));
-
- // If this packageconfig exists, use it.
- if (packageConfig.existsSync()) {
- break;
- }
-
- final parent = path.dirname(possibleRoot);
-
- // If we can't go up anymore, the search failed.
- if (parent == possibleRoot) {
- packageConfig = null;
- break;
- }
-
- possibleRoot = parent;
- }
-
- return packageConfig;
- }
-
/// Called by [terminateRequest] to request that we gracefully shut down the
/// app being run (or in the case of an attach, disconnect).
Future<void> terminateImpl() async {
- pidsToTerminate.forEach(
- (pid) => Process.killPid(pid, ProcessSignal.sigint),
- );
+ terminatePids(ProcessSignal.sigint);
await _process?.exitCode;
}
@@ -349,19 +266,4 @@
void _handleStdout(List<int> data) {
sendOutput('stdout', utf8.decode(data));
}
-
- /// Attempts to read VM Service info from a watcher event.
- ///
- /// If successful, returns the URI. Otherwise, returns null.
- Uri? _readVmServiceInfoFile(File file) {
- try {
- final content = file.readAsStringSync();
- final json = jsonDecode(content);
- return Uri.parse(json['uri']);
- } catch (e) {
- // It's possible we tried to read the file before it was completely
- // written so ignore and try again on the next event.
- logger?.call('Ignoring error parsing vm-service-info file: $e');
- }
- }
}
diff --git a/pkg/dds/lib/src/dap/adapters/mixins.dart b/pkg/dds/lib/src/dap/adapters/mixins.dart
new file mode 100644
index 0000000..8c73716
--- /dev/null
+++ b/pkg/dds/lib/src/dap/adapters/mixins.dart
@@ -0,0 +1,139 @@
+// Copyright (c) 2021, 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:convert';
+import 'dart:io';
+
+import 'package:path/path.dart' as path;
+import 'package:pedantic/pedantic.dart';
+
+import '../logging.dart';
+
+/// A mixin providing some utility functions for locating/working with
+/// package_config.json files.
+mixin PackageConfigUtils {
+ /// Find the `package_config.json` file for the program being launched.
+ ///
+ /// TODO(dantup): Remove this once
+ /// https://github.com/dart-lang/sdk/issues/45530 is done as it will not be
+ /// necessary.
+ File? findPackageConfigFile(String possibleRoot) {
+ File? packageConfig;
+ while (true) {
+ packageConfig =
+ File(path.join(possibleRoot, '.dart_tool', 'package_config.json'));
+
+ // If this packageconfig exists, use it.
+ if (packageConfig.existsSync()) {
+ break;
+ }
+
+ final parent = path.dirname(possibleRoot);
+
+ // If we can't go up anymore, the search failed.
+ if (parent == possibleRoot) {
+ packageConfig = null;
+ break;
+ }
+
+ possibleRoot = parent;
+ }
+
+ return packageConfig;
+ }
+}
+
+/// A mixin for tracking additional PIDs that can be shut down at the end of a
+/// debug session.
+mixin PidTracker {
+ /// Process IDs to terminate during shutdown.
+ ///
+ /// This may be populated with pids from the VM Service to ensure we clean up
+ /// properly where signals may not be passed through the shell to the
+ /// underlying VM process.
+ /// https://github.com/Dart-Code/Dart-Code/issues/907
+ final pidsToTerminate = <int>{};
+
+ /// Terminates all processes with the PIDs registered in [pidsToTerminate].
+ void terminatePids(ProcessSignal signal) {
+ // TODO(dantup): In Dart-Code DAP, we first try again with sigint and wait
+ // for a few seconds before sending sigkill.
+ pidsToTerminate.forEach(
+ (pid) => Process.killPid(pid, signal),
+ );
+ }
+}
+
+/// A mixin providing some utility functions for working with vm-service-info
+/// files such as ensuring a temp folder exists to create them in, and waiting
+/// for the file to become valid parsable JSON.
+mixin VmServiceInfoFileUtils {
+ /// Creates a temp folder for the VM to write the service-info-file into and
+ /// returns the [File] to use.
+ File generateVmServiceInfoFile() {
+ // Using tmpDir.createTempory() is flakey on Windows+Linux (at least
+ // on GitHub Actions) complaining the file does not exist when creating a
+ // watcher. Creating/watching a folder and writing the file into it seems
+ // to be reliable.
+ final serviceInfoFilePath = path.join(
+ Directory.systemTemp.createTempSync('dart-vm-service').path,
+ 'vm.json',
+ );
+
+ return File(serviceInfoFilePath);
+ }
+
+ /// Waits for [vmServiceInfoFile] to exist and become valid before returning
+ /// the VM Service URI contained within.
+ Future<Uri> waitForVmServiceInfoFile(
+ Logger? logger,
+ File vmServiceInfoFile,
+ ) async {
+ final completer = Completer<Uri>();
+ late final StreamSubscription<FileSystemEvent> vmServiceInfoFileWatcher;
+
+ Uri? tryParseServiceInfoFile(FileSystemEvent event) {
+ final uri = _readVmServiceInfoFile(logger, vmServiceInfoFile);
+ if (uri != null && !completer.isCompleted) {
+ vmServiceInfoFileWatcher.cancel();
+ completer.complete(uri);
+ }
+ }
+
+ vmServiceInfoFileWatcher = vmServiceInfoFile.parent
+ .watch(events: FileSystemEvent.all)
+ .where((event) => event.path == vmServiceInfoFile.path)
+ .listen(
+ tryParseServiceInfoFile,
+ onError: (e) => logger?.call('Ignoring exception from watcher: $e'),
+ );
+
+ // After setting up the watcher, also check if the file already exists to
+ // ensure we don't miss it if it was created right before we set the
+ // watched up.
+ final uri = _readVmServiceInfoFile(logger, vmServiceInfoFile);
+ if (uri != null && !completer.isCompleted) {
+ unawaited(vmServiceInfoFileWatcher.cancel());
+ completer.complete(uri);
+ }
+
+ return completer.future;
+ }
+
+ /// Attempts to read VM Service info from a watcher event.
+ ///
+ /// If successful, returns the URI. Otherwise, returns null.
+ Uri? _readVmServiceInfoFile(Logger? logger, File file) {
+ try {
+ final content = file.readAsStringSync();
+ final json = jsonDecode(content);
+ return Uri.parse(json['uri']);
+ } catch (e) {
+ // It's possible we tried to read the file before it was completely
+ // written so ignore and try again on the next event.
+ logger?.call('Ignoring error parsing vm-service-info file: $e');
+ }
+ }
+}
diff --git a/pkg/dds/lib/src/dap/protocol_generated.dart b/pkg/dds/lib/src/dap/protocol_generated.dart
index 30620e4..a39f56f 100644
--- a/pkg/dds/lib/src/dap/protocol_generated.dart
+++ b/pkg/dds/lib/src/dap/protocol_generated.dart
@@ -4,8 +4,8 @@
// This code was auto-generated by tool/dap/generate_all.dart - do not hand-edit!
-import 'package:dds/src/dap/protocol_common.dart';
-import 'package:dds/src/dap/protocol_special.dart';
+import 'protocol_common.dart';
+import 'protocol_special.dart';
/// Arguments for 'attach' request. Additional attributes are implementation
/// specific.
diff --git a/pkg/dds/test/dap/integration/test_support.dart b/pkg/dds/test/dap/integration/test_support.dart
index 4c804c6..a8cbd0f 100644
--- a/pkg/dds/test/dap/integration/test_support.dart
+++ b/pkg/dds/test/dap/integration/test_support.dart
@@ -88,7 +88,7 @@
vmArgs ??= [];
vmArgs.addAll([
'--enable-vm-service=0',
- '--pause_isolates_on_start=true',
+ '--pause_isolates_on_start',
]);
final processArgs = [
...vmArgs,
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 6a57d1d..ef7f461 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -618,9 +618,15 @@
if (trackNeededDillLibraries) {
// Which dill builders were built?
neededDillLibraries = new Set<Library>();
+
+ // Propagate data from constant evaluator: Libraries used in the constant
+ // evaluator - that comes from dill - are marked.
+ Set<Library> librariesUsedByConstantEvaluator = userCode!.librariesUsed;
+
for (LibraryBuilder builder in dillLoadedData!.loader.builders.values) {
if (builder is DillLibraryBuilder) {
- if (builder.isBuiltAndMarked) {
+ if (builder.isBuiltAndMarked ||
+ librariesUsedByConstantEvaluator.contains(builder.library)) {
neededDillLibraries!.add(builder.library);
}
}
@@ -2396,6 +2402,7 @@
implements ChangedStructureNotifier {
Set<Class>? classHierarchyChanges;
Set<Class>? classMemberChanges;
+ Set<Library> librariesUsed = {};
IncrementalKernelTarget(FileSystem fileSystem, bool includeComments,
DillTarget dillTarget, UriTranslator uriTranslator)
@@ -2415,4 +2422,9 @@
classHierarchyChanges ??= <Class>{};
classHierarchyChanges!.add(cls);
}
+
+ @override
+ void markLibrariesUsed(Set<Library> visitedLibraries) {
+ librariesUsed.addAll(visitedLibraries);
+ }
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
index 329190f..3484b81 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
@@ -82,7 +82,7 @@
return component;
}
-ConstantCoverage transformLibraries(
+ConstantEvaluationData transformLibraries(
List<Library> libraries,
ConstantsBackend backend,
Map<String, String>? environmentDefines,
@@ -118,7 +118,10 @@
for (final Library library in libraries) {
constantsTransformer.convertLibrary(library);
}
- return constantsTransformer.constantEvaluator.getConstantCoverage();
+
+ return new ConstantEvaluationData(
+ constantsTransformer.constantEvaluator.getConstantCoverage(),
+ constantsTransformer.constantEvaluator.visitedLibraries);
}
void transformProcedure(
@@ -911,6 +914,8 @@
final BoolConstant trueConstant = new BoolConstant(true);
final BoolConstant falseConstant = new BoolConstant(false);
+ final Set<Library> visitedLibraries = {};
+
InstanceBuilder? instanceBuilder;
EvaluationEnvironment env;
Set<Expression> replacementNodes = new Set<Expression>.identity();
@@ -2835,6 +2840,7 @@
Constant visitStaticGet(StaticGet node) {
return withNewEnvironment(() {
final Member target = node.target;
+ visitedLibraries.add(target.enclosingLibrary);
if (target is Field) {
if (target.isConst) {
return _evaluateExpressionInContext(target, target.initializer!);
@@ -4028,6 +4034,13 @@
ConstantCoverage(this.constructorCoverage);
}
+class ConstantEvaluationData {
+ final ConstantCoverage coverage;
+ final Set<Library> visitedLibraries;
+
+ ConstantEvaluationData(this.coverage, this.visitedLibraries);
+}
+
/// Holds the necessary information for a constant object, namely
/// * the [klass] being instantiated
/// * the [typeArguments] used for the instantiation
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index f38b46b..a4ccfdf 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -80,7 +80,8 @@
EvaluationMode,
transformLibraries,
transformProcedure,
- ConstantCoverage;
+ ConstantCoverage,
+ ConstantEvaluationData;
import 'kernel_constants.dart' show KernelConstantErrorReporter;
import 'kernel_helper.dart';
import 'verifier.dart' show verifyComponent, verifyGetStaticType;
@@ -1230,23 +1231,27 @@
new TypeEnvironment(loader.coreTypes, loader.hierarchy);
constants.EvaluationMode evaluationMode = _getConstantEvaluationMode();
- constants.ConstantCoverage coverage = constants.transformLibraries(
- loader.libraries,
- backendTarget.constantsBackend(loader.coreTypes),
- environmentDefines,
- environment,
- new KernelConstantErrorReporter(loader),
- evaluationMode,
- evaluateAnnotations: true,
- enableTripleShift:
- isExperimentEnabledGlobally(ExperimentalFlag.tripleShift),
- enableConstFunctions:
- isExperimentEnabledGlobally(ExperimentalFlag.constFunctions),
- enableConstructorTearOff:
- isExperimentEnabledGlobally(ExperimentalFlag.constructorTearoffs),
- errorOnUnevaluatedConstant: errorOnUnevaluatedConstant);
+ constants.ConstantEvaluationData constantEvaluationData =
+ constants.transformLibraries(
+ loader.libraries,
+ backendTarget.constantsBackend(loader.coreTypes),
+ environmentDefines,
+ environment,
+ new KernelConstantErrorReporter(loader),
+ evaluationMode,
+ evaluateAnnotations: true,
+ enableTripleShift:
+ isExperimentEnabledGlobally(ExperimentalFlag.tripleShift),
+ enableConstFunctions:
+ isExperimentEnabledGlobally(ExperimentalFlag.constFunctions),
+ enableConstructorTearOff: isExperimentEnabledGlobally(
+ ExperimentalFlag.constructorTearoffs),
+ errorOnUnevaluatedConstant: errorOnUnevaluatedConstant);
ticker.logMs("Evaluated constants");
+ markLibrariesUsed(constantEvaluationData.visitedLibraries);
+
+ constants.ConstantCoverage coverage = constantEvaluationData.coverage;
coverage.constructorCoverage.forEach((Uri fileUri, Set<Reference> value) {
Source? source = uriToSource[fileUri];
// ignore: unnecessary_null_comparison
@@ -1387,6 +1392,10 @@
void releaseAncillaryResources() {
component = null;
}
+
+ void markLibrariesUsed(Set<Library> visitedLibraries) {
+ // Default implementation does nothing.
+ }
}
/// Looks for a constructor call that matches `super()` from a constructor in
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
index fb22647..2a08cd3 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -862,6 +862,12 @@
}
@override
+ void handleShowHideIdentifier(Token? modifier, Token? identifier) {
+ debugEvent("");
+ // Do nothing
+ }
+
+ @override
void beginClassOrMixinBody(DeclarationKind kind, Token token) {
assert(checkState(token, [
ValueKinds.Token,
@@ -928,7 +934,7 @@
@override
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
- Token onKeyword, Token endToken) {
+ Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
debugEvent("endExtensionDeclaration");
checkEmpty(extensionKeyword.charOffset);
}
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index c1ac2cf..1666eb8 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -328,6 +328,30 @@
}
@override
+ void handleShowHideIdentifier(Token? modifier, Token identifier) {
+ debugEvent("ShowHideIdentifier");
+
+ assert(modifier == null ||
+ modifier.stringValue! == "get" ||
+ modifier.stringValue! == "set" ||
+ modifier.stringValue! == "operator");
+
+ if (modifier == null) {
+ handleIdentifier(
+ identifier, IdentifierContext.extensionShowHideElementMemberOrType);
+ } else if (modifier.stringValue! == "get") {
+ handleIdentifier(
+ identifier, IdentifierContext.extensionShowHideElementGetter);
+ } else if (modifier.stringValue! == "set") {
+ handleIdentifier(
+ identifier, IdentifierContext.extensionShowHideElementSetter);
+ } else if (modifier.stringValue! == "operator") {
+ handleIdentifier(
+ identifier, IdentifierContext.extensionShowHideElementOperator);
+ }
+ }
+
+ @override
void handleIdentifier(Token token, IdentifierContext context) {
if (context == IdentifierContext.enumValueDeclaration) {
debugEvent("handleIdentifier");
@@ -337,6 +361,16 @@
} else {
push(new EnumConstantInfo(metadata, token.lexeme, token.charOffset));
}
+ } else if (context == IdentifierContext.extensionShowHideElementGetter ||
+ context == IdentifierContext.extensionShowHideElementMemberOrType ||
+ context == IdentifierContext.extensionShowHideElementSetter) {
+ push(context);
+ super.handleIdentifier(token, context);
+ push(token.charOffset);
+ } else if (context == IdentifierContext.extensionShowHideElementOperator) {
+ push(context);
+ push(operatorFromString(token.stringValue!));
+ push(token.charOffset);
} else {
super.handleIdentifier(token, context);
push(token.charOffset);
@@ -492,9 +526,22 @@
void beginClassOrMixinBody(DeclarationKind kind, Token token) {
if (kind == DeclarationKind.Extension) {
assert(checkState(token, [
+ /* hide type elements = */ ValueKinds.TypeBuilderListOrNull,
+ /* hide get elements = */ ValueKinds.NameListOrNull,
+ /* hide member or type elements = */ ValueKinds.NameListOrNull,
+ /* hide set elements = */ ValueKinds.NameListOrNull,
+ /* hide operator elements = */ ValueKinds.OperatorListOrNull,
+ /* show type elements = */ ValueKinds.TypeBuilderListOrNull,
+ /* show get elements = */ ValueKinds.NameListOrNull,
+ /* show member or type elements = */ ValueKinds.NameListOrNull,
+ /* show set elements */ ValueKinds.NameListOrNull,
+ /* show operator elements*/ ValueKinds.OperatorListOrNull,
unionOfKinds([ValueKinds.ParserRecovery, ValueKinds.TypeBuilder])
]));
- Object? extensionThisType = peek();
+
+ // We peek into 10th frame on the stack for the extension 'this' type.
+ Object? extensionThisType = stack[10];
+
if (extensionThisType is TypeBuilder) {
libraryBuilder.currentTypeParameterScopeBuilder
.registerExtensionThisType(extensionThisType);
@@ -533,6 +580,75 @@
}
@override
+ void handleExtensionShowHide(Token? showKeyword, int showElementCount,
+ Token? hideKeyword, int hideElementCount) {
+ debugEvent("ExtensionShow");
+
+ List<dynamic> toBePushed = <dynamic>[];
+ void handleShowHideElements(int elementCount) {
+ if (elementCount == 0) {
+ toBePushed.add(NullValue.TypeBuilderList);
+ toBePushed.add(NullValue.IdentifierList);
+ toBePushed.add(NullValue.IdentifierList);
+ toBePushed.add(NullValue.IdentifierList);
+ toBePushed.add(NullValue.OperatorList);
+ } else {
+ List<TypeBuilder> typeElements = <TypeBuilder>[];
+ List<String> getElements = <String>[];
+ List<String> ambiguousMemberOrTypeElements = <String>[];
+ List<String> setElements = <String>[];
+ List<Operator> operatorElements = <Operator>[];
+
+ for (int i = 0; i < elementCount; ++i) {
+ Object leadingElementPart = pop()!;
+ if (leadingElementPart is TypeBuilder) {
+ typeElements.add(leadingElementPart);
+ } else {
+ leadingElementPart as int; // Offset.
+ Object name = pop()!;
+ IdentifierContext context = pop() as IdentifierContext;
+
+ if (name is! ParserRecovery) {
+ assert(context ==
+ IdentifierContext.extensionShowHideElementGetter ||
+ context ==
+ IdentifierContext.extensionShowHideElementMemberOrType ||
+ context ==
+ IdentifierContext.extensionShowHideElementOperator ||
+ context == IdentifierContext.extensionShowHideElementSetter);
+
+ if (context == IdentifierContext.extensionShowHideElementGetter) {
+ getElements.add(name as String);
+ } else if (context ==
+ IdentifierContext.extensionShowHideElementMemberOrType) {
+ ambiguousMemberOrTypeElements.add(name as String);
+ } else if (context ==
+ IdentifierContext.extensionShowHideElementOperator) {
+ operatorElements.add(name as Operator);
+ } else if (context ==
+ IdentifierContext.extensionShowHideElementSetter) {
+ setElements.add(name as String);
+ }
+ }
+ }
+ }
+
+ toBePushed.add(typeElements);
+ toBePushed.add(getElements);
+ toBePushed.add(ambiguousMemberOrTypeElements);
+ toBePushed.add(setElements);
+ toBePushed.add(operatorElements);
+ }
+ }
+
+ handleShowHideElements(hideElementCount);
+ handleShowHideElements(showElementCount);
+ for (int i = toBePushed.length - 1; i >= 0; --i) {
+ push(toBePushed[i]);
+ }
+ }
+
+ @override
void handleRecoverClassHeader() {
debugEvent("handleRecoverClassHeader");
// TODO(jensj): Possibly use these instead... E.g. "class A extend B {}"
@@ -774,8 +890,18 @@
@override
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
- Token onKeyword, Token endToken) {
+ Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
assert(checkState(extensionKeyword, [
+ /* hide type elements = */ ValueKinds.TypeBuilderListOrNull,
+ /* hide get elements = */ ValueKinds.NameListOrNull,
+ /* hide member or type elements = */ ValueKinds.NameListOrNull,
+ /* hide set elements = */ ValueKinds.NameListOrNull,
+ /* hide operator elements = */ ValueKinds.OperatorListOrNull,
+ /* show type elements = */ ValueKinds.TypeBuilderListOrNull,
+ /* show get elements = */ ValueKinds.NameListOrNull,
+ /* show member or type elements = */ ValueKinds.NameListOrNull,
+ /* show set elements = */ ValueKinds.NameListOrNull,
+ /* show operator elements = */ ValueKinds.OperatorListOrNull,
unionOfKinds([ValueKinds.ParserRecovery, ValueKinds.TypeBuilder]),
ValueKinds.TypeVariableListOrNull,
ValueKinds.Integer,
@@ -783,6 +909,23 @@
ValueKinds.MetadataListOrNull
]));
debugEvent("endExtensionDeclaration");
+ pop() as List<TypeBuilder>?; // Type elements of the 'hide' clause.
+ pop() as List<String>?; // Getter elements of the 'hide' clause.
+ pop() as List<String>?; // Member or type elements of the 'hide' clause.
+ pop() as List<String>?; // Setter elements of the 'hide' clause.
+ pop() as List<Operator>?; // Operator elements of the 'hide' clause.
+ pop() as List<TypeBuilder>?; // Type elements of the 'show' clause.
+ pop() as List<String>?; // Getter elements of the 'show' clause.
+ pop() as List<String>?; // Member or type elements of the 'show' clause.
+ pop() as List<String>?; // Setter elements of the 'show' clause.
+ pop() as List<Operator>?; // Operator elements of the 'show' clause.
+ if (showKeyword != null && !libraryBuilder.enableExtensionTypesInLibrary) {
+ addProblem(
+ templateExperimentNotEnabled.withArguments('extension-types',
+ libraryBuilder.enableExtensionTypesVersionInLibrary.toText()),
+ showKeyword.charOffset,
+ showKeyword.length);
+ }
Object? onType = pop();
if (onType is ParserRecovery) {
ParserRecovery parserRecovery = onType;
diff --git a/pkg/front_end/lib/src/fasta/source/value_kinds.dart b/pkg/front_end/lib/src/fasta/source/value_kinds.dart
index 6f24626..85426fc 100644
--- a/pkg/front_end/lib/src/fasta/source/value_kinds.dart
+++ b/pkg/front_end/lib/src/fasta/source/value_kinds.dart
@@ -75,6 +75,8 @@
static const ValueKind ModifiersOrNull =
const SingleValueKind<List<type.Modifier>>(NullValue.Modifiers);
static const ValueKind Name = const SingleValueKind<String>();
+ static const ValueKind NameListOrNull =
+ const SingleValueKind<List<String>>(NullValue.IdentifierList);
static const ValueKind NameOrNull =
const SingleValueKind<String>(NullValue.Name);
static const ValueKind NameOrOperator =
@@ -87,6 +89,8 @@
const SingleValueKind<List<type.MetadataBuilder>>(NullValue.Metadata);
static const ValueKind ObjectList = const SingleValueKind<List<Object>>();
static const ValueKind Operator = const SingleValueKind<type.Operator>();
+ static const ValueKind OperatorListOrNull =
+ const SingleValueKind<List<type.Operator>>(NullValue.OperatorList);
static const ValueKind ParserRecovery =
const SingleValueKind<type.ParserRecovery>();
static const ValueKind ProblemBuilder =
@@ -94,8 +98,7 @@
static const ValueKind QualifiedName =
const SingleValueKind<type.QualifiedName>();
static const ValueKind Scope = const SingleValueKind<type.Scope>();
- static const ValueKind Selector =
- const SingleValueKind<type.Selector>();
+ static const ValueKind Selector = const SingleValueKind<type.Selector>();
static const ValueKind SwitchScopeOrNull =
const SingleValueKind<type.Scope>(NullValue.SwitchScope);
static const ValueKind Statement = const SingleValueKind<type.Statement>();
@@ -114,6 +117,8 @@
const SingleValueKind<type.TypeBuilder>();
static const ValueKind TypeBuilderOrNull =
const SingleValueKind<type.TypeBuilder>(NullValue.Type);
+ static const ValueKind TypeBuilderListOrNull =
+ const SingleValueKind<List<type.TypeBuilder>>(NullValue.TypeBuilderList);
static const ValueKind TypeVariableListOrNull =
const SingleValueKind<List<type.TypeVariableBuilder>>(
NullValue.TypeVariables);
diff --git a/pkg/front_end/lib/src/fasta/util/direct_parser_ast_helper.dart b/pkg/front_end/lib/src/fasta/util/direct_parser_ast_helper.dart
index 1b9883e..8c34151 100644
--- a/pkg/front_end/lib/src/fasta/util/direct_parser_ast_helper.dart
+++ b/pkg/front_end/lib/src/fasta/util/direct_parser_ast_helper.dart
@@ -216,6 +216,19 @@
}
@override
+ void handleExtensionShowHide(Token? showKeyword, int showElementCount,
+ Token? hideKeyword, int hideElementCount) {
+ DirectParserASTContentExtensionShowHideHandle data =
+ new DirectParserASTContentExtensionShowHideHandle(
+ DirectParserASTType.HANDLE,
+ showKeyword: showKeyword,
+ showElementCount: showElementCount,
+ hideKeyword: hideKeyword,
+ hideElementCount: hideElementCount);
+ seen(data);
+ }
+
+ @override
void handleClassHeader(Token begin, Token classKeyword, Token? nativeToken) {
DirectParserASTContentClassHeaderHandle data =
new DirectParserASTContentClassHeaderHandle(DirectParserASTType.HANDLE,
@@ -311,13 +324,15 @@
@override
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
- Token onKeyword, Token endToken) {
+ Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
DirectParserASTContentExtensionDeclarationEnd data =
new DirectParserASTContentExtensionDeclarationEnd(
DirectParserASTType.END,
extensionKeyword: extensionKeyword,
typeKeyword: typeKeyword,
onKeyword: onKeyword,
+ showKeyword: showKeyword,
+ hideKeyword: hideKeyword,
endToken: endToken);
seen(data);
}
@@ -2314,6 +2329,16 @@
}
@override
+ void handleShowHideIdentifier(Token? modifier, Token identifier) {
+ DirectParserASTContentShowHideIdentifierHandle data =
+ new DirectParserASTContentShowHideIdentifierHandle(
+ DirectParserASTType.HANDLE,
+ modifier: modifier,
+ identifier: identifier);
+ seen(data);
+ }
+
+ @override
void handleIndexedExpression(
Token? question, Token openSquareBracket, Token closeSquareBracket) {
DirectParserASTContentIndexedExpressionHandle data =
@@ -3157,6 +3182,29 @@
};
}
+class DirectParserASTContentExtensionShowHideHandle
+ extends DirectParserASTContent {
+ final Token? showKeyword;
+ final int showElementCount;
+ final Token? hideKeyword;
+ final int hideElementCount;
+
+ DirectParserASTContentExtensionShowHideHandle(DirectParserASTType type,
+ {this.showKeyword,
+ required this.showElementCount,
+ this.hideKeyword,
+ required this.hideElementCount})
+ : super("ExtensionShowHide", type);
+
+ @override
+ Map<String, Object?> get deprecatedArguments => {
+ "showKeyword": showKeyword,
+ "showElementCount": showElementCount,
+ "hideKeyword": hideKeyword,
+ "hideElementCount": hideElementCount,
+ };
+}
+
class DirectParserASTContentClassHeaderHandle extends DirectParserASTContent {
final Token begin;
final Token classKeyword;
@@ -3317,12 +3365,16 @@
final Token extensionKeyword;
final Token? typeKeyword;
final Token onKeyword;
+ final Token? showKeyword;
+ final Token? hideKeyword;
final Token endToken;
DirectParserASTContentExtensionDeclarationEnd(DirectParserASTType type,
{required this.extensionKeyword,
this.typeKeyword,
required this.onKeyword,
+ this.showKeyword,
+ this.hideKeyword,
required this.endToken})
: super("ExtensionDeclaration", type);
@@ -3331,6 +3383,8 @@
"extensionKeyword": extensionKeyword,
"typeKeyword": typeKeyword,
"onKeyword": onKeyword,
+ "showKeyword": showKeyword,
+ "hideKeyword": hideKeyword,
"endToken": endToken,
};
}
@@ -6627,6 +6681,22 @@
};
}
+class DirectParserASTContentShowHideIdentifierHandle
+ extends DirectParserASTContent {
+ final Token? modifier;
+ final Token identifier;
+
+ DirectParserASTContentShowHideIdentifierHandle(DirectParserASTType type,
+ {this.modifier, required this.identifier})
+ : super("ShowHideIdentifier", type);
+
+ @override
+ Map<String, Object?> get deprecatedArguments => {
+ "modifier": modifier,
+ "identifier": identifier,
+ };
+}
+
class DirectParserASTContentIndexedExpressionHandle
extends DirectParserASTContent {
final Token? question;
diff --git a/pkg/front_end/lib/src/fasta/util/textual_outline.dart b/pkg/front_end/lib/src/fasta/util/textual_outline.dart
index fe35178..3392abe 100644
--- a/pkg/front_end/lib/src/fasta/util/textual_outline.dart
+++ b/pkg/front_end/lib/src/fasta/util/textual_outline.dart
@@ -805,7 +805,7 @@
@override
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
- Token onKeyword, Token endToken) {
+ Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
classStartToChunk[extensionKeyword] =
new _ExtensionDeclarationChunk(extensionKeyword, endToken);
}
diff --git a/pkg/front_end/parser_testcases/error_recovery/extension_member_contributor_test_completion.dart.expect b/pkg/front_end/parser_testcases/error_recovery/extension_member_contributor_test_completion.dart.expect
index 58a0949..ec1dd0c 100644
--- a/pkg/front_end/parser_testcases/error_recovery/extension_member_contributor_test_completion.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/extension_member_contributor_test_completion.dart.expect
@@ -31,6 +31,7 @@
handleType(T, null)
endTypeArguments(1, <, >)
handleType(List, null)
+ handleExtensionShowHide(null, 0, null, 0)
beginClassOrMixinBody(DeclarationKind.Extension, {)
beginMetadataStar(bool)
endMetadataStar(0)
@@ -108,7 +109,7 @@
endExtensionMethod(set, set, (, null, })
endMember()
endClassOrMixinBody(DeclarationKind.Extension, 3, {, })
- endExtensionDeclaration(extension, null, on, })
+ endExtensionDeclaration(extension, null, on, null, null, })
endTopLevelDeclaration(void)
beginMetadataStar(void)
endMetadataStar(0)
diff --git a/pkg/front_end/parser_testcases/error_recovery/extension_member_contributor_test_completion.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/extension_member_contributor_test_completion.dart.intertwined.expect
index 0a0206e..0244778 100644
--- a/pkg/front_end/parser_testcases/error_recovery/extension_member_contributor_test_completion.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/extension_member_contributor_test_completion.dart.intertwined.expect
@@ -31,6 +31,7 @@
listener: handleType(T, null)
listener: endTypeArguments(1, <, >)
listener: handleType(List, null)
+ listener: handleExtensionShowHide(null, 0, null, 0)
parseClassOrMixinOrExtensionBody(>, DeclarationKind.Extension, E)
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
notEofOrValue(}, bool)
@@ -172,7 +173,7 @@
listener: endMember()
notEofOrValue(}, })
listener: endClassOrMixinBody(DeclarationKind.Extension, 3, {, })
- listener: endExtensionDeclaration(extension, null, on, })
+ listener: endExtensionDeclaration(extension, null, on, null, null, })
listener: endTopLevelDeclaration(void)
parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
parseMetadataStar(})
diff --git a/pkg/front_end/parser_testcases/extension_named_type.dart.expect b/pkg/front_end/parser_testcases/extension_named_type.dart.expect
index a502ee7..96b6956 100644
--- a/pkg/front_end/parser_testcases/extension_named_type.dart.expect
+++ b/pkg/front_end/parser_testcases/extension_named_type.dart.expect
@@ -22,6 +22,7 @@
handleIdentifier(A, typeReference)
handleNoTypeArguments({)
handleType(A, null)
+ handleExtensionShowHide(null, 0, null, 0)
beginClassOrMixinBody(DeclarationKind.Extension, {)
beginMetadataStar(method)
endMetadataStar(0)
@@ -39,7 +40,7 @@
endExtensionMethod(null, method, (, null, })
endMember()
endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
- endExtensionDeclaration(extension, null, on, })
+ endExtensionDeclaration(extension, null, on, null, null, })
endTopLevelDeclaration(test)
beginMetadataStar(test)
endMetadataStar(0)
diff --git a/pkg/front_end/parser_testcases/extension_named_type.dart.intertwined.expect b/pkg/front_end/parser_testcases/extension_named_type.dart.intertwined.expect
index dc87b68..c5f52cb 100644
--- a/pkg/front_end/parser_testcases/extension_named_type.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extension_named_type.dart.intertwined.expect
@@ -43,6 +43,7 @@
listener: handleIdentifier(A, typeReference)
listener: handleNoTypeArguments({)
listener: handleType(A, null)
+ listener: handleExtensionShowHide(null, 0, null, 0)
parseClassOrMixinOrExtensionBody(A, DeclarationKind.Extension, type)
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
notEofOrValue(}, method)
@@ -79,7 +80,7 @@
listener: endMember()
notEofOrValue(}, })
listener: endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
- listener: endExtensionDeclaration(extension, null, on, })
+ listener: endExtensionDeclaration(extension, null, on, null, null, })
listener: endTopLevelDeclaration(test)
parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
parseMetadataStar(})
diff --git a/pkg/front_end/parser_testcases/extension_type.dart.expect b/pkg/front_end/parser_testcases/extension_type.dart.expect
index c759acc..1efa3c2 100644
--- a/pkg/front_end/parser_testcases/extension_type.dart.expect
+++ b/pkg/front_end/parser_testcases/extension_type.dart.expect
@@ -22,8 +22,9 @@
handleIdentifier(A, typeReference)
handleNoTypeArguments({)
handleType(A, null)
+ handleExtensionShowHide(null, 0, null, 0)
beginClassOrMixinBody(DeclarationKind.Extension, {)
endClassOrMixinBody(DeclarationKind.Extension, 0, {, })
- endExtensionDeclaration(extension, type, on, })
+ endExtensionDeclaration(extension, type, on, null, null, })
endTopLevelDeclaration()
endCompilationUnit(2, )
diff --git a/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect b/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect
index c8f125d..2272376 100644
--- a/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect
@@ -43,11 +43,12 @@
listener: handleIdentifier(A, typeReference)
listener: handleNoTypeArguments({)
listener: handleType(A, null)
+ listener: handleExtensionShowHide(null, 0, null, 0)
parseClassOrMixinOrExtensionBody(A, DeclarationKind.Extension, E)
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
notEofOrValue(}, })
listener: endClassOrMixinBody(DeclarationKind.Extension, 0, {, })
- listener: endExtensionDeclaration(extension, type, on, })
+ listener: endExtensionDeclaration(extension, type, on, null, null, })
listener: endTopLevelDeclaration()
reportAllErrorTokens(class)
listener: endCompilationUnit(2, )
diff --git a/pkg/front_end/parser_testcases/extensions/covariant.dart.expect b/pkg/front_end/parser_testcases/extensions/covariant.dart.expect
index 3cc233a..f6e44b8 100644
--- a/pkg/front_end/parser_testcases/extensions/covariant.dart.expect
+++ b/pkg/front_end/parser_testcases/extensions/covariant.dart.expect
@@ -45,6 +45,7 @@
handleIdentifier(C, typeReference)
handleNoTypeArguments({)
handleType(C, null)
+ handleExtensionShowHide(null, 0, null, 0)
beginClassOrMixinBody(DeclarationKind.Extension, {)
beginMetadataStar(addChild)
endMetadataStar(0)
@@ -72,6 +73,6 @@
endExtensionMethod(null, addChild, (, null, })
endMember()
endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
- endExtensionDeclaration(extension, null, on, })
+ endExtensionDeclaration(extension, null, on, null, null, })
endTopLevelDeclaration()
endCompilationUnit(3, )
diff --git a/pkg/front_end/parser_testcases/extensions/covariant.dart.intertwined.expect b/pkg/front_end/parser_testcases/extensions/covariant.dart.intertwined.expect
index b493885..f04b161 100644
--- a/pkg/front_end/parser_testcases/extensions/covariant.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extensions/covariant.dart.intertwined.expect
@@ -74,6 +74,7 @@
listener: handleIdentifier(C, typeReference)
listener: handleNoTypeArguments({)
listener: handleType(C, null)
+ listener: handleExtensionShowHide(null, 0, null, 0)
parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
notEofOrValue(}, addChild)
@@ -124,7 +125,7 @@
listener: endMember()
notEofOrValue(}, })
listener: endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
- listener: endExtensionDeclaration(extension, null, on, })
+ listener: endExtensionDeclaration(extension, null, on, null, null, })
listener: endTopLevelDeclaration()
reportAllErrorTokens(class)
listener: endCompilationUnit(3, )
diff --git a/pkg/front_end/parser_testcases/extensions/not_covariant.dart.expect b/pkg/front_end/parser_testcases/extensions/not_covariant.dart.expect
index b6adb53..23440f4 100644
--- a/pkg/front_end/parser_testcases/extensions/not_covariant.dart.expect
+++ b/pkg/front_end/parser_testcases/extensions/not_covariant.dart.expect
@@ -39,6 +39,7 @@
handleIdentifier(C, typeReference)
handleNoTypeArguments({)
handleType(C, null)
+ handleExtensionShowHide(null, 0, null, 0)
beginClassOrMixinBody(DeclarationKind.Extension, {)
beginMetadataStar(addChild)
endMetadataStar(0)
@@ -65,6 +66,6 @@
endExtensionMethod(null, addChild, (, null, })
endMember()
endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
- endExtensionDeclaration(extension, null, on, })
+ endExtensionDeclaration(extension, null, on, null, null, })
endTopLevelDeclaration()
endCompilationUnit(3, )
diff --git a/pkg/front_end/parser_testcases/extensions/not_covariant.dart.intertwined.expect b/pkg/front_end/parser_testcases/extensions/not_covariant.dart.intertwined.expect
index 333ccf1..8735e12 100644
--- a/pkg/front_end/parser_testcases/extensions/not_covariant.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extensions/not_covariant.dart.intertwined.expect
@@ -74,6 +74,7 @@
listener: handleIdentifier(C, typeReference)
listener: handleNoTypeArguments({)
listener: handleType(C, null)
+ listener: handleExtensionShowHide(null, 0, null, 0)
parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
notEofOrValue(}, addChild)
@@ -122,7 +123,7 @@
listener: endMember()
notEofOrValue(}, })
listener: endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
- listener: endExtensionDeclaration(extension, null, on, })
+ listener: endExtensionDeclaration(extension, null, on, null, null, })
listener: endTopLevelDeclaration()
reportAllErrorTokens(class)
listener: endCompilationUnit(3, )
diff --git a/pkg/front_end/parser_testcases/extensions/static.dart.expect b/pkg/front_end/parser_testcases/extensions/static.dart.expect
index 568639a..5147f20 100644
--- a/pkg/front_end/parser_testcases/extensions/static.dart.expect
+++ b/pkg/front_end/parser_testcases/extensions/static.dart.expect
@@ -39,6 +39,7 @@
handleIdentifier(C, typeReference)
handleNoTypeArguments({)
handleType(C, null)
+ handleExtensionShowHide(null, 0, null, 0)
beginClassOrMixinBody(DeclarationKind.Extension, {)
beginMetadataStar(static)
endMetadataStar(0)
@@ -65,6 +66,6 @@
endExtensionMethod(null, static, (, null, })
endMember()
endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
- endExtensionDeclaration(extension, null, on, })
+ endExtensionDeclaration(extension, null, on, null, null, })
endTopLevelDeclaration()
endCompilationUnit(3, )
diff --git a/pkg/front_end/parser_testcases/extensions/static.dart.intertwined.expect b/pkg/front_end/parser_testcases/extensions/static.dart.intertwined.expect
index f91d314..560c41b 100644
--- a/pkg/front_end/parser_testcases/extensions/static.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extensions/static.dart.intertwined.expect
@@ -74,6 +74,7 @@
listener: handleIdentifier(C, typeReference)
listener: handleNoTypeArguments({)
listener: handleType(C, null)
+ listener: handleExtensionShowHide(null, 0, null, 0)
parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
notEofOrValue(}, static)
@@ -121,7 +122,7 @@
listener: endMember()
notEofOrValue(}, })
listener: endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
- listener: endExtensionDeclaration(extension, null, on, })
+ listener: endExtensionDeclaration(extension, null, on, null, null, })
listener: endTopLevelDeclaration()
reportAllErrorTokens(class)
listener: endCompilationUnit(3, )
diff --git a/pkg/front_end/parser_testcases/extensions/static_covariant.dart.expect b/pkg/front_end/parser_testcases/extensions/static_covariant.dart.expect
index 1e1a39a..b4a4c33 100644
--- a/pkg/front_end/parser_testcases/extensions/static_covariant.dart.expect
+++ b/pkg/front_end/parser_testcases/extensions/static_covariant.dart.expect
@@ -45,6 +45,7 @@
handleIdentifier(C, typeReference)
handleNoTypeArguments({)
handleType(C, null)
+ handleExtensionShowHide(null, 0, null, 0)
beginClassOrMixinBody(DeclarationKind.Extension, {)
beginMetadataStar(static)
endMetadataStar(0)
@@ -72,6 +73,6 @@
endExtensionMethod(null, static, (, null, })
endMember()
endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
- endExtensionDeclaration(extension, null, on, })
+ endExtensionDeclaration(extension, null, on, null, null, })
endTopLevelDeclaration()
endCompilationUnit(3, )
diff --git a/pkg/front_end/parser_testcases/extensions/static_covariant.dart.intertwined.expect b/pkg/front_end/parser_testcases/extensions/static_covariant.dart.intertwined.expect
index c1ae5d5..3e0aba8 100644
--- a/pkg/front_end/parser_testcases/extensions/static_covariant.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extensions/static_covariant.dart.intertwined.expect
@@ -74,6 +74,7 @@
listener: handleIdentifier(C, typeReference)
listener: handleNoTypeArguments({)
listener: handleType(C, null)
+ listener: handleExtensionShowHide(null, 0, null, 0)
parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
notEofOrValue(}, static)
@@ -123,7 +124,7 @@
listener: endMember()
notEofOrValue(}, })
listener: endClassOrMixinBody(DeclarationKind.Extension, 1, {, })
- listener: endExtensionDeclaration(extension, null, on, })
+ listener: endExtensionDeclaration(extension, null, on, null, null, })
listener: endTopLevelDeclaration()
reportAllErrorTokens(class)
listener: endCompilationUnit(3, )
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_not_triple_shift.dart.expect b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_not_triple_shift.dart.expect
index 616d7b4..3a34750 100644
--- a/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_not_triple_shift.dart.expect
+++ b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_not_triple_shift.dart.expect
@@ -7,6 +7,7 @@
handleIdentifier(Symbol, typeReference)
handleNoTypeArguments({)
handleType(Symbol, null)
+ handleExtensionShowHide(null, 0, null, 0)
beginClassOrMixinBody(DeclarationKind.Extension, {)
beginMetadataStar(String)
endMetadataStar(0)
@@ -59,7 +60,7 @@
endExtensionMethod(null, String, (, null, ;)
endMember()
endClassOrMixinBody(DeclarationKind.Extension, 2, {, })
- endExtensionDeclaration(extension, null, on, })
+ endExtensionDeclaration(extension, null, on, null, null, })
endTopLevelDeclaration(void)
beginMetadataStar(void)
endMetadataStar(0)
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_not_triple_shift.dart.intertwined.expect b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_not_triple_shift.dart.intertwined.expect
index aea9af2..3e7a724 100644
--- a/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_not_triple_shift.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_not_triple_shift.dart.intertwined.expect
@@ -15,6 +15,7 @@
listener: handleIdentifier(Symbol, typeReference)
listener: handleNoTypeArguments({)
listener: handleType(Symbol, null)
+ listener: handleExtensionShowHide(null, 0, null, 0)
parseClassOrMixinOrExtensionBody(Symbol, DeclarationKind.Extension, null)
listener: beginClassOrMixinBody(DeclarationKind.Extension, {)
notEofOrValue(}, String)
@@ -122,7 +123,7 @@
listener: endMember()
notEofOrValue(}, })
listener: endClassOrMixinBody(DeclarationKind.Extension, 2, {, })
- listener: endExtensionDeclaration(extension, null, on, })
+ listener: endExtensionDeclaration(extension, null, on, null, null, })
listener: endTopLevelDeclaration(void)
parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
parseMetadataStar(})
diff --git a/pkg/front_end/test/incremental_suite.dart b/pkg/front_end/test/incremental_suite.dart
index 51801fd..2f68e15f 100644
--- a/pkg/front_end/test/incremental_suite.dart
+++ b/pkg/front_end/test/incremental_suite.dart
@@ -299,8 +299,12 @@
checkIsEqual(normalDillData, initializedDillData);
}
-Future<Map<String, List<int>>> createModules(Map module,
- final List<int> sdkSummaryData, Target target, String sdkSummary) async {
+Future<Map<String, List<int>>> createModules(
+ Map module,
+ final List<int> sdkSummaryData,
+ Target target,
+ Target originalTarget,
+ String sdkSummary) async {
final Uri base = Uri.parse("org-dartlang-test:///");
final Uri sdkSummaryUri = base.resolve(sdkSummary);
@@ -332,6 +336,10 @@
moduleSources.add(uri);
}
}
+ bool outlineOnly = false;
+ if (originalTarget is DevCompilerTarget) {
+ outlineOnly = true;
+ }
CompilerOptions options =
getOptions(target: target, sdkSummary: sdkSummary);
options.fileSystem = fs;
@@ -345,8 +353,8 @@
if (packagesUri != null) {
options.packagesFileUri = packagesUri;
}
- TestIncrementalCompiler compiler =
- new TestIncrementalCompiler(options, moduleSources.first, null);
+ TestIncrementalCompiler compiler = new TestIncrementalCompiler(
+ options, moduleSources.first, /* initializeFrom = */ null, outlineOnly);
Component c = await compiler.computeDelta(entryPoints: moduleSources);
c.computeCanonicalNames();
List<Library> wantedLibs = <Library>[];
@@ -416,6 +424,7 @@
throw "Unknown target name '$targetName'";
}
}
+ Target originalTarget = target;
target = new TestTargetWrapper(target, targetFlags);
String sdkSummary = computePlatformDillName(
@@ -442,8 +451,8 @@
Map<String, Component>? moduleComponents;
if (modules != null) {
- moduleData =
- await createModules(modules, sdkSummaryData, target, sdkSummary);
+ moduleData = await createModules(
+ modules, sdkSummaryData, target, originalTarget, sdkSummary);
sdk = newestWholeComponent = new Component();
new BinaryBuilder(sdkSummaryData,
filename: null, disableLazyReading: false)
diff --git a/pkg/front_end/test/parser_test_listener.dart b/pkg/front_end/test/parser_test_listener.dart
index 1a797be..4d45463 100644
--- a/pkg/front_end/test/parser_test_listener.dart
+++ b/pkg/front_end/test/parser_test_listener.dart
@@ -223,6 +223,18 @@
}
@override
+ void handleExtensionShowHide(Token? showKeyword, int showElementCount,
+ Token? hideKeyword, int hideElementCount) {
+ seen(showKeyword);
+ seen(hideKeyword);
+ doPrint('handleExtensionShowHide('
+ '$showKeyword, '
+ '$showElementCount, '
+ '$hideKeyword, '
+ '$hideElementCount)');
+ }
+
+ @override
void handleClassHeader(Token begin, Token classKeyword, Token? nativeToken) {
seen(begin);
seen(classKeyword);
@@ -300,16 +312,20 @@
@override
void endExtensionDeclaration(Token extensionKeyword, Token? typeKeyword,
- Token onKeyword, Token endToken) {
+ Token onKeyword, Token? showKeyword, Token? hideKeyword, Token endToken) {
indent--;
seen(extensionKeyword);
seen(typeKeyword);
seen(onKeyword);
+ seen(showKeyword);
+ seen(hideKeyword);
seen(endToken);
doPrint('endExtensionDeclaration('
'$extensionKeyword, '
'$typeKeyword, '
'$onKeyword, '
+ '$showKeyword, '
+ '$hideKeyword, '
'$endToken)');
}
@@ -2084,6 +2100,13 @@
}
@override
+ void handleShowHideIdentifier(Token? modifier, Token identifier) {
+ seen(modifier);
+ seen(identifier);
+ doPrint('handleShowHideIdentifier(' '$modifier, ' '$identifier)');
+ }
+
+ @override
void handleIndexedExpression(
Token? question, Token openSquareBracket, Token closeSquareBracket) {
seen(question);
diff --git a/pkg/front_end/test/spell_checking_list_common.txt b/pkg/front_end/test/spell_checking_list_common.txt
index 73be42a..2ee0aa7 100644
--- a/pkg/front_end/test/spell_checking_list_common.txt
+++ b/pkg/front_end/test/spell_checking_list_common.txt
@@ -3156,6 +3156,7 @@
unaliased
unaliasing
unambiguous
+unambiguously
unary
unassignable
unassigned
diff --git a/pkg/front_end/testcases/extension_types/basic_show.dart b/pkg/front_end/testcases/extension_types/basic_show.dart
new file mode 100644
index 0000000..c4f310b
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/basic_show.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2021, 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 E1 on int show num {} // Ok.
+
+extension E2 on int {} // Ok.
+
+extension E3 on int show {} // Error.
+
+extension E4 on int show num, Comparable {} // Ok.
+
+extension E5 on int show num, {} // Error.
+
+extension E6 on int show , num {} // Error.
+
+main() {}
diff --git a/pkg/front_end/testcases/extension_types/basic_show.dart.strong.expect b/pkg/front_end/testcases/extension_types/basic_show.dart.strong.expect
new file mode 100644
index 0000000..2777045
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/basic_show.dart.strong.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:9:26: Error: Expected an identifier, but got '{'.
+// Try inserting an identifier before '{'.
+// extension E3 on int show {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:13:31: Error: Expected an identifier, but got '{'.
+// Try inserting an identifier before '{'.
+// extension E5 on int show num, {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:26: Error: Expected an identifier, but got ','.
+// Try inserting an identifier before ','.
+// extension E6 on int show , num {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A extension declaration must have a body, even if it is empty.
+// Try adding an empty body.
+// extension E6 on int show , num {} // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A function declaration needs an explicit list of parameters.
+// Try adding a parameter list to the function declaration.
+// extension E6 on int show , num {} // Error.
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+extension E1 on core::int {
+}
+extension E2 on core::int {
+}
+extension E3 on core::int {
+}
+extension E4 on core::int {
+}
+extension E5 on core::int {
+}
+extension E6 on core::int {
+}
+static method num() → dynamic {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/basic_show.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/basic_show.dart.strong.transformed.expect
new file mode 100644
index 0000000..2777045
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/basic_show.dart.strong.transformed.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:9:26: Error: Expected an identifier, but got '{'.
+// Try inserting an identifier before '{'.
+// extension E3 on int show {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:13:31: Error: Expected an identifier, but got '{'.
+// Try inserting an identifier before '{'.
+// extension E5 on int show num, {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:26: Error: Expected an identifier, but got ','.
+// Try inserting an identifier before ','.
+// extension E6 on int show , num {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A extension declaration must have a body, even if it is empty.
+// Try adding an empty body.
+// extension E6 on int show , num {} // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A function declaration needs an explicit list of parameters.
+// Try adding a parameter list to the function declaration.
+// extension E6 on int show , num {} // Error.
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+extension E1 on core::int {
+}
+extension E2 on core::int {
+}
+extension E3 on core::int {
+}
+extension E4 on core::int {
+}
+extension E5 on core::int {
+}
+extension E6 on core::int {
+}
+static method num() → dynamic {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/basic_show.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/basic_show.dart.textual_outline.expect
new file mode 100644
index 0000000..63b59b8
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/basic_show.dart.textual_outline.expect
@@ -0,0 +1,8 @@
+extension E1 on int show num {}
+extension E2 on int {}
+extension E3 on int show {}
+extension E4 on int show num, Comparable {}
+extension E5 on int show num, {}
+extension E6 on int show , {}
+num (){}
+main() {}
diff --git a/pkg/front_end/testcases/extension_types/basic_show.dart.weak.expect b/pkg/front_end/testcases/extension_types/basic_show.dart.weak.expect
new file mode 100644
index 0000000..2777045
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/basic_show.dart.weak.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:9:26: Error: Expected an identifier, but got '{'.
+// Try inserting an identifier before '{'.
+// extension E3 on int show {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:13:31: Error: Expected an identifier, but got '{'.
+// Try inserting an identifier before '{'.
+// extension E5 on int show num, {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:26: Error: Expected an identifier, but got ','.
+// Try inserting an identifier before ','.
+// extension E6 on int show , num {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A extension declaration must have a body, even if it is empty.
+// Try adding an empty body.
+// extension E6 on int show , num {} // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A function declaration needs an explicit list of parameters.
+// Try adding a parameter list to the function declaration.
+// extension E6 on int show , num {} // Error.
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+extension E1 on core::int {
+}
+extension E2 on core::int {
+}
+extension E3 on core::int {
+}
+extension E4 on core::int {
+}
+extension E5 on core::int {
+}
+extension E6 on core::int {
+}
+static method num() → dynamic {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/basic_show.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/basic_show.dart.weak.outline.expect
new file mode 100644
index 0000000..cabf277
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/basic_show.dart.weak.outline.expect
@@ -0,0 +1,48 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:9:26: Error: Expected an identifier, but got '{'.
+// Try inserting an identifier before '{'.
+// extension E3 on int show {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:13:31: Error: Expected an identifier, but got '{'.
+// Try inserting an identifier before '{'.
+// extension E5 on int show num, {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:26: Error: Expected an identifier, but got ','.
+// Try inserting an identifier before ','.
+// extension E6 on int show , num {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A extension declaration must have a body, even if it is empty.
+// Try adding an empty body.
+// extension E6 on int show , num {} // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A function declaration needs an explicit list of parameters.
+// Try adding a parameter list to the function declaration.
+// extension E6 on int show , num {} // Error.
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+extension E1 on core::int {
+}
+extension E2 on core::int {
+}
+extension E3 on core::int {
+}
+extension E4 on core::int {
+}
+extension E5 on core::int {
+}
+extension E6 on core::int {
+}
+static method num() → dynamic
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/extension_types/basic_show.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/basic_show.dart.weak.transformed.expect
new file mode 100644
index 0000000..2777045
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/basic_show.dart.weak.transformed.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:9:26: Error: Expected an identifier, but got '{'.
+// Try inserting an identifier before '{'.
+// extension E3 on int show {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:13:31: Error: Expected an identifier, but got '{'.
+// Try inserting an identifier before '{'.
+// extension E5 on int show num, {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:26: Error: Expected an identifier, but got ','.
+// Try inserting an identifier before ','.
+// extension E6 on int show , num {} // Error.
+// ^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A extension declaration must have a body, even if it is empty.
+// Try adding an empty body.
+// extension E6 on int show , num {} // Error.
+// ^^^
+//
+// pkg/front_end/testcases/extension_types/basic_show.dart:15:28: Error: A function declaration needs an explicit list of parameters.
+// Try adding a parameter list to the function declaration.
+// extension E6 on int show , num {} // Error.
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+extension E1 on core::int {
+}
+extension E2 on core::int {
+}
+extension E3 on core::int {
+}
+extension E4 on core::int {
+}
+extension E5 on core::int {
+}
+extension E6 on core::int {
+}
+static method num() → dynamic {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart
new file mode 100644
index 0000000..1caf93a
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2021, 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 A {
+ void mixin() {}
+ void as() {}
+}
+
+extension type E1 on A show mixin, as {}
+extension type E2 on A hide mixin, as {}
+
+main() {}
diff --git a/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.strong.expect b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.strong.expect
new file mode 100644
index 0000000..02b44ca
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.strong.expect
@@ -0,0 +1,16 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ method mixin() → void {}
+ method as() → void {}
+}
+extension type E1 on self::A {
+}
+extension type E2 on self::A {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.strong.transformed.expect
new file mode 100644
index 0000000..02b44ca
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.strong.transformed.expect
@@ -0,0 +1,16 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ method mixin() → void {}
+ method as() → void {}
+}
+extension type E1 on self::A {
+}
+extension type E2 on self::A {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.textual_outline.expect
new file mode 100644
index 0000000..b36dba8
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.textual_outline.expect
@@ -0,0 +1,7 @@
+class A {
+ void mixin() {}
+ void as() {}
+}
+extension type E1 on A show mixin, as {}
+extension type E2 on A hide mixin, as {}
+main() {}
diff --git a/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.weak.expect b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.weak.expect
new file mode 100644
index 0000000..02b44ca
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.weak.expect
@@ -0,0 +1,16 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ method mixin() → void {}
+ method as() → void {}
+}
+extension type E1 on self::A {
+}
+extension type E2 on self::A {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.weak.outline.expect
new file mode 100644
index 0000000..4149c70
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.weak.outline.expect
@@ -0,0 +1,18 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ ;
+ method mixin() → void
+ ;
+ method as() → void
+ ;
+}
+extension type E1 on self::A {
+}
+extension type E2 on self::A {
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.weak.transformed.expect
new file mode 100644
index 0000000..02b44ca
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/keyword_in_show_hide_element.dart.weak.transformed.expect
@@ -0,0 +1,16 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ method mixin() → void {}
+ method as() → void {}
+}
+extension type E1 on self::A {
+}
+extension type E2 on self::A {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart
new file mode 100644
index 0000000..0b39bde
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2021, 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 I1<X, Y> {}
+
+class I2<X, Y, Z> {}
+
+class A {}
+
+class B extends A implements I1<int, int> {
+ void methodB() {}
+ void methodB2() {}
+ int get getterB => throw 42;
+ void set setterB(int value) {}
+ B operator *(B other) => throw 42;
+}
+
+class C extends B {}
+
+class D extends C implements I2<int, int, int> {
+ void methodD() {}
+ int get getterD => throw 42;
+ void set setterD(int value) {}
+ D operator +(D other) => throw 42;
+}
+
+extension type E on D
+ show C, I2<int, int, int>, methodD, get getterD, set setterD, operator +
+ hide A, I1<int, int>, methodB, methodB2, get getterB, set setterB, operator *
+ {}
+
+main() {}
diff --git a/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.strong.expect b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.strong.expect
new file mode 100644
index 0000000..a545388
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.strong.expect
@@ -0,0 +1,50 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class I1<X extends core::Object? = dynamic, Y extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::I1<self::I1::X%, self::I1::Y%>
+ : super core::Object::•()
+ ;
+}
+class I2<X extends core::Object? = dynamic, Y extends core::Object? = dynamic, Z extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::I2<self::I2::X%, self::I2::Y%, self::I2::Z%>
+ : super core::Object::•()
+ ;
+}
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+}
+class B extends self::A implements self::I1<core::int, core::int> {
+ synthetic constructor •() → self::B
+ : super self::A::•()
+ ;
+ method methodB() → void {}
+ method methodB2() → void {}
+ get getterB() → core::int
+ return throw 42;
+ set setterB(core::int value) → void {}
+ operator *(self::B other) → self::B
+ return throw 42;
+}
+class C extends self::B {
+ synthetic constructor •() → self::C
+ : super self::B::•()
+ ;
+}
+class D extends self::C implements self::I2<core::int, core::int, core::int> {
+ synthetic constructor •() → self::D
+ : super self::C::•()
+ ;
+ method methodD() → void {}
+ get getterD() → core::int
+ return throw 42;
+ set setterD(core::int value) → void {}
+ operator +(self::D other) → self::D
+ return throw 42;
+}
+extension type E on self::D {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.strong.transformed.expect
new file mode 100644
index 0000000..a545388
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.strong.transformed.expect
@@ -0,0 +1,50 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class I1<X extends core::Object? = dynamic, Y extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::I1<self::I1::X%, self::I1::Y%>
+ : super core::Object::•()
+ ;
+}
+class I2<X extends core::Object? = dynamic, Y extends core::Object? = dynamic, Z extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::I2<self::I2::X%, self::I2::Y%, self::I2::Z%>
+ : super core::Object::•()
+ ;
+}
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+}
+class B extends self::A implements self::I1<core::int, core::int> {
+ synthetic constructor •() → self::B
+ : super self::A::•()
+ ;
+ method methodB() → void {}
+ method methodB2() → void {}
+ get getterB() → core::int
+ return throw 42;
+ set setterB(core::int value) → void {}
+ operator *(self::B other) → self::B
+ return throw 42;
+}
+class C extends self::B {
+ synthetic constructor •() → self::C
+ : super self::B::•()
+ ;
+}
+class D extends self::C implements self::I2<core::int, core::int, core::int> {
+ synthetic constructor •() → self::D
+ : super self::C::•()
+ ;
+ method methodD() → void {}
+ get getterD() → core::int
+ return throw 42;
+ set setterD(core::int value) → void {}
+ operator +(self::D other) → self::D
+ return throw 42;
+}
+extension type E on self::D {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.textual_outline.expect
new file mode 100644
index 0000000..fe1d85f
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.textual_outline.expect
@@ -0,0 +1,19 @@
+class I1<X, Y> {}
+class I2<X, Y, Z> {}
+class A {}
+class B extends A implements I1<int, int> {
+ void methodB() {}
+ void methodB2() {}
+ int get getterB => throw 42;
+ void set setterB(int value) {}
+ B operator *(B other) => throw 42;
+}
+class C extends B {}
+class D extends C implements I2<int, int, int> {
+ void methodD() {}
+ int get getterD => throw 42;
+ void set setterD(int value) {}
+ D operator +(D other) => throw 42;
+}
+extension type E on D show C, I2<int, int, int>, methodD, get getterD, set setterD, operator + hide A, I1<int, int>, methodB, methodB2, get getterB, set setterB, operator * {}
+main() {}
diff --git a/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.weak.expect b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.weak.expect
new file mode 100644
index 0000000..a545388
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.weak.expect
@@ -0,0 +1,50 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class I1<X extends core::Object? = dynamic, Y extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::I1<self::I1::X%, self::I1::Y%>
+ : super core::Object::•()
+ ;
+}
+class I2<X extends core::Object? = dynamic, Y extends core::Object? = dynamic, Z extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::I2<self::I2::X%, self::I2::Y%, self::I2::Z%>
+ : super core::Object::•()
+ ;
+}
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+}
+class B extends self::A implements self::I1<core::int, core::int> {
+ synthetic constructor •() → self::B
+ : super self::A::•()
+ ;
+ method methodB() → void {}
+ method methodB2() → void {}
+ get getterB() → core::int
+ return throw 42;
+ set setterB(core::int value) → void {}
+ operator *(self::B other) → self::B
+ return throw 42;
+}
+class C extends self::B {
+ synthetic constructor •() → self::C
+ : super self::B::•()
+ ;
+}
+class D extends self::C implements self::I2<core::int, core::int, core::int> {
+ synthetic constructor •() → self::D
+ : super self::C::•()
+ ;
+ method methodD() → void {}
+ get getterD() → core::int
+ return throw 42;
+ set setterD(core::int value) → void {}
+ operator +(self::D other) → self::D
+ return throw 42;
+}
+extension type E on self::D {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.weak.outline.expect
new file mode 100644
index 0000000..37477da
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.weak.outline.expect
@@ -0,0 +1,50 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class I1<X extends core::Object? = dynamic, Y extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::I1<self::I1::X%, self::I1::Y%>
+ ;
+}
+class I2<X extends core::Object? = dynamic, Y extends core::Object? = dynamic, Z extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::I2<self::I2::X%, self::I2::Y%, self::I2::Z%>
+ ;
+}
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ ;
+}
+class B extends self::A implements self::I1<core::int, core::int> {
+ synthetic constructor •() → self::B
+ ;
+ method methodB() → void
+ ;
+ method methodB2() → void
+ ;
+ get getterB() → core::int
+ ;
+ set setterB(core::int value) → void
+ ;
+ operator *(self::B other) → self::B
+ ;
+}
+class C extends self::B {
+ synthetic constructor •() → self::C
+ ;
+}
+class D extends self::C implements self::I2<core::int, core::int, core::int> {
+ synthetic constructor •() → self::D
+ ;
+ method methodD() → void
+ ;
+ get getterD() → core::int
+ ;
+ set setterD(core::int value) → void
+ ;
+ operator +(self::D other) → self::D
+ ;
+}
+extension type E on self::D {
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.weak.transformed.expect
new file mode 100644
index 0000000..a545388
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/simple_show_and_hide.dart.weak.transformed.expect
@@ -0,0 +1,50 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class I1<X extends core::Object? = dynamic, Y extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::I1<self::I1::X%, self::I1::Y%>
+ : super core::Object::•()
+ ;
+}
+class I2<X extends core::Object? = dynamic, Y extends core::Object? = dynamic, Z extends core::Object? = dynamic> extends core::Object {
+ synthetic constructor •() → self::I2<self::I2::X%, self::I2::Y%, self::I2::Z%>
+ : super core::Object::•()
+ ;
+}
+class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+}
+class B extends self::A implements self::I1<core::int, core::int> {
+ synthetic constructor •() → self::B
+ : super self::A::•()
+ ;
+ method methodB() → void {}
+ method methodB2() → void {}
+ get getterB() → core::int
+ return throw 42;
+ set setterB(core::int value) → void {}
+ operator *(self::B other) → self::B
+ return throw 42;
+}
+class C extends self::B {
+ synthetic constructor •() → self::C
+ : super self::B::•()
+ ;
+}
+class D extends self::C implements self::I2<core::int, core::int, core::int> {
+ synthetic constructor •() → self::D
+ : super self::C::•()
+ ;
+ method methodD() → void {}
+ get getterD() → core::int
+ return throw 42;
+ set setterD(core::int value) → void {}
+ operator +(self::D other) → self::D
+ return throw 42;
+}
+extension type E on self::D {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_show_hide.dart.strong.expect b/pkg/front_end/testcases/extension_types/simple_show_hide.dart.strong.expect
index cfd32eb..534644b 100644
--- a/pkg/front_end/testcases/extension_types/simple_show_hide.dart.strong.expect
+++ b/pkg/front_end/testcases/extension_types/simple_show_hide.dart.strong.expect
@@ -2,99 +2,6 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E1 on int show num {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E1 on int show num {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E2 on int show num hide ceil {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Error: Expected ';' after this.
-// extension E2 on int show num hide ceil {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Error: 'num' is already declared in this scope.
-// extension E2 on int show num hide ceil {}
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:26: Context: Previous declaration of 'num'.
-// extension E1 on int show num {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:35: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E2 on int show num hide ceil {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E3 on int hide isEven {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E3 on int hide isEven {}
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:25: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:39: Error: Expected ';' after this.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:34: Error: 'num' is already declared in this scope.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Context: Previous declaration of 'num'.
-// extension E2 on int show num hide ceil {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:39: Error: 'isEven' is already declared in this scope.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:26: Context: Previous declaration of 'isEven'.
-// extension E3 on int hide isEven {}
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:51: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:21: Error: Type 'show' not found.
-// extension E1 on int show num {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:21: Error: Type 'show' not found.
-// extension E2 on int show num hide ceil {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:30: Error: Type 'hide' not found.
-// extension E2 on int show num hide ceil {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:21: Error: Type 'hide' not found.
-// extension E3 on int hide isEven {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:29: Error: Type 'show' not found.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:46: Error: Type 'hide' not found.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^
-//
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:9:3: Error: Undefined name 'e2'.
// e2.floor(); // Ok.
// ^^
@@ -109,10 +16,6 @@
// e1.isEven; // Error.
// ^^^^^^
//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:21: Error: 'show' isn't a type.
-// extension E2 on int show num hide ceil {}
-// ^^^^
-//
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:16:6: Error: The method 'ceil' isn't defined for the extension 'E2'.
// Try correcting the name to the name of an existing method, or defining a method name 'ceil'.
// e2.ceil(); // Error.
@@ -138,28 +41,6 @@
// e3.isEven; // Error.
// ^^^^^^
//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:29: Error: 'show' isn't a type.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:7: Error: Expected ';' after this.
-// int get twice => 2 * this;
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:17: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// int get twice => 2 * this;
-// ^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:24: Error: Expected identifier, but got 'this'.
-// int get twice => 2 * this;
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:34:5: Error: The getter 'twice' isn't defined for the extension 'MyInt'.
-// Try correcting the name to the name of an existing getter, or defining a getter or field named 'twice'.
-// m.twice; // OK, in the extension type.
-// ^^^^^
-//
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:35:5: Error: The getter 'isEven' isn't defined for the extension 'MyInt'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'isEven'.
// m.isEven; // OK, a shown instance member.
@@ -185,8 +66,8 @@
extension E3 on core::int {
}
extension type MyInt on core::int {
+ get twice = self::MyInt|get#twice;
}
-static method num() → invalid-type {}
static method test1(self::E1 e1) → dynamic {
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:8:6: Error: The method 'ceil' isn't defined for the extension 'E1'.
Try correcting the name to the name of an existing method, or defining a method name 'ceil'.
@@ -200,7 +81,6 @@
e1.isEven; // Error.
^^^^^^" in e1{<unresolved>}.isEven;
}
-static method ceil() → invalid-type {}
static method test2(self::E2 e2) → dynamic {
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:16:6: Error: The method 'ceil' isn't defined for the extension 'E2'.
Try correcting the name to the name of an existing method, or defining a method name 'ceil'.
@@ -215,7 +95,6 @@
e2.isEven; // Error.
^^^^^^" in e2{<unresolved>}.isEven;
}
-static method isEven() → invalid-type {}
static method test3(self::E3 e3) → dynamic {
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:24:6: Error: The getter 'isOdd' isn't defined for the extension 'E3'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'isOdd'.
@@ -226,19 +105,11 @@
e3.isEven; // Error.
^^^^^^" in e3{<unresolved>}.isEven;
}
-static method floor() → invalid-type {
- core::int get;
- function twice() → core::double
- return 2.{core::num::*}(invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:24: Error: Expected identifier, but got 'this'.
- int get twice => 2 * this;
- ^^^^"){(core::num) → core::double};
-}
+static method MyInt|get#twice(lowered final core::int #this) → core::int
+ return 2.{core::num::*}(#this){(core::num) → core::int};
static method test() → dynamic {
self::MyInt m = 42;
- invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:34:5: Error: The getter 'twice' isn't defined for the extension 'MyInt'.
-Try correcting the name to the name of an existing getter, or defining a getter or field named 'twice'.
- m.twice; // OK, in the extension type.
- ^^^^^" in m{<unresolved>}.twice;
+ self::MyInt|get#twice(m);
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:35:5: Error: The getter 'isEven' isn't defined for the extension 'MyInt'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'isEven'.
m.isEven; // OK, a shown instance member.
diff --git a/pkg/front_end/testcases/extension_types/simple_show_hide.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/simple_show_hide.dart.textual_outline.expect
index 6296476..ab59429 100644
--- a/pkg/front_end/testcases/extension_types/simple_show_hide.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/extension_types/simple_show_hide.dart.textual_outline.expect
@@ -1,15 +1,11 @@
-extension E1 on int {}
-show num (){}
+extension E1 on int show num {}
test1(E1 e1) {}
-extension E2 on int {}
-show num ;
-hide ceil (){}
+extension E2 on int show num hide ceil {}
test2(E2 e2) {}
-extension E3 on int {}
-hide isEven (){}
+extension E3 on int hide isEven {}
test3(E3 e3) {}
-extension type MyInt on int {}
-show num, isEven ;
-hide floor (){}
+extension type MyInt on int show num, isEven hide floor {
+ int get twice => 2 * this;
+}
test() {}
main() {}
diff --git a/pkg/front_end/testcases/extension_types/simple_show_hide.dart.weak.expect b/pkg/front_end/testcases/extension_types/simple_show_hide.dart.weak.expect
index cfd32eb..534644b 100644
--- a/pkg/front_end/testcases/extension_types/simple_show_hide.dart.weak.expect
+++ b/pkg/front_end/testcases/extension_types/simple_show_hide.dart.weak.expect
@@ -2,99 +2,6 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E1 on int show num {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E1 on int show num {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E2 on int show num hide ceil {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Error: Expected ';' after this.
-// extension E2 on int show num hide ceil {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Error: 'num' is already declared in this scope.
-// extension E2 on int show num hide ceil {}
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:26: Context: Previous declaration of 'num'.
-// extension E1 on int show num {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:35: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E2 on int show num hide ceil {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E3 on int hide isEven {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E3 on int hide isEven {}
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:25: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:39: Error: Expected ';' after this.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:34: Error: 'num' is already declared in this scope.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Context: Previous declaration of 'num'.
-// extension E2 on int show num hide ceil {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:39: Error: 'isEven' is already declared in this scope.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:26: Context: Previous declaration of 'isEven'.
-// extension E3 on int hide isEven {}
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:51: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:21: Error: Type 'show' not found.
-// extension E1 on int show num {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:21: Error: Type 'show' not found.
-// extension E2 on int show num hide ceil {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:30: Error: Type 'hide' not found.
-// extension E2 on int show num hide ceil {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:21: Error: Type 'hide' not found.
-// extension E3 on int hide isEven {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:29: Error: Type 'show' not found.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:46: Error: Type 'hide' not found.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^
-//
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:9:3: Error: Undefined name 'e2'.
// e2.floor(); // Ok.
// ^^
@@ -109,10 +16,6 @@
// e1.isEven; // Error.
// ^^^^^^
//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:21: Error: 'show' isn't a type.
-// extension E2 on int show num hide ceil {}
-// ^^^^
-//
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:16:6: Error: The method 'ceil' isn't defined for the extension 'E2'.
// Try correcting the name to the name of an existing method, or defining a method name 'ceil'.
// e2.ceil(); // Error.
@@ -138,28 +41,6 @@
// e3.isEven; // Error.
// ^^^^^^
//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:29: Error: 'show' isn't a type.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:7: Error: Expected ';' after this.
-// int get twice => 2 * this;
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:17: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// int get twice => 2 * this;
-// ^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:24: Error: Expected identifier, but got 'this'.
-// int get twice => 2 * this;
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:34:5: Error: The getter 'twice' isn't defined for the extension 'MyInt'.
-// Try correcting the name to the name of an existing getter, or defining a getter or field named 'twice'.
-// m.twice; // OK, in the extension type.
-// ^^^^^
-//
// pkg/front_end/testcases/extension_types/simple_show_hide.dart:35:5: Error: The getter 'isEven' isn't defined for the extension 'MyInt'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'isEven'.
// m.isEven; // OK, a shown instance member.
@@ -185,8 +66,8 @@
extension E3 on core::int {
}
extension type MyInt on core::int {
+ get twice = self::MyInt|get#twice;
}
-static method num() → invalid-type {}
static method test1(self::E1 e1) → dynamic {
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:8:6: Error: The method 'ceil' isn't defined for the extension 'E1'.
Try correcting the name to the name of an existing method, or defining a method name 'ceil'.
@@ -200,7 +81,6 @@
e1.isEven; // Error.
^^^^^^" in e1{<unresolved>}.isEven;
}
-static method ceil() → invalid-type {}
static method test2(self::E2 e2) → dynamic {
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:16:6: Error: The method 'ceil' isn't defined for the extension 'E2'.
Try correcting the name to the name of an existing method, or defining a method name 'ceil'.
@@ -215,7 +95,6 @@
e2.isEven; // Error.
^^^^^^" in e2{<unresolved>}.isEven;
}
-static method isEven() → invalid-type {}
static method test3(self::E3 e3) → dynamic {
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:24:6: Error: The getter 'isOdd' isn't defined for the extension 'E3'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'isOdd'.
@@ -226,19 +105,11 @@
e3.isEven; // Error.
^^^^^^" in e3{<unresolved>}.isEven;
}
-static method floor() → invalid-type {
- core::int get;
- function twice() → core::double
- return 2.{core::num::*}(invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:29:24: Error: Expected identifier, but got 'this'.
- int get twice => 2 * this;
- ^^^^"){(core::num) → core::double};
-}
+static method MyInt|get#twice(lowered final core::int #this) → core::int
+ return 2.{core::num::*}(#this){(core::num) → core::int};
static method test() → dynamic {
self::MyInt m = 42;
- invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:34:5: Error: The getter 'twice' isn't defined for the extension 'MyInt'.
-Try correcting the name to the name of an existing getter, or defining a getter or field named 'twice'.
- m.twice; // OK, in the extension type.
- ^^^^^" in m{<unresolved>}.twice;
+ self::MyInt|get#twice(m);
invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide.dart:35:5: Error: The getter 'isEven' isn't defined for the extension 'MyInt'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'isEven'.
m.isEven; // OK, a shown instance member.
diff --git a/pkg/front_end/testcases/extension_types/simple_show_hide.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/simple_show_hide.dart.weak.outline.expect
index 7a2b050..6962dcb 100644
--- a/pkg/front_end/testcases/extension_types/simple_show_hide.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/extension_types/simple_show_hide.dart.weak.outline.expect
@@ -1,100 +1,4 @@
library /*isNonNullableByDefault*/;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E1 on int show num {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E1 on int show num {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E2 on int show num hide ceil {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Error: Expected ';' after this.
-// extension E2 on int show num hide ceil {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Error: 'num' is already declared in this scope.
-// extension E2 on int show num hide ceil {}
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:26: Context: Previous declaration of 'num'.
-// extension E1 on int show num {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:35: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E2 on int show num hide ceil {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E3 on int hide isEven {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E3 on int hide isEven {}
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:25: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:39: Error: Expected ';' after this.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:34: Error: 'num' is already declared in this scope.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:26: Context: Previous declaration of 'num'.
-// extension E2 on int show num hide ceil {}
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:39: Error: 'isEven' is already declared in this scope.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:26: Context: Previous declaration of 'isEven'.
-// extension E3 on int hide isEven {}
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:51: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:5:21: Error: Type 'show' not found.
-// extension E1 on int show num {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:21: Error: Type 'show' not found.
-// extension E2 on int show num hide ceil {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:13:30: Error: Type 'hide' not found.
-// extension E2 on int show num hide ceil {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:21:21: Error: Type 'hide' not found.
-// extension E3 on int hide isEven {}
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:29: Error: Type 'show' not found.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide.dart:28:46: Error: Type 'hide' not found.
-// extension type MyInt on int show num, isEven hide floor {
-// ^^^^
-//
import self as self;
import "dart:core" as core;
@@ -105,20 +9,15 @@
extension E3 on core::int {
}
extension type MyInt on core::int {
+ get twice = self::MyInt|get#twice;
}
-static method num() → invalid-type
- ;
static method test1(self::E1 e1) → dynamic
;
-static method ceil() → invalid-type
- ;
static method test2(self::E2 e2) → dynamic
;
-static method isEven() → invalid-type
- ;
static method test3(self::E3 e3) → dynamic
;
-static method floor() → invalid-type
+static method MyInt|get#twice(lowered final core::int #this) → core::int
;
static method test() → dynamic
;
diff --git a/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.strong.expect b/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.strong.expect
index b62bef7..8129aa4 100644
--- a/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.strong.expect
+++ b/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.strong.expect
@@ -2,140 +2,58 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E2 on int show num hide ceil {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: Expected ';' after this.
-// extension E2 on int show num hide ceil {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: 'num' is already declared in this scope.
-// extension E2 on int show num hide ceil {
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Context: Previous declaration of 'num'.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:35: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E3 on int hide isEven {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E3 on int hide isEven {
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:21: Error: Type 'show' not found.
-// extension E1 on int show num {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: Type 'show' not found.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:30: Error: Type 'hide' not found.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:21: Error: Type 'hide' not found.
-// extension E3 on int hide isEven {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
// int ceil() {} // Error.
-// ^
+// ^
//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: 'show' isn't a type.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
// int ceil() {} // Ok.
-// ^
+// ^
//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
// int floor() {} // Error.
-// ^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Error: Expected ';' after this.
-// bool get isOdd => throw 42; // Error.
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:18: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// bool get isOdd => throw 42; // Error.
-// ^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
-// bool get isEven => throw 42; // Ok.
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Context: Previous declaration of 'get'.
-// bool get isOdd => throw 42; // Error.
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: Expected ';' after this.
-// bool get isEven => throw 42; // Ok.
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:19: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// bool get isEven => throw 42; // Ok.
-// ^^
+// ^
//
import self as self;
import "dart:core" as core;
extension E1 on core::int {
+ method ceil = self::E1|ceil;
+ tearoff ceil = self::E1|get#ceil;
}
extension E2 on core::int {
+ method ceil = self::E2|ceil;
+ tearoff ceil = self::E2|get#ceil;
+ method floor = self::E2|floor;
+ tearoff floor = self::E2|get#floor;
}
extension E3 on core::int {
+ get isOdd = self::E3|get#isOdd;
+ get isEven = self::E3|get#isEven;
}
-static method num() → invalid-type {
- function ceil() → core::int {
- return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+static method E1|ceil(lowered final core::int #this) → core::int {
+ return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
int ceil() {} // Error.
- ^" in null;
- }
+ ^" in null;
}
-static method ceil() → invalid-type {
- function ceil() → core::int {
- return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+static method E1|get#ceil(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E1|ceil(#this);
+static method E2|ceil(lowered final core::int #this) → core::int {
+ return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
int ceil() {} // Ok.
- ^" in null;
- }
- function floor() → core::int {
- return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+ ^" in null;
+}
+static method E2|get#ceil(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E2|ceil(#this);
+static method E2|floor(lowered final core::int #this) → core::int {
+ return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
int floor() {} // Error.
- ^" in null;
- }
+ ^" in null;
}
-static method isEven() → invalid-type {
- core::bool get;
- function isOdd() → Never
- return throw 42;
- core::bool get = invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
- bool get isEven => throw 42; // Ok.
- ^^^";
- function isEven() → Never
- return throw 42;
-}
+static method E2|get#floor(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E2|floor(#this);
+static method E3|get#isOdd(lowered final core::int #this) → core::bool
+ return throw 42;
+static method E3|get#isEven(lowered final core::int #this) → core::bool
+ return throw 42;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.strong.transformed.expect
index b62bef7..8129aa4 100644
--- a/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.strong.transformed.expect
@@ -2,140 +2,58 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E2 on int show num hide ceil {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: Expected ';' after this.
-// extension E2 on int show num hide ceil {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: 'num' is already declared in this scope.
-// extension E2 on int show num hide ceil {
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Context: Previous declaration of 'num'.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:35: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E3 on int hide isEven {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E3 on int hide isEven {
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:21: Error: Type 'show' not found.
-// extension E1 on int show num {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: Type 'show' not found.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:30: Error: Type 'hide' not found.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:21: Error: Type 'hide' not found.
-// extension E3 on int hide isEven {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
// int ceil() {} // Error.
-// ^
+// ^
//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: 'show' isn't a type.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
// int ceil() {} // Ok.
-// ^
+// ^
//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
// int floor() {} // Error.
-// ^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Error: Expected ';' after this.
-// bool get isOdd => throw 42; // Error.
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:18: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// bool get isOdd => throw 42; // Error.
-// ^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
-// bool get isEven => throw 42; // Ok.
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Context: Previous declaration of 'get'.
-// bool get isOdd => throw 42; // Error.
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: Expected ';' after this.
-// bool get isEven => throw 42; // Ok.
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:19: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// bool get isEven => throw 42; // Ok.
-// ^^
+// ^
//
import self as self;
import "dart:core" as core;
extension E1 on core::int {
+ method ceil = self::E1|ceil;
+ tearoff ceil = self::E1|get#ceil;
}
extension E2 on core::int {
+ method ceil = self::E2|ceil;
+ tearoff ceil = self::E2|get#ceil;
+ method floor = self::E2|floor;
+ tearoff floor = self::E2|get#floor;
}
extension E3 on core::int {
+ get isOdd = self::E3|get#isOdd;
+ get isEven = self::E3|get#isEven;
}
-static method num() → invalid-type {
- function ceil() → core::int {
- return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+static method E1|ceil(lowered final core::int #this) → core::int {
+ return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
int ceil() {} // Error.
- ^" in null;
- }
+ ^" in null;
}
-static method ceil() → invalid-type {
- function ceil() → core::int {
- return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+static method E1|get#ceil(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E1|ceil(#this);
+static method E2|ceil(lowered final core::int #this) → core::int {
+ return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
int ceil() {} // Ok.
- ^" in null;
- }
- function floor() → core::int {
- return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+ ^" in null;
+}
+static method E2|get#ceil(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E2|ceil(#this);
+static method E2|floor(lowered final core::int #this) → core::int {
+ return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
int floor() {} // Error.
- ^" in null;
- }
+ ^" in null;
}
-static method isEven() → invalid-type {
- core::bool get;
- function isOdd() → Never
- return throw 42;
- core::bool get = invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
- bool get isEven => throw 42; // Ok.
- ^^^";
- function isEven() → Never
- return throw 42;
-}
+static method E2|get#floor(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E2|floor(#this);
+static method E3|get#isOdd(lowered final core::int #this) → core::bool
+ return throw 42;
+static method E3|get#isEven(lowered final core::int #this) → core::bool
+ return throw 42;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.textual_outline.expect
index b92215c..89838f5 100644
--- a/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.textual_outline.expect
@@ -1,13 +1,12 @@
-extension E1 on int {}
-
-show num() {}
-
-extension E2 on int {}
-
-show num;
-hide ceil() {}
-
-extension E3 on int {}
-
-hide isEven() {}
+extension E1 on int show num {
+ int ceil() {}
+}
+extension E2 on int show num hide ceil {
+ int ceil() {}
+ int floor() {}
+}
+extension E3 on int hide isEven {
+ bool get isOdd => throw 42;
+ bool get isEven => throw 42;
+}
main() {}
diff --git a/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.weak.expect b/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.weak.expect
index b62bef7..8129aa4 100644
--- a/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.weak.expect
+++ b/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.weak.expect
@@ -2,140 +2,58 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E2 on int show num hide ceil {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: Expected ';' after this.
-// extension E2 on int show num hide ceil {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: 'num' is already declared in this scope.
-// extension E2 on int show num hide ceil {
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Context: Previous declaration of 'num'.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:35: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E3 on int hide isEven {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E3 on int hide isEven {
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:21: Error: Type 'show' not found.
-// extension E1 on int show num {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: Type 'show' not found.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:30: Error: Type 'hide' not found.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:21: Error: Type 'hide' not found.
-// extension E3 on int hide isEven {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
// int ceil() {} // Error.
-// ^
+// ^
//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: 'show' isn't a type.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
// int ceil() {} // Ok.
-// ^
+// ^
//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
// int floor() {} // Error.
-// ^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Error: Expected ';' after this.
-// bool get isOdd => throw 42; // Error.
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:18: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// bool get isOdd => throw 42; // Error.
-// ^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
-// bool get isEven => throw 42; // Ok.
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Context: Previous declaration of 'get'.
-// bool get isOdd => throw 42; // Error.
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: Expected ';' after this.
-// bool get isEven => throw 42; // Ok.
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:19: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// bool get isEven => throw 42; // Ok.
-// ^^
+// ^
//
import self as self;
import "dart:core" as core;
extension E1 on core::int {
+ method ceil = self::E1|ceil;
+ tearoff ceil = self::E1|get#ceil;
}
extension E2 on core::int {
+ method ceil = self::E2|ceil;
+ tearoff ceil = self::E2|get#ceil;
+ method floor = self::E2|floor;
+ tearoff floor = self::E2|get#floor;
}
extension E3 on core::int {
+ get isOdd = self::E3|get#isOdd;
+ get isEven = self::E3|get#isEven;
}
-static method num() → invalid-type {
- function ceil() → core::int {
- return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+static method E1|ceil(lowered final core::int #this) → core::int {
+ return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
int ceil() {} // Error.
- ^" in null;
- }
+ ^" in null;
}
-static method ceil() → invalid-type {
- function ceil() → core::int {
- return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+static method E1|get#ceil(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E1|ceil(#this);
+static method E2|ceil(lowered final core::int #this) → core::int {
+ return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
int ceil() {} // Ok.
- ^" in null;
- }
- function floor() → core::int {
- return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+ ^" in null;
+}
+static method E2|get#ceil(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E2|ceil(#this);
+static method E2|floor(lowered final core::int #this) → core::int {
+ return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
int floor() {} // Error.
- ^" in null;
- }
+ ^" in null;
}
-static method isEven() → invalid-type {
- core::bool get;
- function isOdd() → Never
- return throw 42;
- core::bool get = invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
- bool get isEven => throw 42; // Ok.
- ^^^";
- function isEven() → Never
- return throw 42;
-}
+static method E2|get#floor(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E2|floor(#this);
+static method E3|get#isOdd(lowered final core::int #this) → core::bool
+ return throw 42;
+static method E3|get#isEven(lowered final core::int #this) → core::bool
+ return throw 42;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.weak.outline.expect
index 5c68071..db64d10 100644
--- a/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.weak.outline.expect
@@ -1,78 +1,36 @@
library /*isNonNullableByDefault*/;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E2 on int show num hide ceil {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: Expected ';' after this.
-// extension E2 on int show num hide ceil {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: 'num' is already declared in this scope.
-// extension E2 on int show num hide ceil {
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Context: Previous declaration of 'num'.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:35: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E3 on int hide isEven {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E3 on int hide isEven {
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:21: Error: Type 'show' not found.
-// extension E1 on int show num {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: Type 'show' not found.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:30: Error: Type 'hide' not found.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:21: Error: Type 'hide' not found.
-// extension E3 on int hide isEven {
-// ^^^^
-//
import self as self;
import "dart:core" as core;
extension E1 on core::int {
+ method ceil = self::E1|ceil;
+ tearoff ceil = self::E1|get#ceil;
}
extension E2 on core::int {
+ method ceil = self::E2|ceil;
+ tearoff ceil = self::E2|get#ceil;
+ method floor = self::E2|floor;
+ tearoff floor = self::E2|get#floor;
}
extension E3 on core::int {
+ get isOdd = self::E3|get#isOdd;
+ get isEven = self::E3|get#isEven;
}
-static method num() → invalid-type
+static method E1|ceil(lowered final core::int #this) → core::int
;
-static method ceil() → invalid-type
+static method E1|get#ceil(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E1|ceil(#this);
+static method E2|ceil(lowered final core::int #this) → core::int
;
-static method isEven() → invalid-type
+static method E2|get#ceil(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E2|ceil(#this);
+static method E2|floor(lowered final core::int #this) → core::int
+ ;
+static method E2|get#floor(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E2|floor(#this);
+static method E3|get#isOdd(lowered final core::int #this) → core::bool
+ ;
+static method E3|get#isEven(lowered final core::int #this) → core::bool
;
static method main() → dynamic
;
diff --git a/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.weak.transformed.expect
index b62bef7..8129aa4 100644
--- a/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart.weak.transformed.expect
@@ -2,140 +2,58 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E2 on int show num hide ceil {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: Expected ';' after this.
-// extension E2 on int show num hide ceil {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:26: Error: 'num' is already declared in this scope.
-// extension E2 on int show num hide ceil {
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:26: Context: Previous declaration of 'num'.
-// extension E1 on int show num {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:35: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:17: Error: A extension declaration must have a body, even if it is empty.
-// Try adding an empty body.
-// extension E3 on int hide isEven {
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:26: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension E3 on int hide isEven {
-// ^^^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:5:21: Error: Type 'show' not found.
-// extension E1 on int show num {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: Type 'show' not found.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:30: Error: Type 'hide' not found.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:14:21: Error: Type 'hide' not found.
-// extension E3 on int hide isEven {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
// int ceil() {} // Error.
-// ^
+// ^
//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:9:21: Error: 'show' isn't a type.
-// extension E2 on int show num hide ceil {
-// ^^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
// int ceil() {} // Ok.
-// ^
+// ^
//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
// int floor() {} // Error.
-// ^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Error: Expected ';' after this.
-// bool get isOdd => throw 42; // Error.
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:18: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// bool get isOdd => throw 42; // Error.
-// ^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
-// bool get isEven => throw 42; // Ok.
-// ^^^
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:16:8: Context: Previous declaration of 'get'.
-// bool get isOdd => throw 42; // Error.
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: Expected ';' after this.
-// bool get isEven => throw 42; // Ok.
-// ^^^
-//
-// pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:19: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// bool get isEven => throw 42; // Ok.
-// ^^
+// ^
//
import self as self;
import "dart:core" as core;
extension E1 on core::int {
+ method ceil = self::E1|ceil;
+ tearoff ceil = self::E1|get#ceil;
}
extension E2 on core::int {
+ method ceil = self::E2|ceil;
+ tearoff ceil = self::E2|get#ceil;
+ method floor = self::E2|floor;
+ tearoff floor = self::E2|get#floor;
}
extension E3 on core::int {
+ get isOdd = self::E3|get#isOdd;
+ get isEven = self::E3|get#isEven;
}
-static method num() → invalid-type {
- function ceil() → core::int {
- return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+static method E1|ceil(lowered final core::int #this) → core::int {
+ return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:6:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
int ceil() {} // Error.
- ^" in null;
- }
+ ^" in null;
}
-static method ceil() → invalid-type {
- function ceil() → core::int {
- return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+static method E1|get#ceil(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E1|ceil(#this);
+static method E2|ceil(lowered final core::int #this) → core::int {
+ return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:10:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
int ceil() {} // Ok.
- ^" in null;
- }
- function floor() → core::int {
- return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:3: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
+ ^" in null;
+}
+static method E2|get#ceil(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E2|ceil(#this);
+static method E2|floor(lowered final core::int #this) → core::int {
+ return invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:11:7: Error: A non-null value must be returned since the return type 'int' doesn't allow null.
int floor() {} // Error.
- ^" in null;
- }
+ ^" in null;
}
-static method isEven() → invalid-type {
- core::bool get;
- function isOdd() → Never
- return throw 42;
- core::bool get = invalid-expression "pkg/front_end/testcases/extension_types/simple_show_hide_conflicts.dart:17:8: Error: 'get' is already declared in this scope.
- bool get isEven => throw 42; // Ok.
- ^^^";
- function isEven() → Never
- return throw 42;
-}
+static method E2|get#floor(lowered final core::int #this) → () → core::int
+ return () → core::int => self::E2|floor(#this);
+static method E3|get#isOdd(lowered final core::int #this) → core::bool
+ return throw 42;
+static method E3|get#isEven(lowered final core::int #this) → core::bool
+ return throw 42;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/various_hide_elements.dart b/pkg/front_end/testcases/extension_types/various_hide_elements.dart
new file mode 100644
index 0000000..cd041cd
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_hide_elements.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2021, 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' as prefixedCore;
+import 'dart:core';
+
+extension type E0 on int hide operator * {}
+extension type E1 on int hide get isEven {}
+extension type E2<T> on List<T> hide set length {}
+extension type E3 on int hide num {}
+extension type E4 on List<int> hide prefixedCore.Iterable<int> {} // Error?
+extension type E5 on List hide prefixedCore.Iterable {} // Error?
+extension type E6 on List<int> hide Iterable<int> {}
+
+abstract class A {
+ A operator *(A other);
+}
+
+class B<X> implements A {
+ bool get foo => throw 42;
+ A operator *(A other) => throw 42;
+}
+
+class C extends B<int> {
+ void set bar(int value) {}
+ void baz() {}
+}
+
+extension type E on C hide A, B<int>, operator *, get foo, set bar, baz {}
+
+main() {}
diff --git a/pkg/front_end/testcases/extension_types/various_hide_elements.dart.strong.expect b/pkg/front_end/testcases/extension_types/various_hide_elements.dart.strong.expect
new file mode 100644
index 0000000..69ddb3b
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_hide_elements.dart.strong.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "dart:core" as prefixedCore;
+import "dart:core";
+
+abstract class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ abstract operator *(self::A other) → self::A;
+}
+class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
+ synthetic constructor •() → self::B<self::B::X%>
+ : super core::Object::•()
+ ;
+ get foo() → core::bool
+ return throw 42;
+ operator *(self::A other) → self::A
+ return throw 42;
+}
+class C extends self::B<core::int> {
+ synthetic constructor •() → self::C
+ : super self::B::•()
+ ;
+ set bar(core::int value) → void {}
+ method baz() → void {}
+}
+extension type E0 on core::int {
+}
+extension type E1 on core::int {
+}
+extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
+}
+extension type E3 on core::int {
+}
+extension type E4 on core::List<core::int> {
+}
+extension type E5 on core::List<dynamic> {
+}
+extension type E6 on core::List<core::int> {
+}
+extension type E on self::C {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/various_hide_elements.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/various_hide_elements.dart.strong.transformed.expect
new file mode 100644
index 0000000..69ddb3b
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_hide_elements.dart.strong.transformed.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "dart:core" as prefixedCore;
+import "dart:core";
+
+abstract class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ abstract operator *(self::A other) → self::A;
+}
+class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
+ synthetic constructor •() → self::B<self::B::X%>
+ : super core::Object::•()
+ ;
+ get foo() → core::bool
+ return throw 42;
+ operator *(self::A other) → self::A
+ return throw 42;
+}
+class C extends self::B<core::int> {
+ synthetic constructor •() → self::C
+ : super self::B::•()
+ ;
+ set bar(core::int value) → void {}
+ method baz() → void {}
+}
+extension type E0 on core::int {
+}
+extension type E1 on core::int {
+}
+extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
+}
+extension type E3 on core::int {
+}
+extension type E4 on core::List<core::int> {
+}
+extension type E5 on core::List<dynamic> {
+}
+extension type E6 on core::List<core::int> {
+}
+extension type E on self::C {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/various_hide_elements.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/various_hide_elements.dart.textual_outline.expect
new file mode 100644
index 0000000..fbcacbf
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_hide_elements.dart.textual_outline.expect
@@ -0,0 +1,22 @@
+import 'dart:core' as prefixedCore;
+import 'dart:core';
+extension type E0 on int hide operator * {}
+extension type E1 on int hide get isEven {}
+extension type E2<T> on List<T> hide set length {}
+extension type E3 on int hide num {}
+extension type E4 on List<int> hide prefixedCore.Iterable<int> {}
+extension type E5 on List hide prefixedCore.Iterable {}
+extension type E6 on List<int> hide Iterable<int> {}
+abstract class A {
+ A operator *(A other);
+}
+class B<X> implements A {
+ bool get foo => throw 42;
+ A operator *(A other) => throw 42;
+}
+class C extends B<int> {
+ void set bar(int value) {}
+ void baz() {}
+}
+extension type E on C hide A, B<int>, operator *, get foo, set bar, baz {}
+main() {}
diff --git a/pkg/front_end/testcases/extension_types/various_hide_elements.dart.weak.expect b/pkg/front_end/testcases/extension_types/various_hide_elements.dart.weak.expect
new file mode 100644
index 0000000..69ddb3b
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_hide_elements.dart.weak.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "dart:core" as prefixedCore;
+import "dart:core";
+
+abstract class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ abstract operator *(self::A other) → self::A;
+}
+class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
+ synthetic constructor •() → self::B<self::B::X%>
+ : super core::Object::•()
+ ;
+ get foo() → core::bool
+ return throw 42;
+ operator *(self::A other) → self::A
+ return throw 42;
+}
+class C extends self::B<core::int> {
+ synthetic constructor •() → self::C
+ : super self::B::•()
+ ;
+ set bar(core::int value) → void {}
+ method baz() → void {}
+}
+extension type E0 on core::int {
+}
+extension type E1 on core::int {
+}
+extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
+}
+extension type E3 on core::int {
+}
+extension type E4 on core::List<core::int> {
+}
+extension type E5 on core::List<dynamic> {
+}
+extension type E6 on core::List<core::int> {
+}
+extension type E on self::C {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/various_hide_elements.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/various_hide_elements.dart.weak.outline.expect
new file mode 100644
index 0000000..4a47ac5
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_hide_elements.dart.weak.outline.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "dart:core" as prefixedCore;
+import "dart:core";
+
+abstract class A extends core::Object {
+ synthetic constructor •() → self::A
+ ;
+ abstract operator *(self::A other) → self::A;
+}
+class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
+ synthetic constructor •() → self::B<self::B::X%>
+ ;
+ get foo() → core::bool
+ ;
+ operator *(self::A other) → self::A
+ ;
+}
+class C extends self::B<core::int> {
+ synthetic constructor •() → self::C
+ ;
+ set bar(core::int value) → void
+ ;
+ method baz() → void
+ ;
+}
+extension type E0 on core::int {
+}
+extension type E1 on core::int {
+}
+extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
+}
+extension type E3 on core::int {
+}
+extension type E4 on core::List<core::int> {
+}
+extension type E5 on core::List<dynamic> {
+}
+extension type E6 on core::List<core::int> {
+}
+extension type E on self::C {
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/extension_types/various_hide_elements.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/various_hide_elements.dart.weak.transformed.expect
new file mode 100644
index 0000000..69ddb3b
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_hide_elements.dart.weak.transformed.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "dart:core" as prefixedCore;
+import "dart:core";
+
+abstract class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ abstract operator *(self::A other) → self::A;
+}
+class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
+ synthetic constructor •() → self::B<self::B::X%>
+ : super core::Object::•()
+ ;
+ get foo() → core::bool
+ return throw 42;
+ operator *(self::A other) → self::A
+ return throw 42;
+}
+class C extends self::B<core::int> {
+ synthetic constructor •() → self::C
+ : super self::B::•()
+ ;
+ set bar(core::int value) → void {}
+ method baz() → void {}
+}
+extension type E0 on core::int {
+}
+extension type E1 on core::int {
+}
+extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
+}
+extension type E3 on core::int {
+}
+extension type E4 on core::List<core::int> {
+}
+extension type E5 on core::List<dynamic> {
+}
+extension type E6 on core::List<core::int> {
+}
+extension type E on self::C {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/various_show_elements.dart b/pkg/front_end/testcases/extension_types/various_show_elements.dart
new file mode 100644
index 0000000..1588d78a
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_show_elements.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2021, 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' as prefixedCore;
+import 'dart:core';
+
+extension type E0 on int show operator * {}
+extension type E1 on int show get isEven {}
+extension type E2<T> on List<T> show set length {}
+extension type E3 on int show num {}
+extension type E4 on List<int> show prefixedCore.Iterable<int> {} // Error?
+extension type E5 on List show prefixedCore.Iterable {} // Error?
+extension type E6 on List<int> show Iterable<int> {}
+
+abstract class A {
+ A operator *(A other);
+}
+
+class B<X> implements A {
+ bool get foo => throw 42;
+ A operator *(A other) => throw 42;
+}
+
+class C extends B<int> {
+ void set bar(int value) {}
+ void baz() {}
+}
+
+extension type E on C show A, B<int>, operator *, get foo, set bar, baz {}
+
+main() {}
diff --git a/pkg/front_end/testcases/extension_types/various_show_elements.dart.strong.expect b/pkg/front_end/testcases/extension_types/various_show_elements.dart.strong.expect
new file mode 100644
index 0000000..69ddb3b
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_show_elements.dart.strong.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "dart:core" as prefixedCore;
+import "dart:core";
+
+abstract class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ abstract operator *(self::A other) → self::A;
+}
+class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
+ synthetic constructor •() → self::B<self::B::X%>
+ : super core::Object::•()
+ ;
+ get foo() → core::bool
+ return throw 42;
+ operator *(self::A other) → self::A
+ return throw 42;
+}
+class C extends self::B<core::int> {
+ synthetic constructor •() → self::C
+ : super self::B::•()
+ ;
+ set bar(core::int value) → void {}
+ method baz() → void {}
+}
+extension type E0 on core::int {
+}
+extension type E1 on core::int {
+}
+extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
+}
+extension type E3 on core::int {
+}
+extension type E4 on core::List<core::int> {
+}
+extension type E5 on core::List<dynamic> {
+}
+extension type E6 on core::List<core::int> {
+}
+extension type E on self::C {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/various_show_elements.dart.strong.transformed.expect b/pkg/front_end/testcases/extension_types/various_show_elements.dart.strong.transformed.expect
new file mode 100644
index 0000000..69ddb3b
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_show_elements.dart.strong.transformed.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "dart:core" as prefixedCore;
+import "dart:core";
+
+abstract class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ abstract operator *(self::A other) → self::A;
+}
+class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
+ synthetic constructor •() → self::B<self::B::X%>
+ : super core::Object::•()
+ ;
+ get foo() → core::bool
+ return throw 42;
+ operator *(self::A other) → self::A
+ return throw 42;
+}
+class C extends self::B<core::int> {
+ synthetic constructor •() → self::C
+ : super self::B::•()
+ ;
+ set bar(core::int value) → void {}
+ method baz() → void {}
+}
+extension type E0 on core::int {
+}
+extension type E1 on core::int {
+}
+extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
+}
+extension type E3 on core::int {
+}
+extension type E4 on core::List<core::int> {
+}
+extension type E5 on core::List<dynamic> {
+}
+extension type E6 on core::List<core::int> {
+}
+extension type E on self::C {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/various_show_elements.dart.textual_outline.expect b/pkg/front_end/testcases/extension_types/various_show_elements.dart.textual_outline.expect
new file mode 100644
index 0000000..dcd8445
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_show_elements.dart.textual_outline.expect
@@ -0,0 +1,22 @@
+import 'dart:core' as prefixedCore;
+import 'dart:core';
+extension type E0 on int show operator * {}
+extension type E1 on int show get isEven {}
+extension type E2<T> on List<T> show set length {}
+extension type E3 on int show num {}
+extension type E4 on List<int> show prefixedCore.Iterable<int> {}
+extension type E5 on List show prefixedCore.Iterable {}
+extension type E6 on List<int> show Iterable<int> {}
+abstract class A {
+ A operator *(A other);
+}
+class B<X> implements A {
+ bool get foo => throw 42;
+ A operator *(A other) => throw 42;
+}
+class C extends B<int> {
+ void set bar(int value) {}
+ void baz() {}
+}
+extension type E on C show A, B<int>, operator *, get foo, set bar, baz {}
+main() {}
diff --git a/pkg/front_end/testcases/extension_types/various_show_elements.dart.weak.expect b/pkg/front_end/testcases/extension_types/various_show_elements.dart.weak.expect
new file mode 100644
index 0000000..69ddb3b
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_show_elements.dart.weak.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "dart:core" as prefixedCore;
+import "dart:core";
+
+abstract class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ abstract operator *(self::A other) → self::A;
+}
+class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
+ synthetic constructor •() → self::B<self::B::X%>
+ : super core::Object::•()
+ ;
+ get foo() → core::bool
+ return throw 42;
+ operator *(self::A other) → self::A
+ return throw 42;
+}
+class C extends self::B<core::int> {
+ synthetic constructor •() → self::C
+ : super self::B::•()
+ ;
+ set bar(core::int value) → void {}
+ method baz() → void {}
+}
+extension type E0 on core::int {
+}
+extension type E1 on core::int {
+}
+extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
+}
+extension type E3 on core::int {
+}
+extension type E4 on core::List<core::int> {
+}
+extension type E5 on core::List<dynamic> {
+}
+extension type E6 on core::List<core::int> {
+}
+extension type E on self::C {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/extension_types/various_show_elements.dart.weak.outline.expect b/pkg/front_end/testcases/extension_types/various_show_elements.dart.weak.outline.expect
new file mode 100644
index 0000000..4a47ac5
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_show_elements.dart.weak.outline.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "dart:core" as prefixedCore;
+import "dart:core";
+
+abstract class A extends core::Object {
+ synthetic constructor •() → self::A
+ ;
+ abstract operator *(self::A other) → self::A;
+}
+class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
+ synthetic constructor •() → self::B<self::B::X%>
+ ;
+ get foo() → core::bool
+ ;
+ operator *(self::A other) → self::A
+ ;
+}
+class C extends self::B<core::int> {
+ synthetic constructor •() → self::C
+ ;
+ set bar(core::int value) → void
+ ;
+ method baz() → void
+ ;
+}
+extension type E0 on core::int {
+}
+extension type E1 on core::int {
+}
+extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
+}
+extension type E3 on core::int {
+}
+extension type E4 on core::List<core::int> {
+}
+extension type E5 on core::List<dynamic> {
+}
+extension type E6 on core::List<core::int> {
+}
+extension type E on self::C {
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/extension_types/various_show_elements.dart.weak.transformed.expect b/pkg/front_end/testcases/extension_types/various_show_elements.dart.weak.transformed.expect
new file mode 100644
index 0000000..69ddb3b
--- /dev/null
+++ b/pkg/front_end/testcases/extension_types/various_show_elements.dart.weak.transformed.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+import "dart:core" as prefixedCore;
+import "dart:core";
+
+abstract class A extends core::Object {
+ synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+ abstract operator *(self::A other) → self::A;
+}
+class B<X extends core::Object? = dynamic> extends core::Object implements self::A {
+ synthetic constructor •() → self::B<self::B::X%>
+ : super core::Object::•()
+ ;
+ get foo() → core::bool
+ return throw 42;
+ operator *(self::A other) → self::A
+ return throw 42;
+}
+class C extends self::B<core::int> {
+ synthetic constructor •() → self::C
+ : super self::B::•()
+ ;
+ set bar(core::int value) → void {}
+ method baz() → void {}
+}
+extension type E0 on core::int {
+}
+extension type E1 on core::int {
+}
+extension type E2<T extends core::Object? = dynamic> on core::List<T%> {
+}
+extension type E3 on core::int {
+}
+extension type E4 on core::List<core::int> {
+}
+extension type E5 on core::List<dynamic> {
+}
+extension type E6 on core::List<core::int> {
+}
+extension type E on self::C {
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue47057.dart b/pkg/front_end/testcases/general/issue47057.dart
new file mode 100644
index 0000000..8d5b88d
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue47057.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2021, 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';
+
+Future<int> foo<X extends Object?>(X x) async {
+ if (x is Future<int>) {
+ return x;
+ } else {
+ throw 42;
+ }
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue47057.dart.textual_outline.expect b/pkg/front_end/testcases/general/issue47057.dart.textual_outline.expect
new file mode 100644
index 0000000..af27955
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue47057.dart.textual_outline.expect
@@ -0,0 +1,4 @@
+import 'dart:async';
+
+Future<int> foo<X extends Object?>(X x) async {}
+main() {}
diff --git a/pkg/front_end/testcases/general/issue47057.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/issue47057.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..af27955
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue47057.dart.textual_outline_modelled.expect
@@ -0,0 +1,4 @@
+import 'dart:async';
+
+Future<int> foo<X extends Object?>(X x) async {}
+main() {}
diff --git a/pkg/front_end/testcases/general/issue47057.dart.weak.expect b/pkg/front_end/testcases/general/issue47057.dart.weak.expect
new file mode 100644
index 0000000..abd22ad
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue47057.dart.weak.expect
@@ -0,0 +1,16 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+import "dart:async";
+
+static method foo<X extends core::Object?>(self::foo::X% x) → asy::Future<core::int> async {
+ if(x is{ForNonNullableByDefault} asy::Future<core::int>) {
+ return x{self::foo::X% & asy::Future<core::int> /* '%' & '!' = '!' */};
+ }
+ else {
+ throw 42;
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue47057.dart.weak.outline.expect b/pkg/front_end/testcases/general/issue47057.dart.weak.outline.expect
new file mode 100644
index 0000000..e803dbe
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue47057.dart.weak.outline.expect
@@ -0,0 +1,11 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+import "dart:async";
+
+static method foo<X extends core::Object?>(self::foo::X% x) → asy::Future<core::int> async
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/issue47057.dart.weak.transformed.expect b/pkg/front_end/testcases/general/issue47057.dart.weak.transformed.expect
new file mode 100644
index 0000000..e2413bc
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue47057.dart.weak.transformed.expect
@@ -0,0 +1,40 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+import "dart:async";
+
+static method foo<X extends core::Object?>(self::foo::X% x) → asy::Future<core::int> /* originally async */ {
+ final asy::_Future<core::int> :async_future = new asy::_Future::•<core::int>();
+ core::bool* :is_sync = false;
+ FutureOr<core::int>? :return_value;
+ (dynamic) → dynamic :async_op_then;
+ (core::Object, core::StackTrace) → dynamic :async_op_error;
+ core::int :await_jump_var = 0;
+ dynamic :await_ctx_var;
+ function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
+ try {
+ #L1:
+ {
+ if(x is{ForNonNullableByDefault} asy::Future<core::int>) {
+ :return_value = x{self::foo::X% & asy::Future<core::int> /* '%' & '!' = '!' */};
+ break #L1;
+ }
+ else {
+ throw 42;
+ }
+ }
+ asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
+ return;
+ }
+ on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
+ asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
+ }
+ :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+ :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+ :async_op(){() → dynamic};
+ :is_sync = true;
+ return :async_future;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/incremental/changing_modules_14.yaml b/pkg/front_end/testcases/incremental/changing_modules_14.yaml
new file mode 100644
index 0000000..641accf
--- /dev/null
+++ b/pkg/front_end/testcases/incremental/changing_modules_14.yaml
@@ -0,0 +1,59 @@
+# Copyright (c) 2021, 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.md file.
+
+# Compile an application with modules compiled as outlines with constants.
+# When compiling the "real" library (as non-outline) constant evaluation
+# goes into more modules than in just the outline version.
+
+type: newworld
+# Set to DDC for compiling modules as outline.
+target: DDC
+modules:
+ moduleC:
+ moduleC/lib.dart: |
+ const constC = ['value_c'];
+ moduleC/.packages: |
+ moduleC:.
+ moduleB:
+ moduleB/lib.dart: |
+ import "package:moduleC/lib.dart";
+ const constB = ['value_b', constC];
+ moduleB/.packages: |
+ moduleB:.
+ moduleC:../moduleC
+worlds:
+ - entry: main.dart
+ fromComponent: true
+ sources:
+ main.dart: |
+ import 'package:moduleB/lib.dart';
+ import 'lib.dart';
+ const constA = ['value_a', constB];
+ const constLib = constFromLib;
+ lib.dart: |
+ const constFromLib = 42;
+ .packages: |
+ moduleB:moduleB
+ moduleC:moduleC
+ modules:
+ - moduleB
+ - moduleC
+ expectedLibraryCount: 4
+ neededDillLibraries:
+ # Because the modules are complied as outlines they haven't had constants
+ # evaluated. As this is fully compiled it does evaluate constants and thus
+ # goes into both B and C.
+ # We do not mark "lib.dart" though as it is not loaded from dill.
+ - package:moduleB/lib.dart
+ - package:moduleC/lib.dart
+ expectedContent:
+ org-dartlang-test:///main.dart:
+ - Field constA
+ - Field constLib
+ org-dartlang-test:///lib.dart:
+ - Field constFromLib
+ package:moduleB/lib.dart:
+ - Field constB
+ package:moduleC/lib.dart:
+ - Field constC
diff --git a/pkg/front_end/testcases/incremental/changing_modules_14.yaml.world.1.expect b/pkg/front_end/testcases/incremental/changing_modules_14.yaml.world.1.expect
new file mode 100644
index 0000000..ac9e649
--- /dev/null
+++ b/pkg/front_end/testcases/incremental/changing_modules_14.yaml.world.1.expect
@@ -0,0 +1,32 @@
+main = <No Member>;
+library from "org-dartlang-test:///lib.dart" as lib {
+
+ static const field dart.core::int constFromLib = #C1;
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "package:moduleB/lib.dart";
+ import "org-dartlang-test:///lib.dart";
+
+ static const field dart.core::List<dart.core::Object> constA = #C7;
+ static const field dart.core::int constLib = #C1;
+}
+library from "package:moduleB/lib.dart" as lib2 {
+
+ import "package:moduleC/lib.dart";
+
+ static const field dart.core::List<dart.core::Object*>* constB = const <dart.core::Object*>["value_b", lib3::constC];
+}
+library from "package:moduleC/lib.dart" as lib3 {
+
+ static const field dart.core::List<dart.core::String*>* constC = const <dart.core::String*>["value_c"];
+}
+constants {
+ #C1 = 42.0
+ #C2 = "value_a"
+ #C3 = "value_b"
+ #C4 = "value_c"
+ #C5 = <dart.core::String*>[#C4]
+ #C6 = <dart.core::Object*>[#C3, #C5]
+ #C7 = <dart.core::Object*>[#C2, #C6]
+}
diff --git a/pkg/front_end/testcases/incremental/changing_modules_15.yaml b/pkg/front_end/testcases/incremental/changing_modules_15.yaml
new file mode 100644
index 0000000..d0753b8
--- /dev/null
+++ b/pkg/front_end/testcases/incremental/changing_modules_15.yaml
@@ -0,0 +1,51 @@
+# Copyright (c) 2021, 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.md file.
+
+# Compile an application with modules compiled as outlines with constants.
+# When compiling the "real" library (as non-outline) constant evaluation
+# goes into more modules than in just the outline version.
+
+type: newworld
+# Set to DDC for compiling modules as outline.
+target: DDC
+modules:
+ moduleC:
+ moduleC/lib.dart: |
+ const constC = true;
+ moduleC/.packages: |
+ moduleC:.
+ moduleB:
+ moduleB/lib.dart: |
+ import "package:moduleC/lib.dart";
+ const constB = false || constC;
+ moduleB/.packages: |
+ moduleB:.
+ moduleC:../moduleC
+worlds:
+ - entry: main.dart
+ fromComponent: true
+ sources:
+ main.dart: |
+ import 'package:moduleB/lib.dart';
+ const constA = true && constB;
+ .packages: |
+ moduleB:moduleB
+ moduleC:moduleC
+ modules:
+ - moduleB
+ - moduleC
+ expectedLibraryCount: 3
+ neededDillLibraries:
+ # Because the modules are complied as outlines they haven't had constants
+ # evaluated. As this is fully compiled it does evaluate constants and thus
+ # goes into both B and C.
+ - package:moduleB/lib.dart
+ - package:moduleC/lib.dart
+ expectedContent:
+ org-dartlang-test:///main.dart:
+ - Field constA
+ package:moduleB/lib.dart:
+ - Field constB
+ package:moduleC/lib.dart:
+ - Field constC
diff --git a/pkg/front_end/testcases/incremental/changing_modules_15.yaml.world.1.expect b/pkg/front_end/testcases/incremental/changing_modules_15.yaml.world.1.expect
new file mode 100644
index 0000000..c7ef4da
--- /dev/null
+++ b/pkg/front_end/testcases/incremental/changing_modules_15.yaml.world.1.expect
@@ -0,0 +1,20 @@
+main = <No Member>;
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "package:moduleB/lib.dart";
+
+ static const field dart.core::bool constA = #C1;
+}
+library from "package:moduleB/lib.dart" as lib {
+
+ import "package:moduleC/lib.dart";
+
+ static const field dart.core::bool* constB = false || lib2::constC;
+}
+library from "package:moduleC/lib.dart" as lib2 {
+
+ static const field dart.core::bool* constC = true;
+}
+constants {
+ #C1 = true
+}
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status
index 45bfa23..1ca96b2 100644
--- a/pkg/front_end/testcases/textual_outline.status
+++ b/pkg/front_end/testcases/textual_outline.status
@@ -27,11 +27,17 @@
constructor_tearoffs/issue47075: FormatterCrash
dart2js/late_fields: FormatterCrash
dart2js/late_statics: FormatterCrash
+extension_types/basic_show: FormatterCrash
+extension_types/keyword_in_show_hide_element: FormatterCrash
extension_types/simple_getter_resolution: FormatterCrash
extension_types/simple_method_resolution: FormatterCrash
extension_types/simple_operator_resolution: FormatterCrash
extension_types/simple_setter_resolution: FormatterCrash
+extension_types/simple_show_and_hide: FormatterCrash
extension_types/simple_show_hide: FormatterCrash
+extension_types/simple_show_hide_conflicts: FormatterCrash
+extension_types/various_hide_elements: FormatterCrash
+extension_types/various_show_elements: FormatterCrash
extensions/extension_constructor: FormatterCrash
extensions/extension_field_with_type_parameter_usage: FormatterCrash
extensions/issue38600: FormatterCrash
diff --git a/pkg/front_end/testcases/weak.status b/pkg/front_end/testcases/weak.status
index 15062a3..6af034c 100644
--- a/pkg/front_end/testcases/weak.status
+++ b/pkg/front_end/testcases/weak.status
@@ -74,7 +74,6 @@
general/error_recovery/issue_39958_04: RuntimeError
general/error_recovery/yield_not_in_generator: RuntimeError
general/expressions: RuntimeError
-general/external_import: RuntimeError # The native extension to import doesn't exist. This is ok.
general/getter_vs_setter_type: TypeCheckError
general/incomplete_field_formal_parameter: RuntimeError
general/infer_field_from_multiple: TypeCheckError
diff --git a/pkg/kernel/lib/type_environment.dart b/pkg/kernel/lib/type_environment.dart
index 6b22016..5320daf 100644
--- a/pkg/kernel/lib/type_environment.dart
+++ b/pkg/kernel/lib/type_environment.dart
@@ -102,8 +102,7 @@
List<DartType>? futureArguments =
getTypeArgumentsAsInstanceOf(resolved, coreTypes.futureClass);
if (futureArguments != null) {
- return _withDeclaredNullability(
- futureArguments.single, t.declaredNullability);
+ return _withDeclaredNullability(futureArguments.single, t.nullability);
}
}
diff --git a/tools/VERSION b/tools/VERSION
index ea2e9f8..8b36375 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 87
+PRERELEASE 88
PRERELEASE_PATCH 0
\ No newline at end of file