07ddd00e1b
The front end previously enforced a stricter-than-spec requirement on conflicting imports on its own code. The check was included of the kernel snapshot and therefore always enforced, even in published sdks. The extra check was removed a month ago and now tools/sdks/ have been updated to use a later version of the sdk, so the unneeded hide combinators can now be removed from the source code. Closes #44667 TEST=existing Change-Id: I1d1053b1ef9a40b6a918eef515a02d7b404906c9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185084 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Jens Johansen <jensj@google.com>
73 lines
2.6 KiB
Dart
73 lines
2.6 KiB
Dart
// 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.
|
|
|
|
// @dart = 2.9
|
|
|
|
import "package:expect/expect.dart" show Expect;
|
|
|
|
import 'package:kernel/ast.dart';
|
|
import 'package:kernel/src/legacy_erasure.dart';
|
|
import 'package:kernel/testing/type_parser_environment.dart';
|
|
|
|
const Map<String, String> data = {
|
|
'Null': 'Null',
|
|
'Never': 'Null',
|
|
'Never?': 'Null',
|
|
'void': 'void',
|
|
'dynamic': 'dynamic',
|
|
'bool': 'bool*',
|
|
'bool?': 'bool*',
|
|
'bool*': 'bool*',
|
|
'List<bool>': 'List<bool*>*',
|
|
'List<bool?>': 'List<bool*>*',
|
|
'List<bool*>': 'List<bool*>*',
|
|
'List<bool>?': 'List<bool*>*',
|
|
'List<bool?>?': 'List<bool*>*',
|
|
'List<bool*>?': 'List<bool*>*',
|
|
'List<bool>*': 'List<bool*>*',
|
|
'List<bool?>*': 'List<bool*>*',
|
|
'List<bool*>*': 'List<bool*>*',
|
|
'() ->* bool*': '() ->* bool*',
|
|
'() ->? bool*': '() ->* bool*',
|
|
'() -> bool*': '() ->* bool*',
|
|
'() ->* bool?': '() ->* bool*',
|
|
'() ->? bool?': '() ->* bool*',
|
|
'() -> bool?': '() ->* bool*',
|
|
'() ->* bool': '() ->* bool*',
|
|
'() ->? bool': '() ->* bool*',
|
|
'() -> bool': '() ->* bool*',
|
|
'(int*) -> void': '(int*) ->* void',
|
|
'(int?) -> void': '(int*) ->* void',
|
|
'(int) -> void': '(int*) ->* void',
|
|
'([int*]) -> void': '([int*]) ->* void',
|
|
'([int?]) -> void': '([int*]) ->* void',
|
|
'([int]) -> void': '([int*]) ->* void',
|
|
'({int* a}) -> void': '({int* a}) ->* void',
|
|
'({int? a}) -> void': '({int* a}) ->* void',
|
|
'({int a}) -> void': '({int* a}) ->* void',
|
|
'({required int* a}) -> void': '({int* a}) ->* void',
|
|
'({required int? a}) -> void': '({int* a}) ->* void',
|
|
'({required int a}) -> void': '({int* a}) ->* void',
|
|
'<T>(T) -> void': '<T extends Object*>(T) ->* void',
|
|
'<T>(T?) -> void': '<T extends Object*>(T*) ->* void',
|
|
'<T extends bool>(T) -> void': '<T extends bool*>(T) ->* void',
|
|
'<T extends List<T>>(T) -> void': '<T extends List<T*>*>(T) ->* void',
|
|
};
|
|
|
|
main() {
|
|
Env env = new Env('', isNonNullableByDefault: true);
|
|
data.forEach((String input, String output) {
|
|
DartType inputType = env.parseType(input);
|
|
DartType expectedOutputType = env.parseType(output);
|
|
DartType actualOutputType = legacyErasure(inputType);
|
|
print('legacyErasure($inputType) = $actualOutputType: $expectedOutputType');
|
|
Expect.equals(
|
|
expectedOutputType,
|
|
actualOutputType,
|
|
"Unexpected legacy erasure of $inputType ('$input'):\n"
|
|
"Expected: ${expectedOutputType} ('$output')\n"
|
|
"Actual: ${actualOutputType}");
|
|
});
|
|
}
|