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

Side by Side Diff: tests/language_strong/covariant_subtyping_test.dart

Issue 2995973002: Gardening: Revert "fix #30423, covariant parameter tearoff type should be Object" (TBR) (Closed)
Patch Set: Created 3 years, 4 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'package:expect/expect.dart'; 4 import 'package:expect/expect.dart';
5 5
6 bool isTypeError(e) => e is TypeError; 6 bool isTypeError(e) => e is TypeError;
7 7
8 class Fields<T> { 8 class Fields<T> {
9 T x; 9 T x;
10 T _y; 10 T _y;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 testCallMethod() { 214 testCallMethod() {
215 ClassF<int> cc = new ClassF<int>(); 215 ClassF<int> cc = new ClassF<int>();
216 ClassF<Object> ca = cc; // An upcast, per covariance. 216 ClassF<Object> ca = cc; // An upcast, per covariance.
217 F<Object> f = ca; 217 F<Object> f = ca;
218 Expect.equals(f.runtimeType.toString(), 'ClassF<int>'); 218 Expect.equals(f.runtimeType.toString(), 'ClassF<int>');
219 Expect.throws(() { 219 Expect.throws(() {
220 f(new Object()); 220 f(new Object());
221 }, isTypeError); 221 }, isTypeError);
222 } 222 }
223 223
224 class TearOff<T> {
225 method1(T t) => null; // needs check
226 method2(Function(T) takesT) => null;
227 method3(T Function() returnsT) => null; // needs check
228 method4(Function(Function(T)) takesTakesT) => null; // needs check
229 method5(Function(T Function()) takesReturnsT) => null;
230 method6(Function(T) Function() returnsTakesT) => null;
231 method7(T Function() Function() returnsReturnsT) => null; // needs check
232 }
233
234 testTearOffRuntimeType() {
235 expectRTTI(tearoff, type) => Expect.equals('${tearoff.runtimeType}', type,
236 'covariant params should reify with Object as their type');
237
238 TearOff<num> t = new TearOff<int>();
239 expectRTTI(t.method1, '(Object) -> dynamic');
240
241 expectRTTI(t.method2, '((int) -> dynamic) -> dynamic');
242 expectRTTI(t.method3, '(Object) -> dynamic');
243
244 expectRTTI(t.method4, '(Object) -> dynamic');
245 expectRTTI(t.method5, '((() -> int) -> dynamic) -> dynamic');
246 expectRTTI(t.method6, '(() -> (int) -> dynamic) -> dynamic');
247 expectRTTI(t.method7, '(Object) -> dynamic');
248 }
249
250 main() { 224 main() {
251 testField(); 225 testField();
252 testPrivateFields(); 226 testPrivateFields();
253 testClassBounds(); 227 testClassBounds();
254 testReturnOfFunctionType(); 228 testReturnOfFunctionType();
255 testTearoffReturningFunctionType(); 229 testTearoffReturningFunctionType();
256 testFieldOfFunctionType(); 230 testFieldOfFunctionType();
257 testFieldOfGenericFunctionType(); 231 testFieldOfGenericFunctionType();
258 testMixinApplication(); 232 testMixinApplication();
259 testGenericMethodBounds(); 233 testGenericMethodBounds();
260 testCallMethod(); 234 testCallMethod();
261 testTearOffRuntimeType();
262 } 235 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/test/codegen_expected/closure.js ('k') | tests/language_strong/function_subtype2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698