Skip to content

Commit 68c9909

Browse files
stereotype441commit-bot@chromium.org
authored andcommitted
Re-apply workaround for bug fixed by closures containing type promotions in variables with inferred types.
ba5644b fixed an analyzer bug causing a crash when a top level variable requiring type inference contained a closure involving type promotion, and removed some explicit types that were present in the analyzer to work around the bug. Although the bug has been fixed now, the fix hasn't rolled out in a release of the SDK. So to avoid people seeing analysis server crashes when editing the analyzer, I'm re-introducing the workaround. Change-Id: I5e61345021cd33cb9ad1f017a7619815a38c6a1c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95667 Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Paul Berry <[email protected]>
1 parent 68946df commit 68c9909

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

pkg/analyzer/test/util/ast_type_matchers.dart

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,18 @@ const isFieldDeclaration = const TypeMatcher<FieldDeclaration>();
111111

112112
const isFieldFormalParameter = const TypeMatcher<FieldFormalParameter>();
113113

114-
final isForEachStatement = predicate(
114+
/// TODO(paulberry): remove the explicit type `Matcher` once an SDK has been
115+
/// released that includes ba5644b76cb811e8f01ffb375b87d20d6295749c.
116+
final Matcher isForEachStatement = predicate(
115117
(Object o) => o is ForStatement2 && o.forLoopParts is ForEachParts);
116118

117119
const isFormalParameter = const TypeMatcher<FormalParameter>();
118120

119121
const isFormalParameterList = const TypeMatcher<FormalParameterList>();
120122

121-
final isForStatement =
123+
/// TODO(paulberry): remove the explicit type `Matcher` once an SDK has been
124+
/// released that includes ba5644b76cb811e8f01ffb375b87d20d6295749c.
125+
final Matcher isForStatement =
122126
predicate((Object o) => o is ForStatement2 && o.forLoopParts is ForParts);
123127

124128
const isFunctionBody = const TypeMatcher<FunctionBody>();
@@ -181,7 +185,10 @@ const isListLiteral = const TypeMatcher<ListLiteral>();
181185

182186
const isLiteral = const TypeMatcher<Literal>();
183187

184-
final isMapLiteral = predicate((Object o) => o is SetOrMapLiteral && o.isMap);
188+
/// TODO(paulberry): remove the explicit type `Matcher` once an SDK has been
189+
/// released that includes ba5644b76cb811e8f01ffb375b87d20d6295749c.
190+
final Matcher isMapLiteral =
191+
predicate((Object o) => o is SetOrMapLiteral && o.isMap);
185192

186193
const isMapLiteralEntry = const TypeMatcher<MapLiteralEntry>();
187194

@@ -236,7 +243,10 @@ const isReturnStatement = const TypeMatcher<ReturnStatement>();
236243

237244
const isScriptTag = const TypeMatcher<ScriptTag>();
238245

239-
final isSetLiteral = predicate((Object o) => o is SetOrMapLiteral && o.isSet);
246+
/// TODO(paulberry): remove the explicit type `Matcher` once an SDK has been
247+
/// released that includes ba5644b76cb811e8f01ffb375b87d20d6295749c.
248+
final Matcher isSetLiteral =
249+
predicate((Object o) => o is SetOrMapLiteral && o.isSet);
240250

241251
const isShowCombinator = const TypeMatcher<ShowCombinator>();
242252

0 commit comments

Comments
 (0)