| // Copyright (c) 2024, 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. |
| |
| // Test the interactions between a wildcard class members, which are binding, |
| // with local non-binding wildcard variables. |
| |
| // SharedOptions=--enable-experiment=wildcard-variables |
| |
| import 'package:expect/expect.dart'; |
| |
| void main() { |
| InstanceMember().member(); |
| StaticMember().member(); |
| } |
| |
| class InstanceMember { |
| var _ = 2; |
| |
| void member<_, _>() { |
| int _ = _; |
| int _ = 2; |
| const _ = 2; |
| int _() => 2; |
| var (_, _) = (3, '4'); |
| Expect.equals(2, _); |
| |
| _ = 4; |
| Expect.equals(4, _); |
| |
| int foo<_>([int _ = 5]) => _; |
| Expect.equals(4, foo()); |
| } |
| } |
| |
| class StaticMember { |
| static const _ = 2; |
| |
| void member<_, _>() { |
| int _ = _; |
| int _ = 2; |
| const _ = 2; |
| const _ = _ - 1; |
| int _() => 2; |
| var (_, _) = (3, '4'); |
| Expect.equals(2, _); |
| |
| int foo<_>([int _ = _ + 1]) => _; |
| Expect.equals(2, foo()); |
| } |
| } |