dart-sdk/tests/language/extension_type/field_promotion_representation_cascaded_test.dart
Lasse R.H. Nielsen 9d933d1281 Retire 3.3 experiments in the 3.4 release.
Tested: No new tests.
Change-Id: Idf19ce8b6743b221841e6cef6b2a80e8ab37860e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/354260
Auto-Submit: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2024-03-04 16:09:31 +00:00

31 lines
872 B
Dart

// Copyright (c) 2023, 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.
// Tests that field promotion of the representation variable works properly in
// cascade expressions.
import '../static_type_helper.dart';
extension type E(Object Function() _f) {
testExplicitThisAccess() {
if (this._f is int Function()) {
this.._f.expectStaticType<Exactly<int Function()>>();
this.._f().expectStaticType<Exactly<int>>();
}
}
}
testGeneralPropertyAccess(E e) {
if (e._f is int Function()) {
e.._f.expectStaticType<Exactly<int Function()>>();
e.._f().expectStaticType<Exactly<int>>();
}
}
main() {
int Function() f = () => 0;
E(f).testExplicitThisAccess();
testGeneralPropertyAccess(E(f));
}