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

Side by Side Diff: pkg/analyzer/test/src/task/strong/checker_test.dart

Issue 2651653006: Make Future.value() constructor in MockSdk consistent with the actual SDK. (Closed)
Patch Set: Created 3 years, 11 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) 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 library analyzer.test.src.task.strong.checker_test; 5 library analyzer.test.src.task.strong.checker_test;
6 6
7 import 'package:test_reflective_loader/test_reflective_loader.dart'; 7 import 'package:test_reflective_loader/test_reflective_loader.dart';
8 8
9 import 'strong_test_helper.dart'; 9 import 'strong_test_helper.dart';
10 10
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 void test_functionModifiers_async() { 930 void test_functionModifiers_async() {
931 checkFile(''' 931 checkFile('''
932 import 'dart:async'; 932 import 'dart:async';
933 import 'dart:math' show Random; 933 import 'dart:math' show Random;
934 934
935 dynamic x; 935 dynamic x;
936 936
937 foo1() async => x; 937 foo1() async => x;
938 Future foo2() async => x; 938 Future foo2() async => x;
939 Future<int> foo3() async => x; 939 Future<int> foo3() async => x;
940 Future<int> foo4() async => new Future<int>.value(/*info:DYNAMIC_CAST*/x); 940 Future<int> foo4() async => new Future<int>.value(x);
941 Future<int> foo5() async => 941 Future<int> foo5() async =>
942 /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(/*info:DYNAMIC_CAST */x); 942 /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(x);
943 943
944 bar1() async { return x; } 944 bar1() async { return x; }
945 Future bar2() async { return x; } 945 Future bar2() async { return x; }
946 Future<int> bar3() async { return x; } 946 Future<int> bar3() async { return x; }
947 Future<int> bar4() async { return new Future<int>.value(/*info:DYNAMIC_CAST*/x); } 947 Future<int> bar4() async { return new Future<int>.value(x); }
948 Future<int> bar5() async { 948 Future<int> bar5() async {
949 return /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(/*info:DYNAMIC _CAST*/x); 949 return /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(x);
950 } 950 }
951 951
952 int y; 952 int y;
953 Future<int> z; 953 Future<int> z;
954 954
955 baz() async { 955 baz() async {
956 int a = /*info:DYNAMIC_CAST*/await x; 956 int a = /*info:DYNAMIC_CAST*/await x;
957 int b = await y; 957 int b = await y;
958 int c = await z; 958 int c = await z;
959 String d = /*error:INVALID_ASSIGNMENT*/await z; 959 String d = /*error:INVALID_ASSIGNMENT*/await z;
(...skipping 3067 matching lines...) Expand 10 before | Expand all | Expand 10 after
4027 // Regression test for https://github.com/dart-lang/sdk/issues/25069 4027 // Regression test for https://github.com/dart-lang/sdk/issues/25069
4028 checkFile(''' 4028 checkFile('''
4029 typedef int Foo(); 4029 typedef int Foo();
4030 void foo() {} 4030 void foo() {}
4031 void main () { 4031 void main () {
4032 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); 4032 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo();
4033 } 4033 }
4034 '''); 4034 ''');
4035 } 4035 }
4036 } 4036 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/context/mock_sdk.dart ('k') | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698