Files
Johnni Winther 1a88f3b7ce [cfe][PrimaryConstructors] Update primary constructor parameter scope
This updates the primary constructor parameter scope to be nested within the body scope of the enclosing declaration instead of the type parameter scope of the enclosing declaration.

Part of #61700

Change-Id: I8be1e7c4c9b81d1f4f8e6423d6c241b1222568b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/479000
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2026-02-10 00:40:53 -08:00

30 lines
636 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.
class C1([@m int x = m]) {
static const int m = 42;
}
class C2(int x) { // Error
static const String int = 'not a type';
}
enum E1([@a int x = m]) {
a(0);
static const int m = 42;
}
enum E2(int x) { // Error
a(0);
static const String int = 'not a type';
}
extension type ET1([@m int x = m]) {
static const int m = 42;
}
extension type ET2(int x) { // Error
static const String int = 'not a type';
}