Skip to content

Commit c6ae757

Browse files
kallentuCommit Queue
authored and
Commit Queue
committed
[wildcard-variables] Add tests for const behaviour.
Missing a few cases for interactions between wildcard variables and const. Bug: #55652 Change-Id: I4ae1ca0041b5b8ca3c24ab866bd9d8e19832ef2e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382963 Commit-Queue: Kallen Tu <[email protected]> Reviewed-by: Bob Nystrom <[email protected]>
1 parent 8035376 commit c6ae757

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/language/wildcard_variables/multiple/local_declaration_local_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ void main() {
2222

2323
late final int _;
2424
late final int _ = 2;
25+
26+
const int _ = 2;
2527
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// Tests that top-level const variables are still binding.
6+
7+
// SharedOptions=--enable-experiment=wildcard-variables
8+
9+
import 'package:expect/expect.dart';
10+
11+
const _ = 100;
12+
13+
void main() {
14+
var _ = 1;
15+
int _ = 2;
16+
final _ = 3;
17+
late int _ = 4;
18+
const int _ = 5;
19+
20+
Expect.equals(100, _);
21+
}

0 commit comments

Comments
 (0)