| 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 | 6 |
| 7 suite('generic', () => { | 7 suite('generic', () => { |
| 8 "use strict"; | 8 "use strict"; |
| 9 | 9 |
| 10 let generic = dart.generic; | 10 let generic = dart.generic; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 class A {} | 109 class A {} |
| 110 class B extends A {} | 110 class B extends A {} |
| 111 class C extends B {} | 111 class C extends B {} |
| 112 | 112 |
| 113 let AA$ = generic((T, U) => class AA extends core.Object {}); | 113 let AA$ = generic((T, U) => class AA extends core.Object {}); |
| 114 let AA = AA$(); | 114 let AA = AA$(); |
| 115 let BB$ = generic((T, U) => class BB extends AA$(U, T) {}); | 115 let BB$ = generic((T, U) => class BB extends AA$(U, T) {}); |
| 116 let BB = BB$(); | 116 let BB = BB$(); |
| 117 class CC extends BB$(String, List) {} | 117 class CC extends BB$(String, List) {} |
| 118 | 118 |
| 119 let Func2 = typedef('Func2', functionType(dynamic, [dynamic, dynamic])); | 119 let Func2 = typedef('Func2', () => functionType(dynamic, [dynamic, dynamic])); |
| 120 let Foo = typedef('Foo', functionType(B, [B, String])); | 120 let Foo = typedef('Foo', () => functionType(B, [B, String])); |
| 121 | 121 |
| 122 let FuncG$ = generic((T, U) => typedef('FuncG', functionType(T, [T, U]))) | 122 let FuncG$ = generic((T, U) => typedef('FuncG', () => functionType(T, [T, U]))
) |
| 123 let FuncG = FuncG$(); | 123 let FuncG = FuncG$(); |
| 124 | 124 |
| 125 // TODO(vsm): Revisit when we encode types on functions properly. | 125 // TODO(vsm): Revisit when we encode types on functions properly. |
| 126 // A bar1(C c, String s) => null; | 126 // A bar1(C c, String s) => null; |
| 127 function bar1(c, s) { return null; } | 127 function bar1(c, s) { return null; } |
| 128 setRuntimeType(bar1, functionType(A, [C, String])); | 128 setRuntimeType(bar1, functionType(A, [C, String])); |
| 129 | 129 |
| 130 // bar2(B b, String s) => null; | 130 // bar2(B b, String s) => null; |
| 131 function bar2(b, s) { return null; } | 131 function bar2(b, s) { return null; } |
| 132 setRuntimeType(bar2, functionType(dynamic, [B, String])); | 132 setRuntimeType(bar2, functionType(dynamic, [B, String])); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 401 |
| 402 suite('primitives', function() { | 402 suite('primitives', function() { |
| 403 'use strict'; | 403 'use strict'; |
| 404 | 404 |
| 405 test('fixed length list', () => { | 405 test('fixed length list', () => { |
| 406 let list = new core.List(10); | 406 let list = new core.List(10); |
| 407 list[0] = 42; | 407 list[0] = 42; |
| 408 assert.throws(() => list.add(42)); | 408 assert.throws(() => list.add(42)); |
| 409 }); | 409 }); |
| 410 }); | 410 }); |
| OLD | NEW |