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

Unified Diff: test/checker/checker_test.dart

Issue 1092183003: Handle calls through call methods (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/checker/rules.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/checker/checker_test.dart
diff --git a/test/checker/checker_test.dart b/test/checker/checker_test.dart
index b499d4a9bb257819723c0528099e843e0ff70d3e..931ac0b995416f6da3dadc8fc8e58b6051372b98 100644
--- a/test/checker/checker_test.dart
+++ b/test/checker/checker_test.dart
@@ -14,6 +14,55 @@ import '../test_util.dart';
void main() {
configureTest();
+ test('dynamic invocation', () {
+ testChecker({
+ '/main.dart': '''
+
+ class A {
+ dynamic call(dynamic x) => x;
+ }
+ class B extends A {
+ int call(int x) => x;
+ double col(double x) => x;
+ }
+ void main() {
+ {
+ B f = new B();
+ int x;
+ double y;
+ // The analyzer has what I believe is a bug (dartbug.com/23252) which
+ // causes the return type of calls to f to be treated as dynamic.
+ x = /*info:DynamicCast should be pass*/f(3);
+ x = /*severe:StaticTypeError*/f.col(3.0);
+ y = /*info:DynamicCast should be severe:StaticTypeError*/f(3);
+ y = f.col(3.0);
+ f(/*severe:StaticTypeError*/3.0);
+ f.col(/*severe:StaticTypeError*/3);
+ }
+ {
+ Function f = new B();
+ int x;
+ double y;
+ x = /*info:DynamicCast, info:DynamicInvoke*/f(3);
+ x = /*info:DynamicCast, info:DynamicInvoke*/f.col(3.0);
+ y = /*info:DynamicCast, info:DynamicInvoke*/f(3);
+ y = /*info:DynamicCast, info:DynamicInvoke*/f.col(3.0);
+ (/*info:DynamicInvoke*/f(3.0));
+ (/*info:DynamicInvoke*/f.col(3));
+ }
+ {
+ A f = new B();
+ int x;
+ double y;
+ x = /*info:DynamicCast, info:DynamicInvoke*/f(3);
+ y = /*info:DynamicCast, info:DynamicInvoke*/f(3);
+ (/*info:DynamicInvoke*/f(3.0));
+ }
+ }
+ '''
+ });
+ });
+
test('conversion and dynamic invoke', () {
testChecker({
'/helper.dart': '''
@@ -91,6 +140,7 @@ void main() {
baz().toString();
baz().hashCode;
+ }
'''
});
});
« no previous file with comments | « lib/src/checker/rules.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698