OLD | NEW |
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 var assert = chai.assert; | 5 var assert = chai.assert; |
6 var dart_sdk = dart_library.import('dart_sdk'); | 6 var dart_sdk = dart_library.import('dart_sdk'); |
7 var core = dart_sdk.core; | 7 var core = dart_sdk.core; |
8 var collection = dart_sdk.collection; | 8 var collection = dart_sdk.collection; |
9 var dart = dart_sdk.dart; | 9 var dart = dart_sdk.dart; |
10 var dartx = dart.dartx; | 10 var dartx = dart.dartx; |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 | 601 |
602 // Set the type eagerly | 602 // Set the type eagerly |
603 function ii2i(x, y) {return x}; | 603 function ii2i(x, y) {return x}; |
604 dart.fn(ii2i, core.int, [core.int, core.int]); | 604 dart.fn(ii2i, core.int, [core.int, core.int]); |
605 checkType(ii2i, dart.functionType(core.int, | 605 checkType(ii2i, dart.functionType(core.int, |
606 [core.int, core.int])); | 606 [core.int, core.int])); |
607 | 607 |
608 // Set the type lazily | 608 // Set the type lazily |
609 function ss2s(x, y) {return x}; | 609 function ss2s(x, y) {return x}; |
610 var coreString; | 610 var coreString; |
611 dart.fn(ss2s, () => dart.functionType(coreString, | 611 dart.lazyFn(ss2s, () => [coreString, [coreString, coreString]]); |
612 [coreString, coreString])); | |
613 coreString = core.String; | 612 coreString = core.String; |
614 checkType(ss2s, dart.functionType(core.String, | 613 checkType(ss2s, dart.functionType(core.String, |
615 [core.String, core.String])); | 614 [core.String, core.String])); |
616 | 615 |
617 // Optional types | 616 // Optional types |
618 function ii_2i(x, y) {return x}; | 617 function ii_2i(x, y) {return x}; |
619 dart.fn(ii_2i, core.int, [core.int], [core.int]); | 618 dart.fn(ii_2i, core.int, [core.int], [core.int]); |
620 checkType(ii_2i, dart.functionType(core.int, [core.int], | 619 checkType(ii_2i, dart.functionType(core.int, [core.int], |
621 [core.int])); | 620 [core.int])); |
622 checkType(ii_2i, dart.functionType(core.int, [core.int, | 621 checkType(ii_2i, dart.functionType(core.int, [core.int, |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 | 784 |
786 suite('primitives', function() { | 785 suite('primitives', function() { |
787 'use strict'; | 786 'use strict'; |
788 | 787 |
789 test('fixed length list', () => { | 788 test('fixed length list', () => { |
790 let list = new core.List(10); | 789 let list = new core.List(10); |
791 list[0] = 42; | 790 list[0] = 42; |
792 assert.throws(() => list.add(42)); | 791 assert.throws(() => list.add(42)); |
793 }); | 792 }); |
794 }); | 793 }); |
OLD | NEW |