mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
Revert "[tests] Add tests for generic function type bounds with null safety"
This reverts commit 21535e540f
.
Reason for revert: VM test bots are failing and the approval system is down so I can't turn them green again. Reverting until I can approve the failures.
Original change's description:
> [tests] Add tests for generic function type bounds with null safety
>
> Testing that type arguments bounded by legacy types are equivalent
> with nullable and non-nullable versions of the same types.
>
> Change-Id: Ibd1166af68a74041920940789464cbb8afb091ec
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132969
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Bob Nystrom <rnystrom@google.com>
> Reviewed-by: Erik Ernst <eernst@google.com>
TBR=leafp@google.com,rnystrom@google.com,eernst@google.com,nshahan@google.com
Change-Id: Iad45fcd1498bdd46bfb908cd40df7ca38ef47d2d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134461
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
48808f7dce
commit
f831f121d7
5 changed files with 0 additions and 129 deletions
|
@ -1,20 +0,0 @@
|
|||
// Copyright (c) 2020, 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.
|
||||
|
||||
// Opt out of NNBD:
|
||||
// @dart = 2.6
|
||||
|
||||
/// A legacy library of helper methods to construct types and values containing
|
||||
/// legacy (star *) types.
|
||||
|
||||
typedef fnTypeWithLegacyObjectBound = void Function<T extends Object>();
|
||||
typedef fnTypeWithLegacyIntBound = void Function<T extends int>();
|
||||
typedef fnTypeWithLegacyStringLegacyObjectBounds = void
|
||||
Function<T extends String, S extends Object>();
|
||||
|
||||
void fnWithLegacyObjectBound<T extends Object>() => null;
|
||||
void fnWithLegacyIntBound<T extends int>() => null;
|
||||
void fnWithLegacyStringLegacyObjectBounds<T extends String,
|
||||
S extends Object>() =>
|
||||
null;
|
|
@ -1,23 +0,0 @@
|
|||
// Copyright (c) 2020, 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.
|
||||
|
||||
/// A null safe library of helper methods to construct types and values
|
||||
/// containing non-nullable and nullable (question ?) types.
|
||||
|
||||
typedef fnTypeWithNonNullObjectBound = void Function<T extends Object>();
|
||||
typedef fnTypeWithNullableObjectBound = void Function<T extends Object?>();
|
||||
typedef fnTypeWithNonNullIntBound = void Function<T extends int>();
|
||||
typedef fnTypeWithNullableIntBound = void Function<T extends int?>();
|
||||
typedef fnTypeWithNonNullableStringNullableObjectBounds = void
|
||||
Function<T extends String, S extends Object?>();
|
||||
typedef fnTypeWithNeverBound = void Function<T extends Never>();
|
||||
|
||||
void fnWithNonNullObjectBound<T extends Object>() => null;
|
||||
void fnWithNullableObjectBound<T extends Object?>() => null;
|
||||
void fnWithNonNullIntBound<T extends int>() => null;
|
||||
void fnWithNullableIntBound<T extends int?>() => null;
|
||||
void fnWithNonNullableStringNullableObjectBounds<T extends String,
|
||||
S extends Object?>() =>
|
||||
null;
|
||||
void fnWithNullBound<T extends Null>() => null;
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright (c) 2020, 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.
|
||||
|
||||
// Requirements=nnbd-strong
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
import 'function_type_bounds_null_safe_lib.dart';
|
||||
|
||||
main() {
|
||||
// void fn<T extends Object>() is void Function<T extends Object?>()
|
||||
// Should fail with strong checking because Object and Object? should be
|
||||
// treated as type bounds that are not equivalent.
|
||||
Expect.isFalse(fnWithNonNullObjectBound is fnTypeWithNullableObjectBound);
|
||||
|
||||
// void fn<T extends Null>() is void Function<T extends Never>()
|
||||
// Should fail with strong checking because because Null and Never are treated
|
||||
// as distinct.
|
||||
Expect.isFalse(fnWithNullBound is fnTypeWithNeverBound);
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
// Copyright (c) 2020, 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.
|
||||
|
||||
// Requirements=nnbd
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
import 'function_type_bounds_legacy_lib.dart';
|
||||
import 'function_type_bounds_null_safe_lib.dart';
|
||||
|
||||
main() {
|
||||
// void fn<T extends Object>() is void Function<T extends Object>()
|
||||
Expect.isTrue(fnWithNonNullObjectBound is fnTypeWithNonNullObjectBound);
|
||||
// void fn<T extends Object>() is void Function<T extends Object*>()
|
||||
Expect.isTrue(fnWithNonNullObjectBound is fnTypeWithLegacyObjectBound);
|
||||
// void fn<T extends Object?>() is void Function<T extends Object*>()
|
||||
Expect.isTrue(fnWithNullableObjectBound is fnTypeWithLegacyObjectBound);
|
||||
// void fn<T extends Object*>() is void Function<T extends Object>()
|
||||
Expect.isTrue(fnWithLegacyObjectBound is fnTypeWithNonNullObjectBound);
|
||||
// void fn<T extends Object*>() is void Function<T extends Object?>()
|
||||
Expect.isTrue(fnWithLegacyObjectBound is fnTypeWithNullableObjectBound);
|
||||
|
||||
// void fn<T extends int>() is void Function<T extends int>()
|
||||
Expect.isTrue(fnWithNonNullIntBound is fnTypeWithNonNullIntBound);
|
||||
// void fn<T extends int>() is void Function<T extends int*>()
|
||||
Expect.isTrue(fnWithNonNullIntBound is fnTypeWithLegacyIntBound);
|
||||
// void fn<T extends int?>() is void Function<T extends int*>()
|
||||
Expect.isTrue(fnWithNullableIntBound is fnTypeWithLegacyIntBound);
|
||||
// void fn<T extends int*>() is void Function<T extends int>()
|
||||
Expect.isTrue(fnWithLegacyIntBound is fnTypeWithNonNullIntBound);
|
||||
// void fn<T extends int*>() is void Function<T extends int?>()
|
||||
Expect.isTrue(fnWithLegacyIntBound is fnTypeWithNullableIntBound);
|
||||
|
||||
// void fn<T extends String*, S extends Object*>() is
|
||||
// void Function<T extends String, S extends Object?>()
|
||||
Expect.isTrue(fnWithLegacyStringLegacyObjectBounds
|
||||
is fnTypeWithNonNullableStringNullableObjectBounds);
|
||||
|
||||
// void fn<T extends String, S extends Object?>() is
|
||||
// void Function<T extends String*, S extends Object*>()
|
||||
Expect.isTrue(fnWithNonNullableStringNullableObjectBounds
|
||||
is fnTypeWithLegacyStringLegacyObjectBounds);
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright (c) 2020, 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.
|
||||
|
||||
// Requirements=nnbd-weak
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
import 'function_type_bounds_null_safe_lib.dart';
|
||||
|
||||
main() {
|
||||
// void fn<T extends Object>() is void Function<T extends Object?>()
|
||||
// Should pass with weak checking because when the nullability information on
|
||||
// Object and Object? are erased the type bounds are equivalent.
|
||||
Expect.isTrue(fnWithNonNullObjectBound is fnTypeWithNullableObjectBound);
|
||||
|
||||
// void fn<T extends Null>() is void Function<T extends Never>()
|
||||
// Should pass with weak checking because because Null becomes equivalent to
|
||||
// the bottom type.
|
||||
Expect.isTrue(fnWithNullBound is fnTypeWithNeverBound);
|
||||
}
|
Loading…
Reference in a new issue