Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1207)

Unified Diff: tests/compiler/dart2js/patch_test.dart

Issue 2535213003: Support patched generic methods. (Closed)
Patch Set: Add tests for renaming. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/resolution/signatures.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « pkg/compiler/lib/src/resolution/signatures.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698