Skip to content

Commit c15cdb9

Browse files
author
Dart CI
committed
Version 2.19.0-377.0.dev
Merge 6a249fd into dev
2 parents 292fcf7 + 6a249fd commit c15cdb9

File tree

409 files changed

+12048
-2793
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

409 files changed

+12048
-2793
lines changed

CHANGELOG.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,48 @@
161161

162162
#### Linter
163163

164-
Updated the Linter to `1.28.0`, which includes changes that
165-
164+
Updated the Linter to `1.29.0`, which includes changes that
165+
166+
- add new lint: `dangling_library_doc_comments`.
167+
- fix `no_leading_underscores_for_local_identifiers` to not report super formals
168+
as local variables.
169+
- fix `unnecessary_overrides` false negatives.
170+
- fix `cancel_subscriptions` for nullable fields.
171+
- add new lint: `collection_methods_unrelated_type`.
172+
- update `library_names` to support unnamed libraries.
173+
- fix `unnecessary_parenthesis` support for as-expressions.
174+
- fix `use_build_context_synchronously` to check for context property accesses.
175+
- fix false positive in `comment_references`.
176+
- improved unrelated type checks to handle enums and cascades.
177+
- fix `unnecessary_brace_in_string_interps` for `this` expressions .
178+
- update `use_build_context_synchronously` for `BuildContext.mounted`.
179+
- improve `flutter_style_todos` to handle more cases.
180+
- fix `use_build_context_synchronously` to check for `BuildContext`s in named
181+
expressions.
182+
- fix `exhaustive_cases` to check parenthesized expressions
183+
- improves performance for:
184+
- `avoid_null_checks_in_equality_operators`.
185+
- `join_return_with_statement`.
186+
- `recursive_getters`.
187+
- `unnecessary_lambdas`.
188+
- `diagnostic_describe_all_properties`.
189+
- `prefer_foreach`.
190+
- `avoid_escaping_inner_quotes`.
191+
- `cascade_invocations`.
192+
- `tighten_type_of_initializing_formals`.
193+
- `prefer_interpolation_to_compose_strings`.
194+
- `prefer_constructors_over_static_methods`.
195+
- `avoid_returning_null`.
196+
- `parameter_assignments`.
197+
- `prefer_constructors_over_static_methods`.
198+
- `prefer_interpolation_to_compose_strings`.
199+
- `avoid_returning_null`.
200+
- `avoid_returning_this`.
201+
- `flutter_style_todos`.
202+
- `avoid_positional_boolean_parameters`.
203+
- `prefer_const_constructors`.
204+
- add new lint: `implicit_call_tearoffs`.
205+
- add new lint: `unnecessary_library_directive`.
166206
- update `avoid_redundant_argument_values` to work with enum declarations.
167207
- improve performance for `prefer_contains`.
168208
- add new lint: `unreachable_from_main`.

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ vars = {
136136
"intl_rev": "442193ccd19a8e36a07fcc3b3cac0e58c6f9c542",
137137
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
138138
"json_rpc_2_rev": "805e6536dd961d66f6b8cd46d8f3e61774f957c9",
139-
"linter_rev": "f2c55484e8ebda0aec8c2fea637b3bd5b17258ca", # 1.28.0
139+
"linter_rev": "657fa6d60373c144777ddb3ca0ab6ee7805ea2b3", # 1.29.0
140140
"lints_rev": "16bdefe1df529262a6596f79e91003ddbdbd3890",
141141
"logging_rev": "f322480fb9d9e83e677c08db6d09067059f7ff74",
142142
"markdown_rev": "9ff4a9f1d37c763f827084ba28a3d0bfec6b5d67",

pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5534,6 +5534,76 @@ const MessageCode messageImportAfterPart = const MessageCode("ImportAfterPart",
55345534
correctionMessage:
55355535
r"""Try moving the import directives before the part directives.""");
55365536

5537+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
5538+
const Template<
5539+
Message Function(
5540+
Uri uri_,
5541+
String string,
5542+
String
5543+
string2)> templateImportChainContext = const Template<
5544+
Message Function(Uri uri_, String string, String string2)>(
5545+
problemMessageTemplate:
5546+
r"""The unavailable library '#uri' is imported through these packages:
5547+
5548+
#string
5549+
Detailed import paths for (some of) the these imports:
5550+
5551+
#string2""",
5552+
withArguments: _withArgumentsImportChainContext);
5553+
5554+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
5555+
const Code<Message Function(Uri uri_, String string, String string2)>
5556+
codeImportChainContext =
5557+
const Code<Message Function(Uri uri_, String string, String string2)>(
5558+
"ImportChainContext",
5559+
severity: Severity.context);
5560+
5561+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
5562+
Message _withArgumentsImportChainContext(
5563+
Uri uri_, String string, String string2) {
5564+
String? uri = relativizeUri(uri_);
5565+
if (string.isEmpty) throw 'No string provided';
5566+
if (string2.isEmpty) throw 'No string provided';
5567+
return new Message(codeImportChainContext,
5568+
problemMessage:
5569+
"""The unavailable library '${uri}' is imported through these packages:
5570+
5571+
${string}
5572+
Detailed import paths for (some of) the these imports:
5573+
5574+
${string2}""",
5575+
arguments: {'uri': uri_, 'string': string, 'string2': string2});
5576+
}
5577+
5578+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
5579+
const Template<Message Function(Uri uri_, String string)>
5580+
templateImportChainContextSimple =
5581+
const Template<Message Function(Uri uri_, String string)>(
5582+
problemMessageTemplate:
5583+
r"""The unavailable library '#uri' is imported through these paths:
5584+
5585+
#string""",
5586+
withArguments: _withArgumentsImportChainContextSimple);
5587+
5588+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
5589+
const Code<Message Function(Uri uri_, String string)>
5590+
codeImportChainContextSimple =
5591+
const Code<Message Function(Uri uri_, String string)>(
5592+
"ImportChainContextSimple",
5593+
severity: Severity.context);
5594+
5595+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
5596+
Message _withArgumentsImportChainContextSimple(Uri uri_, String string) {
5597+
String? uri = relativizeUri(uri_);
5598+
if (string.isEmpty) throw 'No string provided';
5599+
return new Message(codeImportChainContextSimple,
5600+
problemMessage:
5601+
"""The unavailable library '${uri}' is imported through these paths:
5602+
5603+
${string}""",
5604+
arguments: {'uri': uri_, 'string': string});
5605+
}
5606+
55375607
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
55385608
const Code<Null> codeIncorrectTypeArgumentVariable =
55395609
messageIncorrectTypeArgumentVariable;
@@ -11517,6 +11587,27 @@ const MessageCode messageTypedefUnaliasedTypeCause = const MessageCode(
1151711587
severity: Severity.context,
1151811588
problemMessage: r"""This is the type denoted by the type alias.""");
1151911589

11590+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
11591+
const Template<Message Function(Uri uri_)> templateUnavailableDartLibrary =
11592+
const Template<Message Function(Uri uri_)>(
11593+
problemMessageTemplate:
11594+
r"""Dart library '#uri' is not available on this platform.""",
11595+
withArguments: _withArgumentsUnavailableDartLibrary);
11596+
11597+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
11598+
const Code<Message Function(Uri uri_)> codeUnavailableDartLibrary =
11599+
const Code<Message Function(Uri uri_)>("UnavailableDartLibrary",
11600+
analyzerCodes: <String>["URI_DOES_NOT_EXIST"]);
11601+
11602+
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
11603+
Message _withArgumentsUnavailableDartLibrary(Uri uri_) {
11604+
String? uri = relativizeUri(uri_);
11605+
return new Message(codeUnavailableDartLibrary,
11606+
problemMessage:
11607+
"""Dart library '${uri}' is not available on this platform.""",
11608+
arguments: {'uri': uri_});
11609+
}
11610+
1152011611
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
1152111612
const Code<Null> codeUnexpectedDollarInString = messageUnexpectedDollarInString;
1152211613

pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart

Lines changed: 75 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,60 @@ mixin TypeAnalyzer<
572572
}
573573
}
574574

