Skip to content

Commit 2b6909b

Browse files
author
Dart CI
committed
Version 2.19.0-390.0.dev
Merge 3ab1161 into dev
2 parents 1e37edb + 3ab1161 commit 2b6909b

File tree

29 files changed

+432
-563
lines changed

29 files changed

+432
-563
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
- Deprecated `RangeError.checkValidIndex` in favor of `IndexError.check`.
7070
- Deprecated `IndexError` constructor in favor of `IndexError.withLength`
7171
constructor.
72+
- `ServerSocket` and `SecureServerSocket` implement `ServerSocketBase`.
7273

7374
[#49529]: https://github.com/dart-lang/sdk/issues/49529
7475
[#24644]: https://github.com/dart-lang/sdk/issues/24644

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

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,8 @@ class IntTypeAnalysisResult<Type extends Object>
3939
}
4040

4141
/// Information about the code context surrounding a pattern match.
42-
class MatchContext<Node extends Object, Expression extends Node> {
43-
/// Simple case where the match context is non-final and there's nothing else
44-
/// special going on.
45-
static const MatchContext<Never, Never> simpleNonFinal =
46-
const MatchContext(isFinal: false, topPattern: null);
47-
42+
class MatchContext<Node extends Object, Expression extends Node,
43+
Pattern extends Node, Type extends Object, Variable extends Object> {
4844
/// If non-`null`, the match is being done in an irrefutable context, and this
4945
/// is the surrounding AST node that establishes the irrefutable context.
5046
final Node? irrefutableContext;
@@ -67,43 +63,45 @@ class MatchContext<Node extends Object, Expression extends Node> {
6763
/// statement or switch expression.
6864
final Expression? _switchScrutinee;
6965

66+
/// A data structure keeping track of the variable patterns seen so far and
67+
/// their type information.
68+
final Map<Variable, VariableTypeInfo<Pattern, Type>> typeInfos;
69+
7070
const MatchContext(
7171
{Expression? initializer,
7272
this.irrefutableContext,
7373
required this.isFinal,
7474
this.isLate = false,
7575
Expression? switchScrutinee,
76-
required this.topPattern})
76+
required this.topPattern,
77+
required this.typeInfos})
7778
: _initializer = initializer,
7879
_switchScrutinee = switchScrutinee;
7980

8081
/// If the pattern [pattern] is the [topPattern] and there is a corresponding
8182
/// initializer expression, returns it. Otherwise returns `null`.
82-
///
83-
/// Note: the type of [pattern] is `Object` to avoid a runtime covariance
84-
/// check (which would fail if this method is called on [simpleNonFinal]).
85-
Expression? getInitializer(Object pattern) =>
83+
Expression? getInitializer(Pattern pattern) =>
8684
identical(pattern, topPattern) ? _initializer : null;
8785

8886
/// If the pattern [pattern] is the [topPattern] and there is a corresponding
8987
/// switch scrutinee expression, returns it. Otherwise returns `null`.
90-
///
91-
/// Note: the type of [pattern] is `Object` to avoid a runtime covariance
92-
/// check (which would fail if this method is called on [simpleNonFinal]).
93-
Expression? getSwitchScrutinee(Object pattern) =>
88+
Expression? getSwitchScrutinee(Node pattern) =>
9489
identical(pattern, topPattern) ? _switchScrutinee : null;
9590

9691
/// Returns a modified version of `this`, with [irrefutableContext] set to
9792
/// `null`. This is used to suppress cascading errors after reporting
9893
/// [TypeAnalyzerErrors.refutablePatternInIrrefutableContext].
99-
MatchContext<Node, Expression> makeRefutable() => irrefutableContext == null
100-
? this
101-
: new MatchContext(
102-
initializer: _initializer,
103-
isFinal: isFinal,
104-
isLate: isLate,
105-
switchScrutinee: _switchScrutinee,
106-
topPattern: topPattern);
94+
MatchContext<Node, Expression, Pattern, Type, Variable> makeRefutable() =>
95+
irrefutableContext == null
96+
? this
97+
: new MatchContext(
98+
initializer: _initializer,
99+
isFinal: isFinal,
100+
isLate: isLate,
101+
switchScrutinee: _switchScrutinee,
102+
topPattern: topPattern,
103+
typeInfos: typeInfos,
104+
);
107105
}
108106

109107
/// Container for the result of running type analysis on an expression that does

0 commit comments

Comments
 (0)