[gardening] Remove lib{,_2}/mirrors/typedef_test

This test has flaked on our CI but actually it's consistently failing
because we do not represent `typedef`s in a reflective way in the VM
since switching to kernel (because they used to be desguared on kernel
level).

So this has not been working for a long time, let's remove this test.

Issue https://github.com/dart-lang/sdk/issues/44489

Change-Id: I36e8d8aee7a7736e8afc5741b01d10429ac0d7a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331941
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This commit is contained in:
Martin Kustermann 2023-10-24 12:17:03 +00:00 committed by Commit Queue
parent 1b426ea6f8
commit f45815883e
2 changed files with 0 additions and 272 deletions

View file

@ -1,135 +0,0 @@
// Copyright (c) 2013, 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.
// This test is a multi-test with three positive tests. "01" pass on dart2js,
// "02" pass on the VM, and "none" is the correct behavior.
// The goal is to remove all "01" and "02" lines.
library test.typedef_test;
import 'dart:mirrors';
import 'package:expect/expect.dart';
typedef Func();
typedef void Void();
typedef String Foo(int x);
typedef String Bar(int x, [num y]);
typedef String Baz(int x, {num y});
typedef String Foo2(int x, num y);
typedef String Bar2(int x, [num y, num z]);
typedef String Baz2(int x, {num y, num z});
check(t) {
var sb = new StringBuffer();
writeln(o) {
sb.write(o);
sb.write('\n');
}
writeln(t);
t = t.referent;
writeln(t);
writeln(t.returnType);
writeln(t.parameters);
for (var p in t.parameters) {
writeln(p.simpleName);
writeln(p.type);
}
return sb.toString();
}
// Return "$args -> $ret".
ft(args, ret) {
return '$args -> $ret';
}
void main() {
String x = 'x';
String y = 'y';
String z = 'z';
Expect.stringEquals("""
TypedefMirror on 'Func'
FunctionTypeMirror on '${ft('()', 'dynamic')}'
TypeMirror on 'dynamic'
[]
""", check(reflectType(Func)));
Expect.stringEquals("""
TypedefMirror on 'Void'
FunctionTypeMirror on '${ft('()', 'void')}'
TypeMirror on 'void'
[]
""", check(reflectType(Void)));
Expect.stringEquals("""
TypedefMirror on 'Foo'
FunctionTypeMirror on '${ft('(dart.core.int)', 'dart.core.String')}'
ClassMirror on 'String'
[ParameterMirror on '$x']
Symbol(\"$x\")
ClassMirror on 'int'
""", check(reflectType(Foo)));
String type = ft('(dart.core.int, dart.core.num)', 'dart.core.String');
Expect.stringEquals("""
TypedefMirror on 'Foo2'
FunctionTypeMirror on '$type'
ClassMirror on 'String'
[ParameterMirror on '$x', ParameterMirror on '$y']
Symbol(\"$x\")
ClassMirror on 'int'
Symbol(\"$y\")
ClassMirror on 'num'
""", check(reflectType(Foo2)));
type = ft('(dart.core.int, [dart.core.num])', 'dart.core.String');
Expect.stringEquals("""
TypedefMirror on 'Bar'
FunctionTypeMirror on '$type'
ClassMirror on 'String'
[ParameterMirror on '$x', ParameterMirror on '$y']
Symbol(\"$x\")
ClassMirror on 'int'
Symbol(\"$y\")
ClassMirror on 'num'
""", check(reflectType(Bar)));
type =
ft('(dart.core.int, [dart.core.num, dart.core.num])', 'dart.core.String');
Expect.stringEquals("""
TypedefMirror on 'Bar2'
FunctionTypeMirror on '$type'
ClassMirror on 'String'
[ParameterMirror on '$x', ParameterMirror on '$y', ParameterMirror on '$z']
Symbol(\"$x\")
ClassMirror on 'int'
Symbol(\"$y\")
ClassMirror on 'num'
Symbol(\"$z\")
ClassMirror on 'num'
""", check(reflectType(Bar2)));
type = ft('(dart.core.int, {y: dart.core.num})', 'dart.core.String');
Expect.stringEquals("""
TypedefMirror on 'Baz'
FunctionTypeMirror on '$type'
ClassMirror on 'String'
[ParameterMirror on '$x', ParameterMirror on 'y']
Symbol(\"$x\")
ClassMirror on 'int'
Symbol(\"y\")
ClassMirror on 'num'
""", check(reflectType(Baz)));
type = ft('(dart.core.int, {y: dart.core.num, z: dart.core.num})',
'dart.core.String');
Expect.stringEquals("""
TypedefMirror on 'Baz2'
FunctionTypeMirror on '$type'
ClassMirror on 'String'
[ParameterMirror on '$x', ParameterMirror on 'y', ParameterMirror on 'z']
Symbol(\"$x\")
ClassMirror on 'int'
Symbol(\"y\")
ClassMirror on 'num'
Symbol(\"z\")
ClassMirror on 'num'
""", check(reflectType(Baz2)));
}

