Version 2.13.0-209.0.dev
Merge commit 'f0ccceab4d16dc0ddfc535733c30d36dcbf75699' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index 1f1e5dc..4064188 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -11,7 +11,7 @@
"constraint, update this by running tools/generate_package_config.dart."
],
"configVersion": 2,
- "generated": "2021-04-05T08:58:24.237896",
+ "generated": "2021-04-06T14:39:06.316531",
"generator": "tools/generate_package_config.dart",
"packages": [
{
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 51cf065..3fe24ae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -80,6 +80,13 @@
- unused_import
```
+#### dart format
+
+* Flatten indentation on nested chains of conditional (`?:`) operators.
+
+* Correct constructor initializer indentation after `required` named
+ parameters.
+
#### Linter
Updated the Linter to `1.2.1`, which includes:
diff --git a/DEPS b/DEPS
index 2e25552..380ac87 100644
--- a/DEPS
+++ b/DEPS
@@ -98,7 +98,7 @@
# and land the review.
#
# For more details, see https://github.com/dart-lang/sdk/issues/30164
- "dart_style_tag": "2cf810073e0cc7e7ea05d3de51830e6fa6d62924",
+ "dart_style_rev": "0067cfcc5bfa64cf59888c3fed34c71d1272555a",
"chromedriver_tag": "83.0.4103.39",
"browser_launcher_rev": "12ab9f351a44ac803de9bc17bb2180bb312a9dd7",
@@ -331,7 +331,7 @@
Var("dart_root") + "/third_party/pkg/csslib":
Var("dart_git") + "csslib.git" + "@" + Var("csslib_rev"),
Var("dart_root") + "/third_party/pkg_tested/dart_style":
- Var("dart_git") + "dart_style.git" + "@" + Var("dart_style_tag"),
+ Var("dart_git") + "dart_style.git" + "@" + Var("dart_style_rev"),
Var("dart_root") + "/third_party/pkg/dart2js_info":
Var("dart_git") + "dart2js_info.git" + "@" + Var("dart2js_info_rev"),
Var("dart_root") + "/third_party/pkg/dartdoc":
diff --git a/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart b/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart
index bf501a0..e4c7261 100644
--- a/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart
@@ -736,13 +736,8 @@
/// expression to the left hand side of the `.`, and [propertyName] should be
/// the identifier to the right hand side of the `.`. [staticType] should be
/// the static type of the value returned by the property get.
- ///
- /// [propertyMember] should be whatever data structure the client uses to keep
- /// track of the field or property being accessed. In the event of
- /// non-promotion of a property get, this value can be retrieved from
- /// [PropertyNotPromoted.propertyMember].
void propertyGet(Expression wholeExpression, Expression target,
- String propertyName, Object? propertyMember, Type staticType);
+ String propertyName, Type staticType);
/// Retrieves the SSA node associated with [variable], or `null` if [variable]
/// is not associated with an SSA node because it is write captured. For
@@ -793,13 +788,8 @@
/// the whole property get, and [propertyName] should be the name of the
/// property being read. [staticType] should be the static type of the value
/// returned by the property get.
- ///
- /// [propertyMember] should be whatever data structure the client uses to keep
- /// track of the field or property being accessed. In the event of
- /// non-promotion of a property get, this value can be retrieved from
- /// [PropertyNotPromoted.propertyMember].
- void thisOrSuperPropertyGet(Expression expression, String propertyName,
- Object? propertyMember, Type staticType);
+ void thisOrSuperPropertyGet(
+ Expression expression, String propertyName, Type staticType);
/// Call this method just before visiting the body of a "try/catch" statement.
///
@@ -1349,12 +1339,11 @@
@override
void propertyGet(Expression wholeExpression, Expression target,
- String propertyName, Object? propertyMember, Type staticType) {
+ String propertyName, Type staticType) {
_wrap(
- 'propertyGet($wholeExpression, $target, $propertyName, '
- '$propertyMember, $staticType)',
+ 'propertyGet($wholeExpression, $target, $propertyName, $staticType)',
() => _wrapped.propertyGet(
- wholeExpression, target, propertyName, propertyMember, staticType));
+ wholeExpression, target, propertyName, staticType));
}
@override
@@ -1389,13 +1378,12 @@
}
@override
- void thisOrSuperPropertyGet(Expression expression, String propertyName,
- Object? propertyMember, Type staticType) {
+ void thisOrSuperPropertyGet(
+ Expression expression, String propertyName, Type staticType) {
_wrap(
- 'thisOrSuperPropertyGet($expression, $propertyName, $propertyMember, '
- '$staticType)',
+ 'thisOrSuperPropertyGet($expression, $propertyName, $staticType)',
() => _wrapped.thisOrSuperPropertyGet(
- expression, propertyName, propertyMember, staticType));
+ expression, propertyName, staticType));
}
@override
@@ -2346,17 +2334,12 @@
/// The name of the property.
final String propertyName;
- /// The field or property being accessed. This matches a `propertyMember`
- /// value that was passed to either [FlowAnalysis.propertyGet] or
- /// [FlowAnalysis.thisOrSuperPropertyGet].
- final Object? propertyMember;
-
/// The static type of the property at the time of the access. This is the
/// type that was passed to [FlowAnalysis.whyNotPromoted]; it is provided to
/// the client as a convenience for ID testing.
final Type staticType;
- PropertyNotPromoted(this.propertyName, this.propertyMember, this.staticType);
+ PropertyNotPromoted(this.propertyName, this.staticType);
@override
String get documentationLink => 'http://dart.dev/go/non-promo-property';
@@ -2534,10 +2517,8 @@
/// Creates a reference representing a get of a property called [propertyName]
/// on the reference represented by `this`.
- Reference<Variable, Type> propertyGet(
- String propertyName, Object? propertyMember) =>
- new _PropertyGetReference<Variable, Type>(
- this, propertyName, propertyMember);
+ Reference<Variable, Type> propertyGet(String propertyName) =>
+ new _PropertyGetReference<Variable, Type>(this, propertyName);
/// Stores info for this reference in [variableInfo].
void storeInfo(Map<Variable?, VariableModel<Variable, Type>> variableInfo,
@@ -3971,14 +3952,14 @@
@override
void propertyGet(Expression wholeExpression, Expression target,
- String propertyName, Object? propertyMember, Type staticType) {
+ String propertyName, Type staticType) {
Reference<Variable, Type>? reference =
_getExpressionReference(target)?.reference;
if (reference != null) {
_storeExpressionReference(
wholeExpression,
new ReferenceWithType<Variable, Type>(
- reference.propertyGet(propertyName, propertyMember), staticType));
+ reference.propertyGet(propertyName), staticType));
}
}
@@ -4035,13 +4016,12 @@
}
@override
- void thisOrSuperPropertyGet(Expression expression, String propertyName,
- Object? propertyMember, Type staticType) {
+ void thisOrSuperPropertyGet(
+ Expression expression, String propertyName, Type staticType) {
_storeExpressionReference(
expression,
new ReferenceWithType<Variable, Type>(
- new _ThisReference<Variable, Type>()
- .propertyGet(propertyName, propertyMember),
+ new _ThisReference<Variable, Type>().propertyGet(propertyName),
staticType));
}
@@ -4706,7 +4686,7 @@
@override
void propertyGet(Expression wholeExpression, Expression target,
- String propertyName, Object? propertyMember, Type staticType) {}
+ String propertyName, Type staticType) {}
@override
SsaNode<Variable, Type>? ssaNodeForTesting(Variable variable) {
@@ -4726,8 +4706,8 @@
void thisOrSuper(Expression expression, Type staticType) {}
@override
- void thisOrSuperPropertyGet(Expression expression, String propertyName,
- Object? propertyMember, Type staticType) {}
+ void thisOrSuperPropertyGet(
+ Expression expression, String propertyName, Type staticType) {}
@override
void tryCatchStatement_bodyBegin() {}
@@ -4928,12 +4908,7 @@
/// The name of the property.
final String propertyName;
- /// The field or property being accessed. This matches a `propertyMember`
- /// value that was passed to either [FlowAnalysis.propertyGet] or
- /// [FlowAnalysis.thisOrSuperPropertyGet].
- final Object? propertyMember;
-
- _PropertyGetReference(this.target, this.propertyName, this.propertyMember);
+ _PropertyGetReference(this.target, this.propertyName);
@override
Map<Type, NonPromotionReason> Function() getNonPromotionReasons(
@@ -4945,8 +4920,7 @@
return () {
Map<Type, NonPromotionReason> result = <Type, NonPromotionReason>{};
for (Type type in promotedTypes) {
- result[type] =
- new PropertyNotPromoted(propertyName, propertyMember, staticType);
+ result[type] = new PropertyNotPromoted(propertyName, staticType);
}
return result;
};
diff --git a/pkg/_fe_analyzer_shared/test/mini_ast.dart b/pkg/_fe_analyzer_shared/test/mini_ast.dart
index fd0db4b..5e41049 100644
--- a/pkg/_fe_analyzer_shared/test/mini_ast.dart
+++ b/pkg/_fe_analyzer_shared/test/mini_ast.dart
@@ -1510,7 +1510,7 @@
Harness h, FlowAnalysis<Node, Statement, Expression, Var, Type> flow) {
var targetType = target._visit(h, flow);
var propertyType = h.getMember(targetType, propertyName);
- flow.propertyGet(this, target, propertyName, propertyName, propertyType);
+ flow.propertyGet(this, target, propertyName, propertyType);
return propertyType;
}
@@ -1614,7 +1614,7 @@
@override
Type _visit(
Harness h, FlowAnalysis<Node, Statement, Expression, Var, Type> flow) {
- flow.thisOrSuperPropertyGet(this, propertyName, propertyName, type);
+ flow.thisOrSuperPropertyGet(this, propertyName, type);
return type;
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
index 3b63d6c..aaaa182 100644
--- a/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
@@ -121,7 +121,8 @@
CompileTimeErrorCode.INVALID_ASSIGNMENT,
right,
[rightType, writeType],
- _resolver.computeWhyNotPromotedMessages(right, whyNotPromoted?.call()),
+ _resolver.computeWhyNotPromotedMessages(
+ right, right, whyNotPromoted?.call()),
);
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
index a6ab6e7..caff683 100644
--- a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
@@ -807,11 +807,7 @@
);
}
_resolver.flowAnalysis?.flow?.propertyGet(
- functionExpression,
- target,
- node.methodName.name,
- node.methodName.staticElement,
- getterReturnType);
+ functionExpression, target, node.methodName.name, getterReturnType);
functionExpression.staticType = targetType;
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
index e2d5336..8a64758 100644
--- a/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
@@ -203,8 +203,8 @@
readElementRequested = readLookup.requested;
if (readElementRequested is PropertyAccessorElement &&
!readElementRequested.isStatic) {
- _resolver.flowAnalysis?.flow?.thisOrSuperPropertyGet(node, node.name,
- readElementRequested, readElementRequested.returnType);
+ _resolver.flowAnalysis?.flow?.thisOrSuperPropertyGet(
+ node, node.name, readElementRequested.returnType);
}
_resolver.checkReadOfNotAssignedLocalVariable(node, readElementRequested);
}
@@ -373,11 +373,7 @@
nameErrorEntity: propertyName,
);
- _resolver.flowAnalysis?.flow?.propertyGet(
- node,
- target,
- propertyName.name,
- result.getter,
+ _resolver.flowAnalysis?.flow?.propertyGet(node, target, propertyName.name,
result.getter?.returnType ?? _typeSystem.typeProvider.dynamicType);
if (hasRead && result.needsGetterError) {
@@ -657,7 +653,6 @@
node,
target,
propertyName.name,
- readElement,
readElement?.returnType ?? _typeSystem.typeProvider.dynamicType);
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart
index 4ffbaaa..cff8b7e 100644
--- a/pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/type_property_resolver.dart
@@ -130,11 +130,11 @@
if (flow != null) {
if (receiver != null) {
messages = _resolver.computeWhyNotPromotedMessages(
- nameErrorEntity, flow.whyNotPromoted(receiver)());
+ receiver, nameErrorEntity, flow.whyNotPromoted(receiver)());
} else {
var thisType = _resolver.thisType;
if (thisType != null) {
- messages = _resolver.computeWhyNotPromotedMessages(
+ messages = _resolver.computeWhyNotPromotedMessages(receiver,
nameErrorEntity, flow.whyNotPromotedImplicitThis(thisType)());
}
}
diff --git a/pkg/analyzer/lib/src/error/bool_expression_verifier.dart b/pkg/analyzer/lib/src/error/bool_expression_verifier.dart
index e56e3ad..43d2462 100644
--- a/pkg/analyzer/lib/src/error/bool_expression_verifier.dart
+++ b/pkg/analyzer/lib/src/error/bool_expression_verifier.dart
@@ -57,7 +57,7 @@
errorCode: CompileTimeErrorCode
.UNCHECKED_USE_OF_NULLABLE_VALUE_AS_CONDITION,
messages: _resolver.computeWhyNotPromotedMessages(
- expression, whyNotPromoted?.call()));
+ expression, expression, whyNotPromoted?.call()));
} else {
_errorReporter.reportErrorForNode(errorCode, expression, arguments);
}
diff --git a/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart b/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart
index fb96d1b..cf1f3b5 100644
--- a/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart
+++ b/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart
@@ -76,8 +76,8 @@
List<DiagnosticMessage>? messages;
if (errorNode is Expression) {
- messages = _resolver.computeWhyNotPromotedMessages(
- errorNode, _resolver.flowAnalysis?.flow?.whyNotPromoted(errorNode)());
+ messages = _resolver.computeWhyNotPromotedMessages(errorNode, errorNode,
+ _resolver.flowAnalysis?.flow?.whyNotPromoted(errorNode)());
}
report(errorNode, receiverType, errorCode: errorCode, messages: messages);
return true;
diff --git a/pkg/analyzer/lib/src/generated/error_detection_helpers.dart b/pkg/analyzer/lib/src/generated/error_detection_helpers.dart
index ce69393..af745c8 100644
--- a/pkg/analyzer/lib/src/generated/error_detection_helpers.dart
+++ b/pkg/analyzer/lib/src/generated/error_detection_helpers.dart
@@ -85,8 +85,8 @@
}
return;
}
- var messages =
- computeWhyNotPromotedMessages(expression, whyNotPromoted?.call());
+ var messages = computeWhyNotPromotedMessages(
+ expression, expression, whyNotPromoted?.call());
// report problem
if (isConstConstructor) {
// TODO(paulberry): this error should be based on the actual type of the
@@ -229,6 +229,7 @@
/// [whyNotPromoted] should be the non-promotion details returned by the flow
/// analysis engine.
List<DiagnosticMessage> computeWhyNotPromotedMessages(
+ Expression? expression,
SyntacticEntity errorEntity,
Map<DartType, NonPromotionReason>? whyNotPromoted);
@@ -312,7 +313,8 @@
errorCode,
getErrorNode(expression),
[actualStaticType, expectedStaticType],
- computeWhyNotPromotedMessages(expression, whyNotPromoted?.call()),
+ computeWhyNotPromotedMessages(
+ expression, expression, whyNotPromoted?.call()),
);
return false;
}
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 0d097e9..9601c2e9 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -312,6 +312,7 @@
@override
List<DiagnosticMessage> computeWhyNotPromotedMessages(
+ Expression? expression,
SyntacticEntity errorEntity,
Map<DartType, NonPromotionReason>? whyNotPromoted) {
return [];
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index b878793..1a1918d 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -533,13 +533,17 @@
@override
List<DiagnosticMessage> computeWhyNotPromotedMessages(
+ Expression? expression,
SyntacticEntity errorEntity,
Map<DartType, NonPromotionReason>? whyNotPromoted) {
+ if (expression is NamedExpression) {
+ expression = expression.expression;
+ }
List<DiagnosticMessage> messages = [];
if (whyNotPromoted != null) {
for (var entry in whyNotPromoted.entries) {
var whyNotPromotedVisitor = _WhyNotPromotedVisitor(
- source, errorEntity, flowAnalysis!.dataForTesting);
+ source, expression, errorEntity, flowAnalysis!.dataForTesting);
if (typeSystem.isPotentiallyNullable(entry.key)) continue;
var message = entry.value.accept(whyNotPromotedVisitor);
if (message != null) {
@@ -3443,6 +3447,10 @@
PromotableElement, DartType> {
final Source source;
+ /// The expression that was not promoted, or `null` if the thing that was not
+ /// promoted was an implicit `this`.
+ final Expression? _expression;
+
final SyntacticEntity _errorEntity;
final FlowAnalysisDataForTesting? _dataForTesting;
@@ -3451,7 +3459,8 @@
DartType? propertyType;
- _WhyNotPromotedVisitor(this.source, this._errorEntity, this._dataForTesting);
+ _WhyNotPromotedVisitor(
+ this.source, this._expression, this._errorEntity, this._dataForTesting);
@override
DiagnosticMessage? visitDemoteViaExplicitWrite(
@@ -3471,7 +3480,18 @@
@override
DiagnosticMessage? visitPropertyNotPromoted(
PropertyNotPromoted<DartType> reason) {
- var receiverElement = reason.propertyMember;
+ var expression = _expression;
+ Element? receiverElement;
+ if (expression is SimpleIdentifier) {
+ receiverElement = expression.staticElement;
+ } else if (expression is PropertyAccess) {
+ receiverElement = expression.propertyName.staticElement;
+ } else if (expression is PrefixedIdentifier) {
+ receiverElement = expression.identifier.staticElement;
+ } else {
+ assert(false,
+ 'Unrecognized property access expression: ${expression.runtimeType}');
+ }
if (receiverElement is PropertyAccessorElement) {
propertyReference = receiverElement;
propertyType = reason.staticType;
diff --git a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
index 3458ef6..89fdd5e 100644
--- a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
@@ -1480,6 +1480,7 @@
replacement = inferrer.helper.buildProblem(
messageNullableSpreadError, receiver.fileOffset, 1,
context: inferrer.getWhyNotPromotedContext(
+ receiver,
inferrer.flowAnalysis?.whyNotPromoted(receiver)(),
element,
(type) => !type.isPotentiallyNullable));
@@ -1549,6 +1550,7 @@
replacement = inferrer.helper.buildProblem(
messageNullableSpreadError, receiver.fileOffset, 1,
context: inferrer.getWhyNotPromotedContext(
+ receiver,
inferrer.flowAnalysis?.whyNotPromoted(receiver)(),
element,
(type) => !type.isPotentiallyNullable));
@@ -1986,6 +1988,7 @@
Expression problem = inferrer.helper.buildProblem(
messageNullableSpreadError, receiver.fileOffset, 1,
context: inferrer.getWhyNotPromotedContext(
+ receiver,
inferrer.flowAnalysis?.whyNotPromoted(receiver)(),
entry,
(type) => !type.isPotentiallyNullable));
@@ -2005,6 +2008,7 @@
receiver.fileOffset,
1,
context: inferrer.getWhyNotPromotedContext(
+ receiver,
inferrer.flowAnalysis?.whyNotPromoted(receiver)(),
entry,
(type) => !type.isPotentiallyNullable));
@@ -2115,6 +2119,7 @@
keyError = inferrer.helper.buildProblem(
messageNullableSpreadError, receiver.fileOffset, 1,
context: inferrer.getWhyNotPromotedContext(
+ receiver,
inferrer.flowAnalysis?.whyNotPromoted(receiver)(),
entry,
(type) => !type.isPotentiallyNullable));
@@ -2879,9 +2884,8 @@
}
ExpressionInferenceResult readResult = _computePropertyGet(node.readOffset,
- readReceiver, receiverType, node.propertyName, const UnknownType(),
- isThisReceiver: node.receiver is ThisExpression)
- .expressionInferenceResult;
+ readReceiver, receiverType, node.propertyName, const UnknownType(),
+ isThisReceiver: node.receiver is ThisExpression);
Expression read = readResult.expression;
DartType readType = readResult.inferredType;
@@ -2937,9 +2941,8 @@
Expression writeReceiver = createVariableGet(receiverVariable);
ExpressionInferenceResult readResult = _computePropertyGet(node.readOffset,
- readReceiver, receiverType, node.propertyName, const UnknownType(),
- isThisReceiver: node.receiver is ThisExpression)
- .expressionInferenceResult;
+ readReceiver, receiverType, node.propertyName, const UnknownType(),
+ isThisReceiver: node.receiver is ThisExpression);
reportNonNullableInNullAwareWarningIfNeeded(
readResult.inferredType, "??=", node.readOffset);
@@ -4692,7 +4695,7 @@
/// [typeContext] is used to create implicit generic tearoff instantiation
/// if necessary. [isThisReceiver] must be set to `true` if the receiver is a
/// `this` expression.
- PropertyGetInferenceResult _computePropertyGet(
+ ExpressionInferenceResult _computePropertyGet(
int fileOffset,
Expression receiver,
DartType receiverType,
@@ -4876,11 +4879,12 @@
read.fileOffset,
propertyName.text.length,
context: inferrer.getWhyNotPromotedContext(
+ receiver,
inferrer.flowAnalysis?.whyNotPromoted(receiver)(),
read,
(type) => !type.isPotentiallyNullable));
}
- return new PropertyGetInferenceResult(readResult, readTarget.member);
+ return readResult;
}
/// Creates a property set operation of [writeTarget] on [receiver] using
@@ -5212,13 +5216,12 @@
DartType nonNullReceiverType = receiverType.toNonNull();
ExpressionInferenceResult readResult = _computePropertyGet(
- node.readOffset,
- readReceiver,
- nonNullReceiverType,
- node.propertyName,
- const UnknownType(),
- isThisReceiver: node.receiver is ThisExpression)
- .expressionInferenceResult;
+ node.readOffset,
+ readReceiver,
+ nonNullReceiverType,
+ node.propertyName,
+ const UnknownType(),
+ isThisReceiver: node.receiver is ThisExpression);
Expression read = readResult.expression;
DartType readType = readResult.inferredType;
@@ -5749,9 +5752,8 @@
DartType nonNullReceiverType = receiverType.toNonNull();
ExpressionInferenceResult readResult = _computePropertyGet(node.readOffset,
- readReceiver, nonNullReceiverType, node.name, typeContext,
- isThisReceiver: node.receiver is ThisExpression)
- .expressionInferenceResult;
+ readReceiver, nonNullReceiverType, node.name, typeContext,
+ isThisReceiver: node.receiver is ThisExpression);
Expression read = readResult.expression;
DartType readType = readResult.inferredType;
inferrer.flowAnalysis.ifNullExpression_rightBegin(read, readType);
@@ -5843,13 +5845,11 @@
DartType receiverType = result.nullAwareActionType;
node.receiver = receiver..parent = node;
- PropertyGetInferenceResult propertyGetInferenceResult = _computePropertyGet(
+ ExpressionInferenceResult readResult = _computePropertyGet(
node.fileOffset, receiver, receiverType, node.name, typeContext,
isThisReceiver: node.receiver is ThisExpression);
- ExpressionInferenceResult readResult =
- propertyGetInferenceResult.expressionInferenceResult;
- inferrer.flowAnalysis.propertyGet(node, node.receiver, node.name.text,
- propertyGetInferenceResult.member, readResult.inferredType);
+ inferrer.flowAnalysis.propertyGet(
+ node, node.receiver, node.name.text, readResult.inferredType);
ExpressionInferenceResult expressionInferenceResult =
inferrer.createNullAwareExpressionInferenceResult(
readResult.inferredType, readResult.expression, nullAwareGuards);
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 463c05b..15606b8 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -290,13 +290,14 @@
/// promoted, to be used when reporting an error for a larger expression
/// containing [receiver]. [node] is the containing tree node.
List<LocatedMessage> getWhyNotPromotedContext(
+ Expression receiver,
Map<DartType, NonPromotionReason> whyNotPromoted,
TreeNode node,
bool Function(DartType) typeFilter) {
List<LocatedMessage> context;
if (whyNotPromoted != null && whyNotPromoted.isNotEmpty) {
_WhyNotPromotedVisitor whyNotPromotedVisitor =
- new _WhyNotPromotedVisitor(this);
+ new _WhyNotPromotedVisitor(this, receiver);
for (core.MapEntry<DartType, NonPromotionReason> entry
in whyNotPromoted.entries) {
if (!typeFilter(entry.key)) continue;
@@ -614,6 +615,7 @@
nullabilityErrorTemplate.withArguments(expressionType,
declaredContextType ?? contextType, isNonNullableByDefault),
context: getWhyNotPromotedContext(
+ expression,
flowAnalysis?.whyNotPromoted(expression)(),
expression,
(type) => typeSchemaEnvironment.isSubtypeOf(type,
@@ -2824,6 +2826,7 @@
// void Function() get call => () {};
// }
List<LocatedMessage> context = getWhyNotPromotedContext(
+ receiver,
flowAnalysis?.whyNotPromoted(receiver)(),
staticInvocation,
(type) => !type.isPotentiallyNullable);
@@ -2855,6 +2858,7 @@
Expression replacement = result.applyResult(staticInvocation);
if (!isTopLevel && target.isNullable) {
List<LocatedMessage> context = getWhyNotPromotedContext(
+ receiver,
flowAnalysis?.whyNotPromoted(receiver)(),
staticInvocation,
(type) => !type.isPotentiallyNullable);
@@ -2968,6 +2972,7 @@
Expression replacement = result.applyResult(expression);
if (!isTopLevel && target.isNullableCallFunction) {
List<LocatedMessage> context = getWhyNotPromotedContext(
+ receiver,
flowAnalysis?.whyNotPromoted(receiver)(),
expression,
(type) => !type.isPotentiallyNullable);
@@ -3142,6 +3147,7 @@
replacement = result.applyResult(replacement);
if (!isTopLevel && target.isNullable) {
List<LocatedMessage> context = getWhyNotPromotedContext(
+ receiver,
flowAnalysis?.whyNotPromoted(receiver)(),
expression,
(type) => !type.isPotentiallyNullable);
@@ -3302,6 +3308,7 @@
// void Function() get foo => () {};
// }
List<LocatedMessage> context = getWhyNotPromotedContext(
+ receiver,
flowAnalysis?.whyNotPromoted(receiver)(),
invocationResult.expression,
(type) => !type.isPotentiallyNullable);
@@ -3458,8 +3465,8 @@
new PropertyGet(originalReceiver, originalName, originalTarget)
..fileOffset = fileOffset;
}
- flowAnalysis.propertyGet(originalPropertyGet, originalReceiver,
- originalName.text, originalTarget, calleeType);
+ flowAnalysis.propertyGet(
+ originalPropertyGet, originalReceiver, originalName.text, calleeType);
Expression propertyGet = originalPropertyGet;
if (receiver is! ThisExpression &&
calleeType is! DynamicType &&
@@ -3511,8 +3518,11 @@
// }
// TODO(paulberry): would it be better to report NullableMethodCallError
// in this scenario?
- List<LocatedMessage> context = getWhyNotPromotedContext(whyNotPromoted(),
- invocationResult.expression, (type) => !type.isPotentiallyNullable);
+ List<LocatedMessage> context = getWhyNotPromotedContext(
+ receiver,
+ whyNotPromoted(),
+ invocationResult.expression,
+ (type) => !type.isPotentiallyNullable);
invocationResult = wrapExpressionInferenceResultInProblem(
invocationResult,
templateNullableExpressionCallError.withArguments(
@@ -3843,7 +3853,7 @@
return instantiateTearOff(inferredType, typeContext, expression);
}
flowAnalysis.thisOrSuperPropertyGet(
- expression, expression.name.name, member, inferredType);
+ expression, expression.name.name, inferredType);
return new ExpressionInferenceResult(inferredType, expression);
}
@@ -4634,17 +4644,6 @@
}
}
-/// The result of inference of a property get expression.
-class PropertyGetInferenceResult {
- /// The main inference result.
- final ExpressionInferenceResult expressionInferenceResult;
-
- /// The property that was looked up, or `null` if no property was found.
- final Member member;
-
- PropertyGetInferenceResult(this.expressionInferenceResult, this.member);
-}
-
/// The result of an expression inference.
class ExpressionInferenceResult {
/// The inferred type of the expression.
@@ -5135,11 +5134,13 @@
DartType> {
final TypeInferrerImpl inferrer;
+ final Expression receiver;
+
Member propertyReference;
DartType propertyType;
- _WhyNotPromotedVisitor(this.inferrer);
+ _WhyNotPromotedVisitor(this.inferrer, this.receiver);
@override
LocatedMessage visitDemoteViaExplicitWrite(
@@ -5157,16 +5158,26 @@
@override
LocatedMessage visitPropertyNotPromoted(PropertyNotPromoted reason) {
- Object member = reason.propertyMember;
- if (member is Member) {
+ Member member;
+ Expression receiver = this.receiver;
+ if (receiver is InstanceGet) {
+ member = receiver.interfaceTarget;
+ } else if (receiver is SuperPropertyGet) {
+ member = receiver.interfaceTarget;
+ } else if (receiver is StaticInvocation) {
+ member = receiver.target;
+ } else if (receiver is PropertyGet) {
+ member = receiver.interfaceTarget;
+ } else {
+ assert(false, 'Unrecognized receiver: ${receiver.runtimeType}');
+ }
+ if (member != null) {
propertyReference = member;
propertyType = reason.staticType;
return templateFieldNotPromoted
.withArguments(reason.propertyName, reason.documentationLink)
.withLocation(member.fileUri, member.fileOffset, noLength);
} else {
- assert(member == null,
- 'Unrecognized property member: ${member.runtimeType}');
return null;
}
}
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/issue45376.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/js_semantics/issue45376.dart.textual_outline.expect
index c73f11f..3e39af0 100644
--- a/pkg/front_end/testcases/general/constants/js_semantics/issue45376.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/general/constants/js_semantics/issue45376.dart.textual_outline.expect
@@ -1,7 +1,10 @@
class MyClass {
final int a;
final int b;
- const MyClass(i1, i2) : a = (i1 >>> i2), b = (i1 >>> i2);
+ const MyClass(i1, i2)
+ : a = (i1 >>> i2),
+ b = (i1 >>> i2);
}
+
test() {}
main() {}
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/issue45376.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/js_semantics/issue45376.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..827c2fb
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/issue45376.dart.textual_outline_modelled.expect
@@ -0,0 +1,10 @@
+class MyClass {
+ const MyClass(i1, i2)
+ : a = (i1 >>> i2),
+ b = (i1 >>> i2);
+ final int a;
+ final int b;
+}
+
+main() {}
+test() {}
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/on_double.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/js_semantics/on_double.dart.textual_outline.expect
index 006bef5..186b763 100644
--- a/pkg/front_end/testcases/general/constants/js_semantics/on_double.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/general/constants/js_semantics/on_double.dart.textual_outline.expect
@@ -8,9 +8,11 @@
const dynamic d1 = 1 >> b;
const dynamic d2 = 1 >>> a;
const dynamic d3 = 1 >>> b;
+
class Class {
final int a;
const Class.doubleShift(i1, i2) : a = (i1 >> i2);
const Class.tripleShift(i1, i2) : a = (i1 >>> i2);
}
+
main() {}
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/on_double.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/js_semantics/on_double.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..6fc8f42
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/on_double.dart.textual_outline_modelled.expect
@@ -0,0 +1,17 @@
+class Class {
+ const Class.doubleShift(i1, i2) : a = (i1 >> i2);
+ const Class.tripleShift(i1, i2) : a = (i1 >>> i2);
+ final int a;
+}
+
+const dynamic a = 1.0;
+const dynamic b = 1.5;
+const dynamic c0 = a >> 1;
+const dynamic c1 = b >> 1;
+const dynamic c2 = a >>> 1;
+const dynamic c3 = b >>> 1;
+const dynamic d0 = 1 >> a;
+const dynamic d1 = 1 >> b;
+const dynamic d2 = 1 >>> a;
+const dynamic d3 = 1 >>> b;
+main() {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/aliased_checks.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/aliased_checks.dart.textual_outline.expect
index 2836a16..1e1227f 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/aliased_checks.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/aliased_checks.dart.textual_outline.expect
@@ -1,4 +1,5 @@
class A<T> {}
+
typedef B<X extends A<X>> = A<X>;
foo() {}
B<A<int>> bar1a() => throw 42;
@@ -7,16 +8,19 @@
bar2b(A<B<A<int>>> x) => throw 42;
bar3a<X extends B<A<int>>>() => throw 42;
bar3b<X extends A<B<A<int>>>>() => throw 42;
+
class Bar1<X extends B<A<int>>> {
B<A<int>> barBar11() => throw 42;
barBar12(B<A<int>> x) => throw 42;
barBar13<X extends B<A<int>>>() => throw 42;
}
+
class Bar2<X extends A<B<A<int>>>> {
A<B<A<int>>> barBar21() => throw 42;
barBar22(A<B<A<int>>> x) => throw 42;
barBar23<X extends A<B<A<int>>>>() => throw 42;
}
+
typedef Baz1 = B<A<int>>;
typedef Baz2 = A<B<A<int>>>;
main() {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/aliased_checks.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/aliased_checks.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..b492b9f
--- /dev/null
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/aliased_checks.dart.textual_outline_modelled.expect
@@ -0,0 +1,26 @@
+A<B<A<int>>> bar1b() => throw 42;
+B<A<int>> bar1a() => throw 42;
+bar2a(B<A<int>> x) => throw 42;
+bar2b(A<B<A<int>>> x) => throw 42;
+bar3a<X extends B<A<int>>>() => throw 42;
+bar3b<X extends A<B<A<int>>>>() => throw 42;
+
+class A<T> {}
+
+class Bar1<X extends B<A<int>>> {
+ B<A<int>> barBar11() => throw 42;
+ barBar12(B<A<int>> x) => throw 42;
+ barBar13<X extends B<A<int>>>() => throw 42;
+}
+
+class Bar2<X extends A<B<A<int>>>> {
+ A<B<A<int>>> barBar21() => throw 42;
+ barBar22(A<B<A<int>>> x) => throw 42;
+ barBar23<X extends A<B<A<int>>>>() => throw 42;
+}
+
+foo() {}
+main() {}
+typedef B<X extends A<X>> = A<X>;
+typedef Baz1 = B<A<int>>;
+typedef Baz2 = A<B<A<int>>>;
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/aliased_checks_in_typedef.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/aliased_checks_in_typedef.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..5455c3c
--- /dev/null
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/aliased_checks_in_typedef.dart.textual_outline_modelled.expect
@@ -0,0 +1,5 @@
+foo() {}
+main() {}
+typedef A<X extends int> = B<String>;
+typedef B<X extends int> = C<String>;
+typedef C<X extends int> = X;
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.textual_outline.expect
index 6c19416..c1f1ec1 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.textual_outline.expect
@@ -1,5 +1,6 @@
import 'dart:async';
import 'issue41501_lib.dart';
+
typedef AAliasNonNullable = A;
typedef AAliasNullable = A?;
test() {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..ed74116
--- /dev/null
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue41501.dart.textual_outline_modelled.expect
@@ -0,0 +1,7 @@
+import 'dart:async';
+import 'issue41501_lib.dart';
+
+main() {}
+test() {}
+typedef AAliasNonNullable = A;
+typedef AAliasNullable = A?;
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart.textual_outline.expect
index 611ce04..68bc621 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart.textual_outline.expect
@@ -1,8 +1,11 @@
class A<X extends A<X>> {}
+
typedef B<X extends A<X>> = A<X>;
+
class A2<X extends A2<X>> {
factory A2() => throw 42;
}
+
typedef B2<X extends A2<X>> = A2<X>;
foo() {}
main() {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..cfc9006
--- /dev/null
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue42446.dart.textual_outline_modelled.expect
@@ -0,0 +1,10 @@
+class A<X extends A<X>> {}
+
+class A2<X extends A2<X>> {
+ factory A2() => throw 42;
+}
+
+foo() {}
+main() {}
+typedef B<X extends A<X>> = A<X>;
+typedef B2<X extends A2<X>> = A2<X>;
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45051.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45051.dart.textual_outline.expect
index 08b1c6f..bbd084e 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45051.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45051.dart.textual_outline.expect
@@ -2,9 +2,12 @@
factory A() = BAlias;
factory A.named() = BAlias.named;
}
+
typedef BAlias = B;
+
class B implements A {
B();
B.named();
}
+
main() {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45051.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45051.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..c41fa7b
--- /dev/null
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45051.dart.textual_outline_modelled.expect
@@ -0,0 +1,12 @@
+class A {
+ factory A() = BAlias;
+ factory A.named() = BAlias.named;
+}
+
+class B implements A {
+ B();
+ B.named();
+}
+
+main() {}
+typedef BAlias = B;
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.textual_outline.expect
index daa08cb..4172321 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.textual_outline.expect
@@ -1,15 +1,20 @@
Type? _capturedTypeArgument;
X captureTypeArgument<X>() {}
+
class A<X extends A<X>> {}
+
typedef C<X extends A<X>> = A<X>;
void topLevel1<X extends A<X>>(A<X> Function() g) => g();
void topLevel2<X extends C<X>>(C<X> Function() g) => g();
+
class Class {
void instance1<X extends A<X>>(A<X> Function() g) => g();
void instance2<X extends C<X>>(C<X> Function() g) => g();
void test() {}
}
+
class Subclass extends Class {
void test() {}
}
+
main() {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..0f69476
--- /dev/null
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45464.dart.textual_outline_modelled.expect
@@ -0,0 +1,19 @@
+Type? _capturedTypeArgument;
+X captureTypeArgument<X>() {}
+
+class A<X extends A<X>> {}
+
+class Class {
+ void instance1<X extends A<X>>(A<X> Function() g) => g();
+ void instance2<X extends C<X>>(C<X> Function() g) => g();
+ void test() {}
+}
+
+class Subclass extends Class {
+ void test() {}
+}
+
+main() {}
+typedef C<X extends A<X>> = A<X>;
+void topLevel1<X extends A<X>>(A<X> Function() g) => g();
+void topLevel2<X extends C<X>>(C<X> Function() g) => g();
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45491.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45491.dart.textual_outline.expect
index 35e4a77..d25a92a 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45491.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45491.dart.textual_outline.expect
@@ -1,3 +1,4 @@
class A<X extends A<X>> {}
+
typedef AAlias<X> = A;
void main() {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45491.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45491.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..d25a92a
--- /dev/null
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45491.dart.textual_outline_modelled.expect
@@ -0,0 +1,4 @@
+class A<X extends A<X>> {}
+
+typedef AAlias<X> = A;
+void main() {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline.expect
index 0d8eec5..a5f4a20 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline.expect
@@ -1,4 +1,5 @@
class C<X> {}
+
typedef G<X> = X Function(X);
typedef A<X extends G<C<X>>> = C<X>;
test() {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..edec24e
--- /dev/null
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519.dart.textual_outline_modelled.expect
@@ -0,0 +1,6 @@
+class C<X> {}
+
+main() {}
+test() {}
+typedef A<X extends G<C<X>>> = C<X>;
+typedef G<X> = X Function(X);
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart.textual_outline.expect
index 329c512..acb7e9b 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart.textual_outline.expect
@@ -3,11 +3,13 @@
C.foo() {}
factory C.bar() = C;
}
+
class D<X> {
D();
factory D.foo() => new D();
factory D.bar() = D;
}
+
typedef G<X> = X Function(X);
typedef A<X extends G<C<X>>> = C<X>;
typedef B<X extends G<D<X>>> = D<X>;
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..e83da8e
--- /dev/null
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/issue45519_2.dart.textual_outline_modelled.expect
@@ -0,0 +1,17 @@
+class C<X> {
+ C.foo() {}
+ factory C() => new C.foo();
+ factory C.bar() = C;
+}
+
+class D<X> {
+ D();
+ factory D.bar() = D;
+ factory D.foo() => new D();
+}
+
+main() {}
+test() {}
+typedef A<X extends G<C<X>>> = C<X>;
+typedef B<X extends G<D<X>>> = D<X>;
+typedef G<X> = X Function(X);
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.textual_outline.expect
index fbfa19f..1c0f311 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.textual_outline.expect
@@ -1,26 +1,42 @@
import 'nullable_supertypes.dart' as prefix;
+
class A {}
+
class B {}
+
class C {}
+
typedef AAlias = A?;
typedef BAlias = B?;
typedef CAlias = C?;
typedef TAlias<T> = T?;
+
class C1 extends AAlias {}
+
class C2 implements AAlias {}
+
class C3 = A with BAlias;
class C4 = A with B implements CAlias;
+
class C5 extends A with BAlias {}
+
mixin M1 on AAlias {}
mixin M2 on A, BAlias {}
mixin M3 on A implements BAlias {}
+
class D1 extends TAlias<A> {}
+
class D1a extends prefix.TAlias<A> {}
+
class D1b extends TAlias<prefix.A> {}
+
class D2 implements TAlias<A> {}
+
class D3 = A with TAlias<B>;
class D4 = A with B implements TAlias<C>;
+
class D5 extends A with TAlias<B> {}
+
mixin N1 on TAlias<A> {}
mixin N1a on prefix.TAlias<A> {}
mixin N1b on TAlias<prefix.A> {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..85ec1fa
--- /dev/null
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/nullable_supertypes.dart.textual_outline_modelled.expect
@@ -0,0 +1,43 @@
+import 'nullable_supertypes.dart' as prefix;
+
+class A {}
+
+class B {}
+
+class C {}
+
+class C1 extends AAlias {}
+
+class C2 implements AAlias {}
+
+class C3 = A with BAlias;
+class C4 = A with B implements CAlias;
+
+class C5 extends A with BAlias {}
+
+class D1 extends TAlias<A> {}
+
+class D1a extends prefix.TAlias<A> {}
+
+class D1b extends TAlias<prefix.A> {}
+
+class D2 implements TAlias<A> {}
+
+class D3 = A with TAlias<B>;
+class D4 = A with B implements TAlias<C>;
+
+class D5 extends A with TAlias<B> {}
+
+main() {}
+mixin M1 on AAlias {}
+mixin M2 on A, BAlias {}
+mixin M3 on A implements BAlias {}
+mixin N1 on TAlias<A> {}
+mixin N1a on prefix.TAlias<A> {}
+mixin N1b on TAlias<prefix.A> {}
+mixin N2 on A, TAlias<B> {}
+mixin N3 on A implements TAlias<B> {}
+typedef AAlias = A?;
+typedef BAlias = B?;
+typedef CAlias = C?;
+typedef TAlias<T> = T?;
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/unaliased_bounds_checks_in_constructor_calls.dart.textual_outline.expect b/pkg/front_end/testcases/nonfunction_type_aliases/unaliased_bounds_checks_in_constructor_calls.dart.textual_outline.expect
index 1eab745..048066b 100644
--- a/pkg/front_end/testcases/nonfunction_type_aliases/unaliased_bounds_checks_in_constructor_calls.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/unaliased_bounds_checks_in_constructor_calls.dart.textual_outline.expect
@@ -1,4 +1,5 @@
class C<X> {}
+
typedef A<X extends num, Y> = C<X>;
foo() {}
main() {}
diff --git a/pkg/front_end/testcases/nonfunction_type_aliases/unaliased_bounds_checks_in_constructor_calls.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nonfunction_type_aliases/unaliased_bounds_checks_in_constructor_calls.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..1121072
--- /dev/null
+++ b/pkg/front_end/testcases/nonfunction_type_aliases/unaliased_bounds_checks_in_constructor_calls.dart.textual_outline_modelled.expect
@@ -0,0 +1,5 @@
+class C<X> {}
+
+foo() {}
+main() {}
+typedef A<X extends num, Y> = C<X>;
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status
index 90a00d2..408c9ce 100644
--- a/pkg/front_end/testcases/textual_outline.status
+++ b/pkg/front_end/testcases/textual_outline.status
@@ -30,10 +30,8 @@
general/bad_setter_abstract: FormatterCrash
general/bug31124: FormatterCrash
general/clone_function_type: FormatterCrash
-general/constants/js_semantics/issue45376: FormatterCrash
general/constants/js_semantics/number_folds: FormatterCrash
general/constants/js_semantics/number_folds_opt_out: FormatterCrash
-general/constants/js_semantics/on_double: FormatterCrash
general/constants/number_folds: FormatterCrash
general/constants/number_folds_opt_out: FormatterCrash
general/constants/various: FormatterCrash
@@ -129,18 +127,7 @@
nnbd_mixed/inheritance_from_opt_in: FormatterCrash
nnbd_mixed/issue41597: FormatterCrash
nnbd_mixed/null_safety_invalid_language_version: FormatterCrash
-nonfunction_type_aliases/aliased_checks: FormatterCrash
-nonfunction_type_aliases/aliased_checks_in_typedef: FormatterCrash
-nonfunction_type_aliases/issue41501: FormatterCrash
-nonfunction_type_aliases/issue42446: FormatterCrash
-nonfunction_type_aliases/issue45051: FormatterCrash
-nonfunction_type_aliases/issue45464: FormatterCrash
-nonfunction_type_aliases/issue45491: FormatterCrash
-nonfunction_type_aliases/issue45519: FormatterCrash
-nonfunction_type_aliases/issue45519_2: FormatterCrash
-nonfunction_type_aliases/nullable_supertypes: FormatterCrash
nonfunction_type_aliases/old_version: FormatterCrash
-nonfunction_type_aliases/unaliased_bounds_checks_in_constructor_calls: FormatterCrash
rasta/bad_redirection: FormatterCrash
rasta/issue_000032: FormatterCrash
rasta/issue_000034: FormatterCrash
diff --git a/tests/language/extension_methods/issue_45551_error_test.dart b/tests/language/extension_methods/issue_45551_error_test.dart
new file mode 100644
index 0000000..524b4f6
--- /dev/null
+++ b/tests/language/extension_methods/issue_45551_error_test.dart
@@ -0,0 +1,22 @@
+// 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.
+
+// This test illustrates the error scenario described in
+// https://github.com/dart-lang/sdk/issues/45551
+
+class C {}
+
+extension on C {
+ void Function() get call => () {};
+}
+
+test(C c) {
+ c();
+//^
+// [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION
+// ^
+// [cfe] Cannot invoke an instance of 'C' because it declares 'call' to be something other than a method.
+}
+
+main() {}
diff --git a/tests/language/why_not_promoted/nullable_expression_call_error_test.dart b/tests/language/why_not_promoted/nullable_expression_call_error_test.dart
index e1f286a..46413a9 100644
--- a/tests/language/why_not_promoted/nullable_expression_call_error_test.dart
+++ b/tests/language/why_not_promoted/nullable_expression_call_error_test.dart
@@ -79,32 +79,19 @@
}
class C8 {
- C9? ok;
C10? bad;
// ^^^
// [context 4] 'bad' refers to a property so it couldn't be promoted. See http://dart.dev/go/non-promo-property
// [context 10] 'bad' refers to a property so it couldn't be promoted.
}
-class C9 {}
-
class C10 {}
-extension on C9? {
- void Function() get call => () {};
-}
-
extension on C10 {
void Function() get call => () {};
}
extension_invocation_getter(C8 c) {
- if (c.ok == null) return;
- // Note: the analyzer produces an extraneous error on the line below due to
- // https://github.com/dart-lang/sdk/issues/45551
- c.ok();
-//^^^^
-// [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION
if (c.bad == null) return;
c.bad();
//^^^^^
diff --git a/tests/language_2/extension_methods/issue_45551_error_test.dart b/tests/language_2/extension_methods/issue_45551_error_test.dart
new file mode 100644
index 0000000..524b4f6
--- /dev/null
+++ b/tests/language_2/extension_methods/issue_45551_error_test.dart
@@ -0,0 +1,22 @@
+// 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.
+
+// This test illustrates the error scenario described in
+// https://github.com/dart-lang/sdk/issues/45551
+
+class C {}
+
+extension on C {
+ void Function() get call => () {};
+}
+
+test(C c) {
+ c();
+//^
+// [analyzer] COMPILE_TIME_ERROR.INVOCATION_OF_NON_FUNCTION_EXPRESSION
+// ^
+// [cfe] Cannot invoke an instance of 'C' because it declares 'call' to be something other than a method.
+}
+
+main() {}
diff --git a/tools/VERSION b/tools/VERSION
index 9bcc89c..240c7a8 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 13
PATCH 0
-PRERELEASE 208
+PRERELEASE 209
PRERELEASE_PATCH 0
\ No newline at end of file