[ddc] Delete tests requiring the old type system

These are tests for the specific apis of the old runtime type system
and they will never pass in the new type system.

Change-Id: I740fc06411cdc621b072782d22ec630c5b6bf96a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341784
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Nicholas Shahan
2024-02-14 00:13:57 +00:00
committed by Commit Queue
parent 9d6b79749b
commit a92ac0237a
6 changed files with 66 additions and 167 deletions
@@ -332,7 +332,7 @@ void runSharedTests(
});
});
test('getObjectMetadata (List) (new types)', () async {
test('getObjectMetadata (List)', () async {
await driver.checkRuntimeInFrame(
breakpointId: 'BP',
expression: 'dart.getObjectMetadata(list)',
+4 -30
View File
@@ -2,39 +2,13 @@
// 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.
import 'dart:_foreign_helper' show TYPE_REF;
import 'dart:_runtime' show gFnType, isSubtypeOf;
import 'dart:_foreign_helper' show JS_EMBEDDED_GLOBAL;
import 'dart:_js_shared_embedded_names' show RTI_UNIVERSE;
import 'dart:_rti' show isSubtype;
import 'package:expect/expect.dart';
/// Returns an unwrapped generic function type with a bounded type argument in
/// the form: <T extends [bound]> void -> void.
///
// TODO(nshahan): The generic function type is created as a legacy type.
genericFunction(bound) =>
gFnType((T) => [TYPE_REF<void>(), []], (T) => [bound]);
/// Returns an unwrapped generic function type with a bounded type argument in
/// the form: <T extends [bound]> [argumentType] -> T.
///
// TODO(nshahan): The generic function type is created as a legacy type.
functionGenericReturn(bound, argumentType) => gFnType(
(T) => [
T,
[argumentType]
],
(T) => [bound]);
/// Returns an unwrapped generic function type with a bounded type argument in
/// the form: <T extends [bound]> T -> [returnType].
///
// TODO(nshahan): The generic function type is created as a legacy type.
functionGenericArg(bound, returnType) => gFnType(
(T) => [
returnType,
[T]
],
(T) => [bound]);
bool isSubtypeOf(s, t) => isSubtype(JS_EMBEDDED_GLOBAL('', RTI_UNIVERSE), s, t);
void checkSubtype(s, t) =>
Expect.isTrue(isSubtypeOf(s, t), '$s should be subtype of $t.');
-29
View File
@@ -1,29 +0,0 @@
// Copyright (c) 2019, 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.
import 'dart:_foreign_helper' show JS, TYPE_REF;
import 'dart:_runtime' show gFnType;
/// Returns an unwrapped generic function type with a bounded type argument in
/// the form: <T extends [bound]> void -> void.
Object genericFunction(Object bound) =>
gFnType((T) => [TYPE_REF<void>(), []], (T) => [bound]);
/// Returns an unwrapped generic function type with a bounded type argument in
/// the form: <T extends [bound]> [argumentType] -> T.
Object functionGenericReturn(Object bound, Object argType) => gFnType(
(T) => [
T,
[argType]
],
(T) => [bound]);
/// Returns an unwrapped generic function type with a bounded type argument in
/// the form: <T extends [bound]> T -> [returnType].
Object functionGenericArg(Object bound, Object returnType) => gFnType(
(T) => [
returnType,
[T]
],
(T) => [bound]);
+31 -35
View File
@@ -13,7 +13,6 @@ import 'runtime_utils.dart'
checkProperSubtype,
checkMutualSubtype,
checkSubtypeFailure;
import 'runtime_utils_nnbd.dart';
class A {}
@@ -148,72 +147,69 @@ void main() {
// Generic Function Subtypes.
// Bound is a built in type.
// <T extends int> void -> void <: <T extends int> void -> void
checkSubtype(
genericFunction(TYPE_REF<int>()), genericFunction(TYPE_REF<int>()));
checkSubtype(TYPE_REF<void Function<T extends int>()>(),
TYPE_REF<void Function<T extends int>()>());
// <T extends String> A -> T <: <T extends String> B -> T
checkProperSubtype(functionGenericReturn(TYPE_REF<String>(), TYPE_REF<A>()),
functionGenericReturn(TYPE_REF<String>(), TYPE_REF<B>()));
checkProperSubtype(TYPE_REF<T Function<T extends String>(A)>(),
TYPE_REF<T Function<T extends String>(B)>());
// <T extends double> T -> B <: <T extends double> T -> A
checkProperSubtype(functionGenericArg(TYPE_REF<double>(), TYPE_REF<B>()),
functionGenericArg(TYPE_REF<double>(), TYPE_REF<A>()));
checkProperSubtype(TYPE_REF<B Function<T extends double>(T)>(),
TYPE_REF<A Function<T extends double>(T)>());
// Bound is a function type.
// <T extends A -> B> void -> void <: <T extends A -> B> void -> void
checkSubtype(genericFunction(TYPE_REF<A Function(B)>()),
genericFunction(TYPE_REF<A Function(B)>()));
checkSubtype(TYPE_REF<void Function<T extends A Function(B)>()>(),
TYPE_REF<void Function<T extends A Function(B)>()>());
// <T extends A -> B> A -> T <: <T extends A -> B> B -> T
checkProperSubtype(
functionGenericReturn(TYPE_REF<A Function(B)>(), TYPE_REF<A>()),
functionGenericReturn(TYPE_REF<A Function(B)>(), TYPE_REF<B>()));
checkProperSubtype(TYPE_REF<T Function<T extends A Function(B)>(A)>(),
TYPE_REF<T Function<T extends A Function(B)>(B)>());
// <T extends A -> B> T -> B <: <T extends A -> B> T -> A
checkProperSubtype(
functionGenericArg(TYPE_REF<A Function(B)>(), TYPE_REF<B>()),
functionGenericArg(TYPE_REF<A Function(B)>(), TYPE_REF<A>()));
checkProperSubtype(TYPE_REF<B Function<T extends A Function(B)>(T)>(),
TYPE_REF<A Function<T extends A Function(B)>(T)>());
// Bound is a user defined class.
// <T extends B> void -> void <: <T extends B> void -> void
checkSubtype(genericFunction(TYPE_REF<B>()), genericFunction(TYPE_REF<B>()));
checkSubtype(TYPE_REF<void Function<T extends B>()>(),
TYPE_REF<void Function<T extends B>()>());
// <T extends B> A -> T <: <T extends B> B -> T
checkProperSubtype(functionGenericReturn(TYPE_REF<B>(), TYPE_REF<A>()),
functionGenericReturn(TYPE_REF<B>(), TYPE_REF<B>()));
checkProperSubtype(TYPE_REF<T Function<T extends B>(A)>(),
TYPE_REF<T Function<T extends B>(B)>());
// <T extends B> T -> B <: <T extends B> T -> A
checkProperSubtype(functionGenericArg(TYPE_REF<B>(), TYPE_REF<B>()),
functionGenericArg(TYPE_REF<B>(), TYPE_REF<A>()));
// // <T extends B> T -> B <: <T extends B> T -> A
checkProperSubtype(TYPE_REF<B Function<T extends B>(T)>(),
TYPE_REF<A Function<T extends B>(T)>());
// Bound is a Future.
// <T extends Future<B>> void -> void <: <T extends Future<B>> void -> void
checkSubtype(genericFunction(TYPE_REF<Future<B>>()),
genericFunction(TYPE_REF<Future<B>>()));
checkSubtype(TYPE_REF<void Function<T extends Future<B>>()>(),
TYPE_REF<void Function<T extends Future<B>>()>());
// <T extends Future<B>> A -> T <: <T extends Future<B>> B -> T
checkProperSubtype(
functionGenericReturn(TYPE_REF<Future<B>>(), TYPE_REF<A>()),
functionGenericReturn(TYPE_REF<Future<B>>(), TYPE_REF<B>()));
checkProperSubtype(TYPE_REF<T Function<T extends Future<B>>(A)>(),
TYPE_REF<T Function<T extends Future<B>>(B)>());
// <T extends Future<B>> T -> B <: <T extends Future<B>> T -> A
checkProperSubtype(functionGenericArg(TYPE_REF<Future<B>>(), TYPE_REF<B>()),
functionGenericArg(TYPE_REF<Future<B>>(), TYPE_REF<A>()));
checkProperSubtype(TYPE_REF<B Function<T extends Future<B>>(T)>(),
TYPE_REF<A Function<T extends Future<B>>(T)>());
// Bound is a FutureOr.
// <T extends FutureOr<B>> void -> void <:
// <T extends FutureOr<B>> void -> void
checkSubtype(genericFunction(TYPE_REF<FutureOr<B>>()),
genericFunction(TYPE_REF<FutureOr<B>>()));
checkSubtype(TYPE_REF<void Function<T extends FutureOr<B>>()>(),
TYPE_REF<void Function<T extends FutureOr<B>>()>());
// <T extends FutureOr<B>> A -> T <: <T extends FutureOr<B>> B -> T
checkProperSubtype(
functionGenericReturn(TYPE_REF<FutureOr<B>>(), TYPE_REF<A>()),
functionGenericReturn(TYPE_REF<FutureOr<B>>(), TYPE_REF<B>()));
checkProperSubtype(TYPE_REF<T Function<T extends FutureOr<B>>(A)>(),
TYPE_REF<T Function<T extends FutureOr<B>>(B)>());
// <T extends FutureOr<B>> T -> B <: <T extends FutureOr<B>> T -> A
checkProperSubtype(functionGenericArg(TYPE_REF<FutureOr<B>>(), TYPE_REF<B>()),
functionGenericArg(TYPE_REF<FutureOr<B>>(), TYPE_REF<A>()));
checkProperSubtype(TYPE_REF<B Function<T extends FutureOr<B>>(T)>(),
TYPE_REF<A Function<T extends FutureOr<B>>(T)>());
// Generics.
// D <:> D<B>
+30 -34
View File
@@ -13,7 +13,6 @@ import 'runtime_utils.dart'
checkProperSubtype,
checkMutualSubtype,
checkSubtypeFailure;
import 'runtime_utils_nnbd.dart';
class A {}
@@ -148,72 +147,69 @@ void main() {
// Generic Function Subtypes.
// Bound is a built in type.
// <T extends int> void -> void <: <T extends int> void -> void
checkSubtype(
genericFunction(TYPE_REF<int>()), genericFunction(TYPE_REF<int>()));
checkSubtype(TYPE_REF<void Function<T extends int>()>(),
TYPE_REF<void Function<T extends int>()>());
// <T extends String> A -> T <: <T extends String> B -> T
checkProperSubtype(functionGenericReturn(TYPE_REF<String>(), TYPE_REF<A>()),
functionGenericReturn(TYPE_REF<String>(), TYPE_REF<B>()));
checkProperSubtype(TYPE_REF<T Function<T extends String>(A)>(),
TYPE_REF<T Function<T extends String>(B)>());
// <T extends double> T -> B <: <T extends double> T -> A
checkProperSubtype(functionGenericArg(TYPE_REF<double>(), TYPE_REF<B>()),
functionGenericArg(TYPE_REF<double>(), TYPE_REF<A>()));
checkProperSubtype(TYPE_REF<B Function<T extends double>(T)>(),
TYPE_REF<A Function<T extends double>(T)>());
// Bound is a function type.
// <T extends A -> B> void -> void <: <T extends A -> B> void -> void
checkSubtype(genericFunction(TYPE_REF<A Function(B)>()),
genericFunction(TYPE_REF<A Function(B)>()));
checkSubtype(TYPE_REF<void Function<T extends B Function(A)>()>(),
TYPE_REF<void Function<T extends B Function(A)>()>());
// <T extends A -> B> A -> T <: <T extends A -> B> B -> T
checkProperSubtype(
functionGenericReturn(TYPE_REF<A Function(B)>(), TYPE_REF<A>()),
functionGenericReturn(TYPE_REF<A Function(B)>(), TYPE_REF<B>()));
checkProperSubtype(TYPE_REF<T Function<T extends B Function(A)>(A)>(),
TYPE_REF<T Function<T extends B Function(A)>(B)>());
// <T extends A -> B> T -> B <: <T extends A -> B> T -> A
checkProperSubtype(
functionGenericArg(TYPE_REF<A Function(B)>(), TYPE_REF<B>()),
functionGenericArg(TYPE_REF<A Function(B)>(), TYPE_REF<A>()));
checkProperSubtype(TYPE_REF<B Function<T extends B Function(A)>(T)>(),
TYPE_REF<A Function<T extends B Function(A)>(T)>());
// Bound is a user defined class.
// <T extends B> void -> void <: <T extends B> void -> void
checkSubtype(genericFunction(TYPE_REF<B>()), genericFunction(TYPE_REF<B>()));
checkSubtype(TYPE_REF<void Function<T extends B>()>(),
TYPE_REF<void Function<T extends B>()>());
// <T extends B> A -> T <: <T extends B> B -> T
checkProperSubtype(functionGenericReturn(TYPE_REF<B>(), TYPE_REF<A>()),
functionGenericReturn(TYPE_REF<B>(), TYPE_REF<B>()));
checkProperSubtype(TYPE_REF<T Function<T extends B>(A)>(),
TYPE_REF<T Function<T extends B>(B)>());
// <T extends B> T -> B <: <T extends B> T -> A
checkProperSubtype(functionGenericArg(TYPE_REF<B>(), TYPE_REF<B>()),
functionGenericArg(TYPE_REF<B>(), TYPE_REF<A>()));
checkProperSubtype(TYPE_REF<B Function<T extends B>(T)>(),
TYPE_REF<A Function<T extends B>(T)>());
// Bound is a Future.
// <T extends Future<B>> void -> void <: <T extends Future<B>> void -> void
checkSubtype(genericFunction(TYPE_REF<Future<B>>()),
genericFunction(TYPE_REF<Future<B>>()));
checkSubtype(TYPE_REF<void Function<T extends Future<B>>()>(),
TYPE_REF<void Function<T extends Future<B>>()>());
// <T extends Future<B>> A -> T <: <T extends Future<B>> B -> T
checkProperSubtype(
functionGenericReturn(TYPE_REF<Future<B>>(), TYPE_REF<A>()),
functionGenericReturn(TYPE_REF<Future<B>>(), TYPE_REF<B>()));
checkProperSubtype(TYPE_REF<T Function<T extends Future<B>>(A)>(),
TYPE_REF<T Function<T extends Future<B>>(B)>());
// <T extends Future<B>> T -> B <: <T extends Future<B>> T -> A
checkProperSubtype(functionGenericArg(TYPE_REF<Future<B>>(), TYPE_REF<B>()),
functionGenericArg(TYPE_REF<Future<B>>(), TYPE_REF<A>()));
checkProperSubtype(TYPE_REF<B Function<T extends Future<B>>(T)>(),
TYPE_REF<A Function<T extends Future<B>>(T)>());
// Bound is a FutureOr.
// <T extends FutureOr<B>> void -> void <:
// <T extends FutureOr<B>> void -> void
checkSubtype(genericFunction(TYPE_REF<FutureOr<B>>()),
genericFunction(TYPE_REF<FutureOr<B>>()));
checkSubtype(TYPE_REF<void Function<T extends FutureOr<B>>()>(),
TYPE_REF<void Function<T extends FutureOr<B>>()>());
// <T extends FutureOr<B>> A -> T <: <T extends FutureOr<B>> B -> T
checkProperSubtype(
functionGenericReturn(TYPE_REF<FutureOr<B>>(), TYPE_REF<A>()),
functionGenericReturn(TYPE_REF<FutureOr<B>>(), TYPE_REF<B>()));
checkProperSubtype(TYPE_REF<T Function<T extends Future<B>>(A)>(),
TYPE_REF<T Function<T extends Future<B>>(B)>());
// <T extends FutureOr<B>> T -> B <: <T extends FutureOr<B>> T -> A
checkProperSubtype(functionGenericArg(TYPE_REF<FutureOr<B>>(), TYPE_REF<B>()),
functionGenericArg(TYPE_REF<FutureOr<B>>(), TYPE_REF<A>()));
checkProperSubtype(TYPE_REF<B Function<T extends Future<B>>(T)>(),
TYPE_REF<A Function<T extends Future<B>>(T)>());
// Generics.
// D <:> D<B>
@@ -1,38 +0,0 @@
// Copyright (c) 2019, 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 'dart:_foreign_helper' show LEGACY_TYPE_REF, TYPE_REF;
import 'dart:_runtime' show legacy, nullable;
import 'package:expect/expect.dart';
class A {}
void main() {
// A?? == A?
Expect.identical(nullable(TYPE_REF<A?>()), TYPE_REF<A?>());
// A?* == A?
Expect.identical(legacy(TYPE_REF<A?>()), TYPE_REF<A?>());
// A*? == A?
Expect.identical(nullable(LEGACY_TYPE_REF<A>()), TYPE_REF<A?>());
// A** == A*
Expect.identical(legacy(LEGACY_TYPE_REF<A>()), LEGACY_TYPE_REF<A>());
// The tests below need explicit wrapping in nullable and legacy to ensure
// they appear at runtime and the runtime library normalizes them correctly.
// Null? == Null
Expect.identical(nullable(TYPE_REF<Null>()), TYPE_REF<Null>());
// Never? == Null
Expect.identical(nullable(TYPE_REF<Never>()), TYPE_REF<Null>());
// dynamic? == dynamic
Expect.identical(nullable(TYPE_REF<dynamic>()), TYPE_REF<dynamic>());
// void? == void
Expect.identical(nullable(TYPE_REF<void>()), TYPE_REF<void>());
// dynamic* == dynamic
Expect.identical(legacy(TYPE_REF<dynamic>()), TYPE_REF<dynamic>());
// void* == void
Expect.identical(legacy(TYPE_REF<void>()), TYPE_REF<void>());
}