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

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

Issue 1171713002: remove ClosureWrap option and related implementation (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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 | « lib/src/testing.dart ('k') | test/checker/inferred_type_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 /// 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:test/test.dart'; 8 import 'package:test/test.dart';
9 9
10 import 'package:dev_compiler/src/testing.dart'; 10 import 'package:dev_compiler/src/testing.dart';
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 '/main.dart': ''' 1064 '/main.dart': '''
1065 1065
1066 class A { 1066 class A {
1067 void bar() => null; 1067 void bar() => null;
1068 void foo() => bar; // allowed 1068 void foo() => bar; // allowed
1069 } 1069 }
1070 ''' 1070 '''
1071 }); 1071 });
1072 }); 1072 });
1073 1073
1074 test('Closure wrapping of literals', () {
1075 testChecker({
1076 '/main.dart': '''
1077 typedef T F<T>(T t1, T t2);
1078 typedef dynamic D(t1, t2);
1079
1080 void main() {
1081 F f1 = (x, y) => /*info:DynamicInvoke*/x + y;
1082 F<int> f2 = /*warning:ClosureWrapLiteral*/(x, y) => /*info:DynamicInvoke */x + y;
1083 D f3 = (x, y) => /*info:DynamicInvoke*/x + y;
1084 Function f4 = (x, y) => /*info:DynamicInvoke*/x + y;
1085 f2 = /*warning:ClosureWrap*/f1;
1086 f1 = (int x, int y) => x + y;
1087 f2 = /*severe:StaticTypeError*/(int x) => -x;
1088 }
1089 '''
1090 }, wrapClosures: true, inferDownwards: false);
1091 });
1092
1093 test('Generic subtyping: invariance', () { 1074 test('Generic subtyping: invariance', () {
1094 testChecker({ 1075 testChecker({
1095 '/main.dart': ''' 1076 '/main.dart': '''
1096 1077
1097 class A {} 1078 class A {}
1098 class B extends A {} 1079 class B extends A {}
1099 class C implements A {} 1080 class C implements A {}
1100 1081
1101 class L<T> {} 1082 class L<T> {}
1102 class M<T> extends L<T> {} 1083 class M<T> extends L<T> {}
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after
3028 '/main.dart': ''' 3009 '/main.dart': '''
3029 import 'dart:foobar' show Baz; 3010 import 'dart:foobar' show Baz;
3030 main() { 3011 main() {
3031 print(Baz.quux); 3012 print(Baz.quux);
3032 }''' 3013 }'''
3033 }, 3014 },
3034 customUrlMappings: { 3015 customUrlMappings: {
3035 'dart:foobar': '$testDirectory/checker/dart_foobar.dart' 3016 'dart:foobar': '$testDirectory/checker/dart_foobar.dart'
3036 })); 3017 }));
3037 } 3018 }
OLDNEW
« no previous file with comments | « lib/src/testing.dart ('k') | test/checker/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698