575+
/// Analyzes an object pattern. [node] is the pattern itself, and [fields]
576+
/// is the list of subpatterns. The [requiredType] must be not `null` in
577+
/// irrefutable contexts, but can be `null` in refutable contexts, then
578+
/// [downwardInferObjectPatternRequiredType] is invoked to infer the type.
579+
///
580+
/// See [dispatchPattern] for the meanings of [matchedType], [typeInfos], and
581+
/// [context].
582+
///
583+
/// Stack effect: pushes (n * Pattern) where n = fields.length.
584+
Type analyzeObjectPattern(
585+
Type matchedType,
586+
Map<Variable, VariableTypeInfo<Pattern, Type>> typeInfos,
587+
MatchContext<Node, Expression> context,
588+
Pattern node, {
589+
required Type? requiredType,
590+
required List<RecordPatternField<Pattern>> fields,
591+
}) {
592+
requiredType ??= downwardInferObjectPatternRequiredType(
593+
matchedType: matchedType,
594+
pattern: node,
595+
);
596+
597+
Node? irrefutableContext = context.irrefutableContext;
598+
if (irrefutableContext != null &&
599+
!typeOperations.isAssignableTo(matchedType, requiredType)) {
600+
errors?.patternTypeMismatchInIrrefutableContext(
601+
pattern: node,
602+
context: irrefutableContext,
603+
matchedType: matchedType,
604+
requiredType: requiredType,
605+
);
606+
}
607+
608+
// Stack: ()
609+
for (RecordPatternField<Pattern> field in fields) {
610+
Type propertyType = resolveObjectPatternPropertyGet(
611+
receiverType: requiredType,
612+
field: field,
613+
);
614+
dispatchPattern(propertyType, typeInfos, context, field.pattern);
615+
}
616+
// Stack: (n * Pattern) where n = fields.length
617+
618+
return requiredType;
619+
}
620+
621+
/// Computes the type schema for an object pattern. [type] is the type
622+
/// specified with the object name, and with the type arguments applied.
623+
///
624+
/// Stack effect: none.
625+
Type analyzeObjectPatternSchema(Type type) {
626+
return type;
627+
}
628+
575629
/// Analyzes a record pattern. [node] is the pattern itself, and [fields]
576630
/// is the list of subpatterns.
577631
///
@@ -584,9 +638,9 @@ mixin TypeAnalyzer<
584638
Map<Variable, VariableTypeInfo<Pattern, Type>> typeInfos,
585639
MatchContext<Node, Expression> context,
586640
Pattern node, {
587-
required List<RecordPatternField<Node>> fields,
641+
required List<RecordPatternField<Pattern>> fields,
588642
}) {
589-
void dispatchField(RecordPatternField<Node> field, Type matchedType) {
643+
void dispatchField(RecordPatternField<Pattern> field, Type matchedType) {
590644
dispatchPattern(matchedType, typeInfos, context, field.pattern);
591645
}
592646

@@ -599,7 +653,7 @@ mixin TypeAnalyzer<
599653
// Build the required type.
600654
int requiredTypePositionalCount = 0;
601655
List<NamedType<Type>> requiredTypeNamedTypes = [];
602-
for (RecordPatternField<Node> field in fields) {
656+
for (RecordPatternField<Pattern> field in fields) {
603657
String? name = field.name;
604658
if (name == null) {
605659
requiredTypePositionalCount++;
@@ -655,11 +709,11 @@ mixin TypeAnalyzer<
655709
///
656710
/// Stack effect: none.
657711
Type analyzeRecordPatternSchema({
658-
required List<RecordPatternField<Node>> fields,
712+
required List<RecordPatternField<Pattern>> fields,
659713
}) {
660714
List<Type> positional = [];
661715
List<NamedType<Type>> named = [];
662-
for (RecordPatternField<Node> field in fields) {
716+
for (RecordPatternField<Pattern> field in fields) {
663717
Type fieldType = dispatchPatternSchema(field.pattern);
664718
String? name = field.name;
665719
if (name != null) {
@@ -1031,6 +1085,12 @@ mixin TypeAnalyzer<
10311085
/// Stack effect: pushes (Statement).
10321086
void dispatchStatement(Statement statement);
10331087

1088+
/// Infers the type for the [pattern], should be a subtype of [matchedType].
1089+
Type downwardInferObjectPatternRequiredType({
1090+
required Type matchedType,
1091+
required Pattern pattern,
1092+
});
1093+
10341094
/// Called after visiting an expression case.
10351095
///
10361096
/// [node] is the enclosing switch expression, and [caseIndex] is the index of
@@ -1155,6 +1215,14 @@ mixin TypeAnalyzer<
11551215
/// Builds the client specific record type.
11561216
Type recordType(RecordType<Type> type);
11571217

1218+
/// Returns the type of the property in [receiverType] that corresponds to
1219+
/// the name of the [field]. If the property cannot be resolved, the client
1220+
/// should report an error, and return `dynamic` for recovery.
1221+
Type resolveObjectPatternPropertyGet({
1222+
required Type receiverType,
1223+
required RecordPatternField<Pattern> field,
1224+
});
1225+
11581226
/// Records that type inference has assigned a [type] to a [variable]. This
11591227
/// is called once per variable, regardless of whether the variable's type is
11601228
/// explicit or inferred.
@@ -1199,7 +1267,7 @@ mixin TypeAnalyzer<
11991267
/// [matchedType], returns matched types for each field in [fields].
12001268
/// Otherwise returns `null`.
12011269
List<Type>? _matchRecordTypeShape(
1202-
List<RecordPatternField<Node>> fields,
1270+
List<RecordPatternField<Pattern>> fields,
12031271
RecordType<Type> matchedType,
12041272
) {
12051273
Map<String, Type> matchedTypeNamed = {};
@@ -1210,7 +1278,7 @@ mixin TypeAnalyzer<
12101278
List<Type> result = [];
12111279
int positionalIndex = 0;
12121280
int namedCount = 0;
1213-
for (RecordPatternField<Node> field in fields) {
1281+
for (RecordPatternField<Pattern> field in fields) {
12141282
Type? fieldType;
12151283
String? name = field.name;
12161284
if (name != null) {

0 commit comments

Comments
 (0)