Skip to content

#3057. Remove obsolete promotion_via_initialization_* tests #3163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions TypeSystem/flow-analysis/promotion_via_assignment_A05_t01.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright (c) 2025, 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.

/// @assertion We say that a variable `x` is promotable via assignment of an
/// expression of type `T` given variable model `VM` if
/// - `VM = VariableModel(declared, promoted, tested, assigned, unassigned,
/// captured)`
/// - and captured is false
/// - and `S` is the current type of `x` in `VM`
/// - and `T <: S` and not `S <: T`
/// - and `T` is a type of interest for `x` in `tested`
///
/// @description Checks that if the type of a variable is not specified and
/// there is no initializer or is `dynamic` then it can be promoted via
/// assignment.
/// @author [email protected]

class S {}

class T extends S {
int foo() => 42;
}

test1() {
var x;
x = S();
if (x is T) {} // Make `T` a type of interest
x = T();
x.foo();
x.bar(); // x is not `dynamic`
// ^^^
// [analyzer] unspecified
// [cfe] unspecified
}

test2() {
dynamic x;
x = S();
if (x is T) {}
x = T();
x.foo();
x.bar();
// ^^^
// [analyzer] unspecified
// [cfe] unspecified
}

main() {
print(test1);
print(test2);
}
34 changes: 34 additions & 0 deletions TypeSystem/flow-analysis/promotion_via_assignment_A05_t02.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) 2025, 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.

/// @assertion We say that a variable `x` is promotable via assignment of an
/// expression of type `T` given variable model `VM` if
/// - `VM = VariableModel(declared, promoted, tested, assigned, unassigned,
/// captured)`
/// - and captured is false
/// - and `S` is the current type of `x` in `VM`
/// - and `T <: S` and not `S <: T`
/// - and `T` is a type of interest for `x` in `tested`
///
/// @description Checks that if the type of a variable is not specified and
/// there is an initializer then its type is inferred from the initializing
/// expression.
/// @author [email protected]

class S {}

class T extends S {
int foo() => 42;
}

main() {
var x = S();
if (x is T) {} // Make `T` a type of interest
x = T();
x.foo();
x.bar(); // Check that `x` is not `dynamic`
// ^^^
// [analyzer] unspecified
// [cfe] unspecified
}
31 changes: 0 additions & 31 deletions TypeSystem/flow-analysis/promotion_via_initialization_A01_t01.dart

This file was deleted.

38 changes: 0 additions & 38 deletions TypeSystem/flow-analysis/promotion_via_initialization_A02_t01.dart

This file was deleted.

34 changes: 0 additions & 34 deletions TypeSystem/flow-analysis/promotion_via_initialization_A03_t01.dart

This file was deleted.

31 changes: 0 additions & 31 deletions TypeSystem/flow-analysis/promotion_via_initialization_A04_t01.dart

This file was deleted.

31 changes: 0 additions & 31 deletions TypeSystem/flow-analysis/promotion_via_initialization_A05_t01.dart

This file was deleted.

32 changes: 0 additions & 32 deletions TypeSystem/flow-analysis/promotion_via_initialization_A06_t01.dart

This file was deleted.