OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// Dart test verifying that method type variables are considered to denote | 5 /// Dart test verifying that method type variables are considered to denote |
6 /// the type `dynamic`. | 6 /// the type `dynamic`. |
7 /// | 7 /// |
8 /// NB: This test is intended to succeed with a `dart2js` with the option | 8 /// NB: This test is intended to succeed with a `dart2js` with the option |
9 /// '--generic-method-syntax', but it should fail with a full implementation | 9 /// '--generic-method-syntax', but it should fail with a full implementation |
10 /// of generic method support, and it should fail with every other tool than | 10 /// of generic method support, and it should fail with every other tool than |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 new C().aMethod<Set>(); | 62 new C().aMethod<Set>(); |
63 } | 63 } |
64 ''', | 64 ''', |
65 'cannot_new_function_type_variable.dart': ''' | 65 'cannot_new_function_type_variable.dart': ''' |
66 X aFunction<X>() => new X(42); | 66 X aFunction<X>() => new X(42); |
67 | 67 |
68 main() { | 68 main() { |
69 aFunction<Set>(); | 69 aFunction<Set>(); |
70 } | 70 } |
71 ''', | 71 ''', |
72 | |
73 'dynamic_as_type_argument.dart': ''' | 72 'dynamic_as_type_argument.dart': ''' |
74 main() { | 73 main() { |
75 method<dynamic>(); | 74 method<dynamic>(); |
76 } | 75 } |
77 method<T>() {} | 76 method<T>() {} |
78 ''', | 77 ''', |
| 78 'malformed_type_argument.dart': ''' |
| 79 main() { |
| 80 method<Unresolved>(); |
| 81 } |
| 82 method<T>() {} |
| 83 ''', |
79 }; | 84 }; |
80 | 85 |
81 Future runTest(Uri main, {MessageKind warning, MessageKind info}) async { | 86 Future runTest(Uri main, {MessageKind warning, MessageKind info}) async { |
82 print("----\nentry-point: $main\n"); | 87 print("----\nentry-point: $main\n"); |
83 | 88 |
84 DiagnosticCollector diagnostics = new DiagnosticCollector(); | 89 DiagnosticCollector diagnostics = new DiagnosticCollector(); |
85 OutputCollector output = new OutputCollector(); | 90 OutputCollector output = new OutputCollector(); |
86 await runCompiler( | 91 await runCompiler( |
87 entryPoint: main, | 92 entryPoint: main, |
88 options: const <String>["--generic-method-syntax"], | 93 options: const <String>["--generic-method-syntax"], |
(...skipping 18 matching lines...) Expand all Loading... |
107 asyncTest(() async { | 112 asyncTest(() async { |
108 await runTest(Uri.parse('memory:type_variable_is_dynamic.dart')); | 113 await runTest(Uri.parse('memory:type_variable_is_dynamic.dart')); |
109 | 114 |
110 await runTest(Uri.parse('memory:cannot_new_method_type_variable.dart'), | 115 await runTest(Uri.parse('memory:cannot_new_method_type_variable.dart'), |
111 warning: MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE); | 116 warning: MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE); |
112 | 117 |
113 await runTest(Uri.parse('memory:cannot_new_function_type_variable.dart'), | 118 await runTest(Uri.parse('memory:cannot_new_function_type_variable.dart'), |
114 warning: MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE); | 119 warning: MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE); |
115 | 120 |
116 await runTest(Uri.parse('memory:dynamic_as_type_argument.dart')); | 121 await runTest(Uri.parse('memory:dynamic_as_type_argument.dart')); |
| 122 |
| 123 await runTest(Uri.parse('memory:malformed_type_argument.dart'), |
| 124 warning: MessageKind.CANNOT_RESOLVE_TYPE); |
117 }); | 125 }); |
118 } | 126 } |
OLD | NEW |