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

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

Issue 1266483003: format with dart_style 0.2.0-rc.3 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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
« no previous file with comments | « test/checker/checker_test.dart ('k') | test/checker/self_host_test.dart » ('j') | 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 /// Tests for type inference. 5 /// Tests for type inference.
6 library dev_compiler.test.inferred_type_test; 6 library dev_compiler.test.inferred_type_test;
7 7
8 import 'package:test/test.dart'; 8 import 'package:test/test.dart';
9 9
10 import '../testing.dart'; 10 import '../testing.dart';
(...skipping 22 matching lines...) Expand all
33 }); 33 });
34 34
35 test('Error when declared type is `int` and assigned null.', () { 35 test('Error when declared type is `int` and assigned null.', () {
36 testChecker({ 36 testChecker({
37 '/main.dart': ''' 37 '/main.dart': '''
38 test1() { 38 test1() {
39 int x = 3; 39 int x = 3;
40 x = /*severe:StaticTypeError*/null; 40 x = /*severe:StaticTypeError*/null;
41 } 41 }
42 ''' 42 '''
43 }, nonnullableTypes: <String>['int', 'double']); 43 }, nonnullableTypes: <String>[
44 'int',
45 'double'
46 ]);
44 }); 47 });
45 48
46 test('Error when inferred type is `int` and assigned null.', () { 49 test('Error when inferred type is `int` and assigned null.', () {
47 testChecker({ 50 testChecker({
48 '/main.dart': ''' 51 '/main.dart': '''
49 test1() { 52 test1() {
50 var x = 3; 53 var x = 3;
51 x = /*severe:StaticTypeError*/null; 54 x = /*severe:StaticTypeError*/null;
52 } 55 }
53 ''' 56 '''
54 }, nonnullableTypes: <String>['int', 'double']); 57 }, nonnullableTypes: <String>[
58 'int',
59 'double'
60 ]);
55 }); 61 });
56 62
57 test('No error when declared type is `num` and assigned null.', () { 63 test('No error when declared type is `num` and assigned null.', () {
58 testChecker({ 64 testChecker({
59 '/main.dart': ''' 65 '/main.dart': '''
60 test1() { 66 test1() {
61 num x = 3; 67 num x = 3;
62 x = null; 68 x = null;
63 } 69 }
64 ''' 70 '''
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 Function2<int, int> l1 = /*info:InferredTypeClosure*/(x) => /*info:Dyn amicInvoke should be pass*/x+1; 1515 Function2<int, int> l1 = /*info:InferredTypeClosure*/(x) => /*info:Dyn amicInvoke should be pass*/x+1;
1510 Function2<int, String> l2 = /*info:InferredTypeClosure should be sever e:StaticTypeError*/(x) => x; 1516 Function2<int, String> l2 = /*info:InferredTypeClosure should be sever e:StaticTypeError*/(x) => x;
1511 Function2<int, String> l3 = /*info:InferredTypeClosure should be sever e:StaticTypeError*/(x) => /*info:DynamicInvoke should be pass*/x.substring(3); 1517 Function2<int, String> l3 = /*info:InferredTypeClosure should be sever e:StaticTypeError*/(x) => /*info:DynamicInvoke should be pass*/x.substring(3);
1512 Function2<String, String> l4 = /*info:InferredTypeClosure*/(x) => /*in fo:DynamicInvoke should be pass*/x.substring(3); 1518 Function2<String, String> l4 = /*info:InferredTypeClosure*/(x) => /*in fo:DynamicInvoke should be pass*/x.substring(3);
1513 } 1519 }
1514 } 1520 }
1515 ''' 1521 '''
1516 }, inferDownwards: true); 1522 }, inferDownwards: true);
1517 }); 1523 });
1518 1524
1519 test('inferred initializing formal checks default value', () => testChecker({ 1525 test(
1520 '/main.dart': ''' 1526 'inferred initializing formal checks default value',
1527 () => testChecker({
1528 '/main.dart': '''
1521 class Foo { 1529 class Foo {
1522 var x = 1; 1530 var x = 1;
1523 Foo([this.x = /*severe:StaticTypeError*/"1"]); 1531 Foo([this.x = /*severe:StaticTypeError*/"1"]);
1524 }''' 1532 }'''
1525 })); 1533 }));
1526 } 1534 }
OLDNEW
« no previous file with comments | « test/checker/checker_test.dart ('k') | test/checker/self_host_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698