-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dart2js] Fix type inference for record accessses on invalid indices.
Bug: 52438 Change-Id: Ic180e181142f6a33e9915f13890d9a3825a5ec0c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304380 Commit-Queue: Nate Biggs <natebiggs@google.com> Reviewed-by: Mayank Patke <fishythefish@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
- Loading branch information
Showing
2 changed files
with
24 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (c) 2023, 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. | ||
|
||
// Switches geenrate record accesses on non-existent fields. These accesses | ||
// should be guarded by a type check but Dart2JS does not always promote | ||
// correctly after the type check. | ||
|
||
void main() { | ||
Object r = (1, 2); | ||
switch (r) { | ||
case (int _, int _, int c): | ||
print('Skip, no match'); | ||
} | ||
} |