| Index: tests/compiler/dart2js/patch_test.dart
|
| diff --git a/tests/compiler/dart2js/patch_test.dart b/tests/compiler/dart2js/patch_test.dart
|
| index 95ee5c31d8a6946b301f1eed813765d6c975a18f..0eb044580fd8cda1e98c5d6f733b0d351abcce45 100644
|
| --- a/tests/compiler/dart2js/patch_test.dart
|
| +++ b/tests/compiler/dart2js/patch_test.dart
|
| @@ -166,6 +166,59 @@ Future testPatchFunctionMetadata() async {
|
| "Unexpected patch metadata: ${patch.metadata}.");
|
| }
|
|
|
| +Future testPatchFunctionGeneric() async {
|
| + var compiler = await applyPatch(
|
| + "external T test<T>();", "@patch T test<T>() { return null; } ");
|
| + Element origin = ensure(
|
| + compiler, "test", compiler.commonElements.coreLibrary.find,
|
| + expectIsPatched: true, checkHasBody: true);
|
| + ensure(compiler, "test", compiler.commonElements.coreLibrary.patch.find,
|
| + expectIsPatch: true, checkHasBody: true);
|
| + compiler.resolver.resolve(origin);
|
| +
|
| + DiagnosticCollector collector = compiler.diagnosticCollector;
|
| + Expect.isTrue(
|
| + collector.warnings.isEmpty, "Unexpected warnings: ${collector.warnings}");
|
| + Expect.isTrue(
|
| + collector.errors.isEmpty, "Unexpected errors: ${collector.errors}");
|
| +}
|
| +
|
| +Future testPatchFunctionGenericExtraTypeVariable() async {
|
| + var compiler = await applyPatch(
|
| + "external T test<T>();", "@patch T test<T, S>() { return null; } ");
|
| + Element origin = ensure(
|
| + compiler, "test", compiler.commonElements.coreLibrary.find,
|
| + expectIsPatched: true, checkHasBody: true);
|
| + ensure(compiler, "test", compiler.commonElements.coreLibrary.patch.find,
|
| + expectIsPatch: true, checkHasBody: true);
|
| + compiler.resolver.resolve(origin);
|
| +
|
| + DiagnosticCollector collector = compiler.diagnosticCollector;
|
| + Expect.isTrue(
|
| + collector.warnings.isEmpty, "Unexpected warnings: ${collector.warnings}");
|
| + Expect.equals(1, collector.errors.length);
|
| + Expect.isTrue(collector.errors.first.message.kind ==
|
| + MessageKind.PATCH_TYPE_VARIABLES_MISMATCH);
|
| +}
|
| +
|
| +Future testPatchFunctionGenericDifferentNames() async {
|
| + var compiler = await applyPatch(
|
| + "external T test<T, S>();", "@patch T test<S, T>() { return null; } ");
|
| + Element origin = ensure(
|
| + compiler, "test", compiler.commonElements.coreLibrary.find,
|
| + expectIsPatched: true, checkHasBody: true);
|
| + ensure(compiler, "test", compiler.commonElements.coreLibrary.patch.find,
|
| + expectIsPatch: true, checkHasBody: true);
|
| + compiler.resolver.resolve(origin);
|
| +
|
| + DiagnosticCollector collector = compiler.diagnosticCollector;
|
| + Expect.isTrue(
|
| + collector.warnings.isEmpty, "Unexpected warnings: ${collector.warnings}");
|
| + Expect.equals(1, collector.errors.length);
|
| + Expect.isTrue(collector.errors.first.message.kind ==
|
| + MessageKind.PATCH_TYPE_VARIABLES_MISMATCH);
|
| +}
|
| +
|
| Future testPatchVersioned() async {
|
| String fullPatch = "test(){return 'string';}";
|
| String lazyPatch = "test(){return 'new and improved string';}";
|
| @@ -1086,6 +1139,9 @@ main() {
|
| await testPatchRedirectingConstructor();
|
| await testPatchFunction();
|
| await testPatchFunctionMetadata();
|
| + await testPatchFunctionGeneric();
|
| + await testPatchFunctionGenericExtraTypeVariable();
|
| + await testPatchFunctionGenericDifferentNames();
|
| await testPatchMember();
|
| await testPatchGetter();
|
| await testRegularMember();
|
|
|