[dart2js] Split up RTI subtype tests.

Change-Id: Id0bc61d295edfc25709aa4ff1bf9fa3c9bde5691
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107221
Reviewed-by: Stephen Adams <sra@google.com>
This commit is contained in:
Mayank Patke 2019-06-25 22:59:24 +00:00 committed by commit-bot@chromium.org
parent 9b7bcfd1ce
commit 069d76a58e

View file

@ -31,27 +31,27 @@ main() {
}
void runTests() {
testInterfaces();
testTopTypes();
testNull();
testFutureOr();
}
void testInterfaces() {
strictSubtype('List<CodeUnits>', 'Iterable<List<int>>');
strictSubtype('CodeUnits', 'Iterable<num>');
strictSubtype('Iterable<int>', 'Iterable<num>');
strictSubtype('List<int>', objectName);
strictSubtype('$futureName<int>', '$futureName<num>');
strictSubtype('int', 'int/');
strictSubtype('$futureName<int>', 'int/');
strictSubtype('int/', 'num/');
strictSubtype('int', 'num/');
strictSubtype('$futureName<int>', 'num/');
strictSubtype(nullName, 'int');
strictSubtype(nullName, 'Iterable<CodeUnits>');
strictSubtype(nullName, objectName);
unrelated('int', 'CodeUnits');
equivalent(nullName, nullName);
equivalent('double', 'double');
equivalent('List<int>', 'List<int>');
}
void testTopTypes() {
strictSubtype('List<int>', objectName);
equivalent(objectName, objectName);
equivalent('@', '@');
equivalent('~', '~');
equivalent('1&', '1&');
equivalent('List<int>', 'List<int>');
equivalent(objectName, '@');
equivalent(objectName, '~');
equivalent(objectName, '1&');
@ -64,6 +64,22 @@ void runTests() {
equivalent('List<@>', 'List<~>');
equivalent('List<@>', 'List<1&>');
equivalent('List<~>', 'List<1&>');
}
void testNull() {
strictSubtype(nullName, 'int');
strictSubtype(nullName, 'Iterable<CodeUnits>');
strictSubtype(nullName, objectName);
equivalent(nullName, nullName);
}
void testFutureOr() {
strictSubtype('$futureName<int>', '$futureName<num>');
strictSubtype('int', 'int/');
strictSubtype('$futureName<int>', 'int/');
strictSubtype('int/', 'num/');
strictSubtype('int', 'num/');
strictSubtype('$futureName<int>', 'num/');
equivalent('@/', '~/');
}