Files
sdk/pkg/front_end/testcases/patterns/pattern_variable_const.dart
T
Johnni Winther 734c01da41 [cfe][PrimaryConstructors] Handle assignment to primary constructor parameter
This reports an error on assignment to primary constructor parameters in field initializers and initializer lists.

The change includes a rewrite of the handle of variable lookup and use that fixes and existing problem in pattern assignment, where it was until now possible to assign to const and final variable in some cases.

Part of #61700

Change-Id: Icfe566fd03b805e8fc21c4b373dbb8ab3dab4b7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/484141
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-03-02 03:22:54 -08:00

8 lines
274 B
Dart

// Copyright (c) 2026, 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.
method((int, int) r) {
const int j = 0;
(_, j) = r;
}