OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/issue10747_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__issue10747_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const dart = dart_sdk.dart; |
| 8 const dartx = dart_sdk.dartx; |
| 9 const expect$ = expect.expect; |
| 10 const issue10747_test = Object.create(null); |
| 11 let B = () => (B = dart.constFn(issue10747_test.B$()))(); |
| 12 let A = () => (A = dart.constFn(issue10747_test.A$()))(); |
| 13 let AOfint = () => (AOfint = dart.constFn(issue10747_test.A$(core.int)))(); |
| 14 let AOfString = () => (AOfString = dart.constFn(issue10747_test.A$(core.String
)))(); |
| 15 let BOfint = () => (BOfint = dart.constFn(issue10747_test.B$(core.int)))(); |
| 16 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da
rt.void, [])))(); |
| 17 let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionT
ype(core.bool, [dart.dynamic])))(); |
| 18 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 19 issue10747_test.B$ = dart.generic(T => { |
| 20 class B extends core.Object {} |
| 21 dart.addTypeTests(B); |
| 22 return B; |
| 23 }); |
| 24 issue10747_test.B = B(); |
| 25 issue10747_test.A$ = dart.generic(T => { |
| 26 let BOfT = () => (BOfT = dart.constFn(issue10747_test.B$(T)))(); |
| 27 class A extends core.Object { |
| 28 new(field) { |
| 29 this.field = field; |
| 30 } |
| 31 asTypeVariable() { |
| 32 return T.as(this.field); |
| 33 } |
| 34 asBOfT() { |
| 35 return BOfT().as(this.field); |
| 36 } |
| 37 } |
| 38 dart.addTypeTests(A); |
| 39 dart.setSignature(A, { |
| 40 constructors: () => ({new: dart.definiteFunctionType(issue10747_test.A$(T)
, [dart.dynamic])}), |
| 41 methods: () => ({ |
| 42 asTypeVariable: dart.definiteFunctionType(dart.dynamic, []), |
| 43 asBOfT: dart.definiteFunctionType(dart.dynamic, []) |
| 44 }) |
| 45 }); |
| 46 return A; |
| 47 }); |
| 48 issue10747_test.A = A(); |
| 49 issue10747_test.main = function() { |
| 50 expect$.Expect.equals(42, new (AOfint())(42).asTypeVariable()); |
| 51 expect$.Expect.throws(dart.fn(() => new (AOfString())(42).asTypeVariable(),
VoidTovoid()), dart.fn(e => core.CastError.is(e), dynamicTobool())); |
| 52 let b = new (BOfint())(); |
| 53 expect$.Expect.equals(b, new (AOfint())(b).asBOfT()); |
| 54 expect$.Expect.throws(dart.fn(() => new (AOfString())(b).asBOfT(), VoidTovoi
d()), dart.fn(e => core.CastError.is(e), dynamicTobool())); |
| 55 }; |
| 56 dart.fn(issue10747_test.main, VoidTodynamic()); |
| 57 // Exports: |
| 58 exports.issue10747_test = issue10747_test; |
| 59 }); |
OLD | NEW |