View file

@ -1,137 +0,0 @@
// Copyright (c) 2013, 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.
// @dart = 2.9
// This test is a multi-test with three positive tests. "01" pass on dart2js,
// "02" pass on the VM, and "none" is the correct behavior.
// The goal is to remove all "01" and "02" lines.
library test.typedef_test;
import 'dart:mirrors';
import 'package:expect/expect.dart';
typedef Func();
typedef void Void();
typedef String Foo(int x);
typedef String Bar(int x, [num y]);
typedef String Baz(int x, {num y});
typedef String Foo2(int x, num y);
typedef String Bar2(int x, [num y, num z]);
typedef String Baz2(int x, {num y, num z});
check(t) {
var sb = new StringBuffer();
writeln(o) {
sb.write(o);
sb.write('\n');
}
writeln(t);
t = t.referent;
writeln(t);
writeln(t.returnType);
writeln(t.parameters);
for (var p in t.parameters) {
writeln(p.simpleName);
writeln(p.type);
}
return sb.toString();
}
// Return "$args -> $ret".
ft(args, ret) {
return '$args -> $ret';
}
void main() {
String x = 'x';
String y = 'y';
String z = 'z';
Expect.stringEquals("""
TypedefMirror on 'Func'
FunctionTypeMirror on '${ft('()', 'dynamic')}'
TypeMirror on 'dynamic'
[]
""", check(reflectType(Func)));
Expect.stringEquals("""
TypedefMirror on 'Void'
FunctionTypeMirror on '${ft('()', 'void')}'
TypeMirror on 'void'
[]
""", check(reflectType(Void)));
Expect.stringEquals("""
TypedefMirror on 'Foo'
FunctionTypeMirror on '${ft('(dart.core.int)', 'dart.core.String')}'
ClassMirror on 'String'
[ParameterMirror on '$x']
Symbol(\"$x\")
ClassMirror on 'int'
""", check(reflectType(Foo)));
String type = ft('(dart.core.int, dart.core.num)', 'dart.core.String');
Expect.stringEquals("""
TypedefMirror on 'Foo2'
FunctionTypeMirror on '$type'
ClassMirror on 'String'
[ParameterMirror on '$x', ParameterMirror on '$y']
Symbol(\"$x\")
ClassMirror on 'int'
Symbol(\"$y\")
ClassMirror on 'num'
""", check(reflectType(Foo2)));
type = ft('(dart.core.int, [dart.core.num])', 'dart.core.String');
Expect.stringEquals("""
TypedefMirror on 'Bar'
FunctionTypeMirror on '$type'
ClassMirror on 'String'
[ParameterMirror on '$x', ParameterMirror on '$y']
Symbol(\"$x\")
ClassMirror on 'int'
Symbol(\"$y\")
ClassMirror on 'num'
""", check(reflectType(Bar)));
type =
ft('(dart.core.int, [dart.core.num, dart.core.num])', 'dart.core.String');
Expect.stringEquals("""
TypedefMirror on 'Bar2'
FunctionTypeMirror on '$type'
ClassMirror on 'String'
[ParameterMirror on '$x', ParameterMirror on '$y', ParameterMirror on '$z']
Symbol(\"$x\")
ClassMirror on 'int'
Symbol(\"$y\")
ClassMirror on 'num'
Symbol(\"$z\")
ClassMirror on 'num'
""", check(reflectType(Bar2)));
type = ft('(dart.core.int, {y: dart.core.num})', 'dart.core.String');
Expect.stringEquals("""
TypedefMirror on 'Baz'
FunctionTypeMirror on '$type'
ClassMirror on 'String'
[ParameterMirror on '$x', ParameterMirror on 'y']
Symbol(\"$x\")
ClassMirror on 'int'
Symbol(\"y\")
ClassMirror on 'num'
""", check(reflectType(Baz)));
type = ft('(dart.core.int, {y: dart.core.num, z: dart.core.num})',
'dart.core.String');
Expect.stringEquals("""
TypedefMirror on 'Baz2'
FunctionTypeMirror on '$type'
ClassMirror on 'String'
[ParameterMirror on '$x', ParameterMirror on 'y', ParameterMirror on 'z']
Symbol(\"$x\")
ClassMirror on 'int'
Symbol(\"y\")
ClassMirror on 'num'
Symbol(\"z\")
ClassMirror on 'num'
""", check(reflectType(Baz2)));
}