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

Side by Side Diff: tests/compiler/dart2js/cpa_inference_test.dart

Issue 11412148: Fix handling of sends with wrong arity (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address Karl's comments Created 8 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 import "dart:uri"; 5 import "dart:uri";
6 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t"; 6 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t";
7 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da rt'; 7 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da rt';
8 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; 8 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart';
9 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'; 9 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart';
10 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; 10 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart';
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 } 581 }
582 main () { 582 main () {
583 new A(); 583 new A();
584 } 584 }
585 """; 585 """;
586 AnalysisResult result = analyze(source); 586 AnalysisResult result = analyze(source);
587 result.checkFieldHasType('A', 'x', [result.nullType]); 587 result.checkFieldHasType('A', 'x', [result.nullType]);
588 result.checkFieldHasType('A', 'y', [result.int]); 588 result.checkFieldHasType('A', 'y', [result.int]);
589 } 589 }
590 590
591 testSendWithWrongArity() {
592 final String source = r"""
593 f(x) { }
594 class A { g(x) { } }
595 main () {
596 var x = f();
597 var y = f(1, 2);
598 var z = new A().g();
599 var w = new A().g(1, 2);
600 x; y; z; w;
601 }
602 """;
603 AnalysisResult result = analyze(source);
604 result.checkNodeHasType('x', []);
605 result.checkNodeHasType('y', []);
606 result.checkNodeHasType('z', []);
607 result.checkNodeHasType('w', []);
608 }
609
591 void main() { 610 void main() {
592 testLiterals(); 611 testLiterals();
593 testRedefinition(); 612 testRedefinition();
594 testIfThenElse(); 613 testIfThenElse();
595 testTernaryIf(); 614 testTernaryIf();
596 testWhile(); 615 testWhile();
597 testFor1(); 616 testFor1();
598 testFor2(); 617 testFor2();
599 testNonRecusiveFunction(); 618 testNonRecusiveFunction();
600 testRecusiveFunction(); 619 testRecusiveFunction();
601 testMutuallyRecusiveFunction(); 620 testMutuallyRecusiveFunction();
602 testSendToThis1(); 621 testSendToThis1();
603 testSendToThis2(); 622 testSendToThis2();
604 testConstructor(); 623 testConstructor();
605 testGetters(); 624 testGetters();
606 testSetters(); 625 testSetters();
607 testNamedParameters(); 626 testNamedParameters();
608 testListLiterals(); 627 testListLiterals();
609 testMapLiterals(); 628 testMapLiterals();
610 testReturn(); 629 testReturn();
611 // testNoReturn(); // right now we infer the empty type instead of null 630 // testNoReturn(); // right now we infer the empty type instead of null
612 testArithmeticOperators(); 631 testArithmeticOperators();
613 testOperators(); 632 testOperators();
614 testCompoundOperators1(); 633 testCompoundOperators1();
615 testCompoundOperators2(); 634 testCompoundOperators2();
616 // testFieldInitialization(); // TODO(polux) 635 // testFieldInitialization(); // TODO(polux)
636 testSendWithWrongArity();
617 } 637 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698