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

Side by Side Diff: test/checker/checker_test.dart

Issue 1055923002: Don't call dinvoke on Object methods (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: modify test Created 5 years, 8 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
« lib/src/checker/rules.dart ('K') | « lib/src/codegen/js_codegen.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// General type checking tests 5 /// General type checking tests
6 library dev_compiler.test.checker_test; 6 library dev_compiler.test.checker_test;
7 7
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 import 'package:dev_compiler/src/testing.dart'; 10 import 'package:dev_compiler/src/testing.dart';
11 11
12 import '../test_util.dart'; 12 import '../test_util.dart';
13 13
14 void main() { 14 void main() {
15 configureTest(); 15 configureTest();
16 16
17 test('conversion and dynamic invoke', () { 17 test('conversion and dynamic invoke', () {
18 testChecker({ 18 testChecker({
19 '/helper.dart': '''
20 dynamic toString = (int x) => x + 42;
21 dynamic hashCode = "hello";
22 ''',
19 '/main.dart': ''' 23 '/main.dart': '''
24 import 'helper.dart' as helper;
25
20 class A { 26 class A {
21 String x = "hello world"; 27 String x = "hello world";
22 28
23 void baz1(y) => x + y; 29 void baz1(y) => x + y;
24 static baz2(y) => y + y; 30 static baz2(y) => y + y;
25 } 31 }
26 32
27 void foo(String str) { 33 void foo(String str) {
28 print(str); 34 print(str);
29 } 35 }
(...skipping 21 matching lines...) Expand all
51 (/*warning:DynamicInvoke*/f3("hello")); 57 (/*warning:DynamicInvoke*/f3("hello"));
52 (/*warning:DynamicInvoke*/f3(42)); 58 (/*warning:DynamicInvoke*/f3(42));
53 StrFun f4 = foo; 59 StrFun f4 = foo;
54 f4("hello"); 60 f4("hello");
55 a.baz1("hello"); 61 a.baz1("hello");
56 var b1 = a.baz1; 62 var b1 = a.baz1;
57 (/*warning:DynamicInvoke*/b1("hello")); 63 (/*warning:DynamicInvoke*/b1("hello"));
58 A.baz2("hello"); 64 A.baz2("hello");
59 var b2 = A.baz2; 65 var b2 = A.baz2;
60 (/*warning:DynamicInvoke*/b2("hello")); 66 (/*warning:DynamicInvoke*/b2("hello"));
67
68 dynamic a1 = new A();
69 (/*warning:DynamicInvoke*/a1.x);
70 a1.toString();
71 a1.hashCode;
72
73 dynamic toString = () => null;
74 (/*warning:DynamicInvoke*/toString());
75
76 (/*warning:DynamicInvoke*/helper.toString());
77 int hashCode = /*info:DynamicCast*/helper.hashCode;
61 ''' 78 '''
62 }); 79 });
63 }); 80 });
64 81
65 test('Primitives', () { 82 test('Primitives', () {
66 testChecker({ 83 testChecker({
67 '/main.dart': ''' 84 '/main.dart': '''
68 int /*severe:InvalidVariableDeclaration*/a; 85 int /*severe:InvalidVariableDeclaration*/a;
69 double /*severe:InvalidVariableDeclaration*/b; 86 double /*severe:InvalidVariableDeclaration*/b;
70 num c; 87 num c;
(...skipping 2729 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 f = bar as II2D; 2817 f = bar as II2D;
2801 f = bar as DD2I; 2818 f = bar as DD2I;
2802 f = bar as DI2D; 2819 f = bar as DI2D;
2803 f = bar as ID2D; 2820 f = bar as ID2D;
2804 f = bar as DD2D; 2821 f = bar as DD2D;
2805 } 2822 }
2806 ''' 2823 '''
2807 }); 2824 });
2808 }); 2825 });
2809 } 2826 }
OLDNEW
« lib/src/checker/rules.dart ('K') | « lib/src/codegen/js_codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698