Files
sdk/pkg/front_end/testcases/expression/initializing_formal_01.expression.yaml
Jens Johansen b59608241f [CFE] Scope calculator handles parameters and initializing formals special
* The VM stops at the last parameter at which point the last parameter
   should also (pretend) to be in scope.
 * We should have initializing (super) formals in scope in the parameter
   list and in the initializer list but not in the body.

Small step towards https://github.com/dart-lang/sdk/issues/62645

Change-Id: I94442e1709a2e14613d81617f8153d9e2b11d889
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500460
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2026-05-27 02:49:19 -07:00

36 lines
927 B
YAML

# 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.
# Standing at the last parameter of a method with an initializing formal.
sources: |
void main() {
new Foo(1, 42);
}
class Foo {
num i;
int j;
Foo(int this.i, int x) : j = i * x {
print(i);
}
}
# We pretend like the VM sends over "i" too. It currently doesn't though.
definitions: ["i", "x"]
# We pretend to VM doesn't send over information so we can see a difference in
# the output when we find the actual type (i.e. when we find it to be in scope).
definition_types: ["null", "null"]
type_definitions: []
type_bounds: []
type_defaults: []
method: "Foo"
position: "#Foo"
static: false
offset: 88 # on the last parameter ("x").
scriptUri: main.dart
expression: |
i.isEven