1{ 2 "type": "Program", 3 "statements": [ 4 { 5 "type": "ClassDeclaration", 6 "definition": { 7 "id": { 8 "type": "Identifier", 9 "name": "A", 10 "decorators": [], 11 "loc": { 12 "start": { 13 "line": 16, 14 "column": 7, 15 "program": "function_subtyping_1.ets" 16 }, 17 "end": { 18 "line": 16, 19 "column": 8, 20 "program": "function_subtyping_1.ets" 21 } 22 } 23 }, 24 "superClass": null, 25 "implements": [], 26 "body": [ 27 { 28 "type": "MethodDefinition", 29 "key": { 30 "type": "Identifier", 31 "name": "constructor", 32 "decorators": [], 33 "loc": { 34 "start": { 35 "line": 16, 36 "column": 10, 37 "program": "function_subtyping_1.ets" 38 }, 39 "end": { 40 "line": 16, 41 "column": 10, 42 "program": "function_subtyping_1.ets" 43 } 44 } 45 }, 46 "kind": "constructor", 47 "static": false, 48 "optional": false, 49 "computed": false, 50 "value": { 51 "type": "FunctionExpression", 52 "function": { 53 "type": "ScriptFunction", 54 "id": { 55 "type": "Identifier", 56 "name": "constructor", 57 "decorators": [], 58 "loc": { 59 "start": { 60 "line": 16, 61 "column": 10, 62 "program": "function_subtyping_1.ets" 63 }, 64 "end": { 65 "line": 16, 66 "column": 10, 67 "program": "function_subtyping_1.ets" 68 } 69 } 70 }, 71 "generator": false, 72 "async": false, 73 "expression": false, 74 "params": [], 75 "body": { 76 "type": "BlockStatement", 77 "statements": [], 78 "loc": { 79 "start": { 80 "line": 16, 81 "column": 10, 82 "program": "function_subtyping_1.ets" 83 }, 84 "end": { 85 "line": 16, 86 "column": 10, 87 "program": "function_subtyping_1.ets" 88 } 89 } 90 }, 91 "loc": { 92 "start": { 93 "line": 16, 94 "column": 10, 95 "program": "function_subtyping_1.ets" 96 }, 97 "end": { 98 "line": 16, 99 "column": 10, 100 "program": "function_subtyping_1.ets" 101 } 102 } 103 }, 104 "loc": { 105 "start": { 106 "line": 16, 107 "column": 10, 108 "program": "function_subtyping_1.ets" 109 }, 110 "end": { 111 "line": 16, 112 "column": 10, 113 "program": "function_subtyping_1.ets" 114 } 115 } 116 }, 117 "overloads": [], 118 "decorators": [], 119 "loc": { 120 "start": { 121 "line": 1, 122 "column": 1, 123 "program": null 124 }, 125 "end": { 126 "line": 1, 127 "column": 1, 128 "program": null 129 } 130 } 131 } 132 ], 133 "loc": { 134 "start": { 135 "line": 16, 136 "column": 9, 137 "program": "function_subtyping_1.ets" 138 }, 139 "end": { 140 "line": 17, 141 "column": 6, 142 "program": "function_subtyping_1.ets" 143 } 144 } 145 }, 146 "loc": { 147 "start": { 148 "line": 16, 149 "column": 1, 150 "program": "function_subtyping_1.ets" 151 }, 152 "end": { 153 "line": 17, 154 "column": 6, 155 "program": "function_subtyping_1.ets" 156 } 157 } 158 }, 159 { 160 "type": "ClassDeclaration", 161 "definition": { 162 "id": { 163 "type": "Identifier", 164 "name": "B", 165 "decorators": [], 166 "loc": { 167 "start": { 168 "line": 17, 169 "column": 7, 170 "program": "function_subtyping_1.ets" 171 }, 172 "end": { 173 "line": 17, 174 "column": 8, 175 "program": "function_subtyping_1.ets" 176 } 177 } 178 }, 179 "superClass": { 180 "type": "ETSTypeReference", 181 "part": { 182 "type": "ETSTypeReferencePart", 183 "name": { 184 "type": "Identifier", 185 "name": "A", 186 "decorators": [], 187 "loc": { 188 "start": { 189 "line": 17, 190 "column": 17, 191 "program": "function_subtyping_1.ets" 192 }, 193 "end": { 194 "line": 17, 195 "column": 18, 196 "program": "function_subtyping_1.ets" 197 } 198 } 199 }, 200 "loc": { 201 "start": { 202 "line": 17, 203 "column": 17, 204 "program": "function_subtyping_1.ets" 205 }, 206 "end": { 207 "line": 17, 208 "column": 20, 209 "program": "function_subtyping_1.ets" 210 } 211 } 212 }, 213 "loc": { 214 "start": { 215 "line": 17, 216 "column": 17, 217 "program": "function_subtyping_1.ets" 218 }, 219 "end": { 220 "line": 17, 221 "column": 20, 222 "program": "function_subtyping_1.ets" 223 } 224 } 225 }, 226 "implements": [], 227 "body": [ 228 { 229 "type": "MethodDefinition", 230 "key": { 231 "type": "Identifier", 232 "name": "constructor", 233 "decorators": [], 234 "loc": { 235 "start": { 236 "line": 17, 237 "column": 20, 238 "program": "function_subtyping_1.ets" 239 }, 240 "end": { 241 "line": 17, 242 "column": 20, 243 "program": "function_subtyping_1.ets" 244 } 245 } 246 }, 247 "kind": "constructor", 248 "static": false, 249 "optional": false, 250 "computed": false, 251 "value": { 252 "type": "FunctionExpression", 253 "function": { 254 "type": "ScriptFunction", 255 "id": { 256 "type": "Identifier", 257 "name": "constructor", 258 "decorators": [], 259 "loc": { 260 "start": { 261 "line": 17, 262 "column": 20, 263 "program": "function_subtyping_1.ets" 264 }, 265 "end": { 266 "line": 17, 267 "column": 20, 268 "program": "function_subtyping_1.ets" 269 } 270 } 271 }, 272 "generator": false, 273 "async": false, 274 "expression": false, 275 "params": [], 276 "body": { 277 "type": "BlockStatement", 278 "statements": [], 279 "loc": { 280 "start": { 281 "line": 17, 282 "column": 20, 283 "program": "function_subtyping_1.ets" 284 }, 285 "end": { 286 "line": 17, 287 "column": 20, 288 "program": "function_subtyping_1.ets" 289 } 290 } 291 }, 292 "loc": { 293 "start": { 294 "line": 17, 295 "column": 20, 296 "program": "function_subtyping_1.ets" 297 }, 298 "end": { 299 "line": 17, 300 "column": 20, 301 "program": "function_subtyping_1.ets" 302 } 303 } 304 }, 305 "loc": { 306 "start": { 307 "line": 17, 308 "column": 20, 309 "program": "function_subtyping_1.ets" 310 }, 311 "end": { 312 "line": 17, 313 "column": 20, 314 "program": "function_subtyping_1.ets" 315 } 316 } 317 }, 318 "overloads": [], 319 "decorators": [], 320 "loc": { 321 "start": { 322 "line": 1, 323 "column": 1, 324 "program": null 325 }, 326 "end": { 327 "line": 1, 328 "column": 1, 329 "program": null 330 } 331 } 332 } 333 ], 334 "loc": { 335 "start": { 336 "line": 17, 337 "column": 19, 338 "program": "function_subtyping_1.ets" 339 }, 340 "end": { 341 "line": 19, 342 "column": 9, 343 "program": "function_subtyping_1.ets" 344 } 345 } 346 }, 347 "loc": { 348 "start": { 349 "line": 17, 350 "column": 1, 351 "program": "function_subtyping_1.ets" 352 }, 353 "end": { 354 "line": 19, 355 "column": 9, 356 "program": "function_subtyping_1.ets" 357 } 358 } 359 }, 360 { 361 "type": "ClassDeclaration", 362 "definition": { 363 "id": { 364 "type": "Identifier", 365 "name": "ETSGLOBAL", 366 "decorators": [], 367 "loc": { 368 "start": { 369 "line": 1, 370 "column": 1, 371 "program": "function_subtyping_1.ets" 372 }, 373 "end": { 374 "line": 1, 375 "column": 1, 376 "program": "function_subtyping_1.ets" 377 } 378 } 379 }, 380 "superClass": null, 381 "implements": [], 382 "body": [ 383 { 384 "type": "MethodDefinition", 385 "key": { 386 "type": "Identifier", 387 "name": "_$init$_", 388 "decorators": [], 389 "loc": { 390 "start": { 391 "line": 1, 392 "column": 1, 393 "program": null 394 }, 395 "end": { 396 "line": 1, 397 "column": 1, 398 "program": null 399 } 400 } 401 }, 402 "kind": "method", 403 "accessibility": "public", 404 "static": true, 405 "optional": false, 406 "computed": false, 407 "value": { 408 "type": "FunctionExpression", 409 "function": { 410 "type": "ScriptFunction", 411 "id": { 412 "type": "Identifier", 413 "name": "_$init$_", 414 "decorators": [], 415 "loc": { 416 "start": { 417 "line": 1, 418 "column": 1, 419 "program": null 420 }, 421 "end": { 422 "line": 1, 423 "column": 1, 424 "program": null 425 } 426 } 427 }, 428 "generator": false, 429 "async": false, 430 "expression": false, 431 "params": [], 432 "body": { 433 "type": "BlockStatement", 434 "statements": [], 435 "loc": { 436 "start": { 437 "line": 1, 438 "column": 1, 439 "program": null 440 }, 441 "end": { 442 "line": 1, 443 "column": 1, 444 "program": null 445 } 446 } 447 }, 448 "loc": { 449 "start": { 450 "line": 1, 451 "column": 1, 452 "program": null 453 }, 454 "end": { 455 "line": 1, 456 "column": 1, 457 "program": null 458 } 459 } 460 }, 461 "loc": { 462 "start": { 463 "line": 1, 464 "column": 1, 465 "program": null 466 }, 467 "end": { 468 "line": 1, 469 "column": 1, 470 "program": null 471 } 472 } 473 }, 474 "overloads": [], 475 "decorators": [], 476 "loc": { 477 "start": { 478 "line": 1, 479 "column": 1, 480 "program": "function_subtyping_1.ets" 481 }, 482 "end": { 483 "line": 1, 484 "column": 1, 485 "program": "function_subtyping_1.ets" 486 } 487 } 488 }, 489 { 490 "type": "MethodDefinition", 491 "key": { 492 "type": "Identifier", 493 "name": "main", 494 "decorators": [], 495 "loc": { 496 "start": { 497 "line": 19, 498 "column": 10, 499 "program": "function_subtyping_1.ets" 500 }, 501 "end": { 502 "line": 19, 503 "column": 14, 504 "program": "function_subtyping_1.ets" 505 } 506 } 507 }, 508 "kind": "method", 509 "accessibility": "public", 510 "static": true, 511 "optional": false, 512 "computed": false, 513 "value": { 514 "type": "FunctionExpression", 515 "function": { 516 "type": "ScriptFunction", 517 "id": { 518 "type": "Identifier", 519 "name": "main", 520 "decorators": [], 521 "loc": { 522 "start": { 523 "line": 19, 524 "column": 10, 525 "program": "function_subtyping_1.ets" 526 }, 527 "end": { 528 "line": 19, 529 "column": 14, 530 "program": "function_subtyping_1.ets" 531 } 532 } 533 }, 534 "generator": false, 535 "async": false, 536 "expression": false, 537 "params": [], 538 "returnType": { 539 "type": "ETSPrimitiveType", 540 "loc": { 541 "start": { 542 "line": 19, 543 "column": 18, 544 "program": "function_subtyping_1.ets" 545 }, 546 "end": { 547 "line": 19, 548 "column": 22, 549 "program": "function_subtyping_1.ets" 550 } 551 } 552 }, 553 "body": { 554 "type": "BlockStatement", 555 "statements": [ 556 { 557 "type": "VariableDeclaration", 558 "declarations": [ 559 { 560 "type": "VariableDeclarator", 561 "id": { 562 "type": "Identifier", 563 "name": "x", 564 "typeAnnotation": { 565 "type": "ETSFunctionType", 566 "params": [ 567 { 568 "type": "ETSParameterExpression", 569 "name": { 570 "type": "Identifier", 571 "name": "p", 572 "typeAnnotation": { 573 "type": "ETSTypeReference", 574 "part": { 575 "type": "ETSTypeReferencePart", 576 "name": { 577 "type": "Identifier", 578 "name": "B", 579 "decorators": [], 580 "loc": { 581 "start": { 582 "line": 20, 583 "column": 16, 584 "program": "function_subtyping_1.ets" 585 }, 586 "end": { 587 "line": 20, 588 "column": 17, 589 "program": "function_subtyping_1.ets" 590 } 591 } 592 }, 593 "loc": { 594 "start": { 595 "line": 20, 596 "column": 16, 597 "program": "function_subtyping_1.ets" 598 }, 599 "end": { 600 "line": 20, 601 "column": 18, 602 "program": "function_subtyping_1.ets" 603 } 604 } 605 }, 606 "loc": { 607 "start": { 608 "line": 20, 609 "column": 16, 610 "program": "function_subtyping_1.ets" 611 }, 612 "end": { 613 "line": 20, 614 "column": 18, 615 "program": "function_subtyping_1.ets" 616 } 617 } 618 }, 619 "decorators": [], 620 "loc": { 621 "start": { 622 "line": 20, 623 "column": 13, 624 "program": "function_subtyping_1.ets" 625 }, 626 "end": { 627 "line": 20, 628 "column": 18, 629 "program": "function_subtyping_1.ets" 630 } 631 } 632 }, 633 "loc": { 634 "start": { 635 "line": 20, 636 "column": 13, 637 "program": "function_subtyping_1.ets" 638 }, 639 "end": { 640 "line": 20, 641 "column": 18, 642 "program": "function_subtyping_1.ets" 643 } 644 } 645 } 646 ], 647 "returnType": { 648 "type": "ETSTypeReference", 649 "part": { 650 "type": "ETSTypeReferencePart", 651 "name": { 652 "type": "Identifier", 653 "name": "A", 654 "decorators": [], 655 "loc": { 656 "start": { 657 "line": 20, 658 "column": 22, 659 "program": "function_subtyping_1.ets" 660 }, 661 "end": { 662 "line": 20, 663 "column": 23, 664 "program": "function_subtyping_1.ets" 665 } 666 } 667 }, 668 "loc": { 669 "start": { 670 "line": 20, 671 "column": 22, 672 "program": "function_subtyping_1.ets" 673 }, 674 "end": { 675 "line": 20, 676 "column": 25, 677 "program": "function_subtyping_1.ets" 678 } 679 } 680 }, 681 "loc": { 682 "start": { 683 "line": 20, 684 "column": 22, 685 "program": "function_subtyping_1.ets" 686 }, 687 "end": { 688 "line": 20, 689 "column": 25, 690 "program": "function_subtyping_1.ets" 691 } 692 } 693 }, 694 "loc": { 695 "start": { 696 "line": 20, 697 "column": 12, 698 "program": "function_subtyping_1.ets" 699 }, 700 "end": { 701 "line": 20, 702 "column": 25, 703 "program": "function_subtyping_1.ets" 704 } 705 } 706 }, 707 "decorators": [], 708 "loc": { 709 "start": { 710 "line": 20, 711 "column": 9, 712 "program": "function_subtyping_1.ets" 713 }, 714 "end": { 715 "line": 20, 716 "column": 10, 717 "program": "function_subtyping_1.ets" 718 } 719 } 720 }, 721 "init": { 722 "type": "ArrowFunctionExpression", 723 "function": { 724 "type": "ScriptFunction", 725 "id": null, 726 "generator": false, 727 "async": false, 728 "expression": false, 729 "params": [ 730 { 731 "type": "ETSParameterExpression", 732 "name": { 733 "type": "Identifier", 734 "name": "p", 735 "typeAnnotation": { 736 "type": "ETSTypeReference", 737 "part": { 738 "type": "ETSTypeReferencePart", 739 "name": { 740 "type": "Identifier", 741 "name": "A", 742 "decorators": [], 743 "loc": { 744 "start": { 745 "line": 20, 746 "column": 30, 747 "program": "function_subtyping_1.ets" 748 }, 749 "end": { 750 "line": 20, 751 "column": 31, 752 "program": "function_subtyping_1.ets" 753 } 754 } 755 }, 756 "loc": { 757 "start": { 758 "line": 20, 759 "column": 30, 760 "program": "function_subtyping_1.ets" 761 }, 762 "end": { 763 "line": 20, 764 "column": 32, 765 "program": "function_subtyping_1.ets" 766 } 767 } 768 }, 769 "loc": { 770 "start": { 771 "line": 20, 772 "column": 30, 773 "program": "function_subtyping_1.ets" 774 }, 775 "end": { 776 "line": 20, 777 "column": 32, 778 "program": "function_subtyping_1.ets" 779 } 780 } 781 }, 782 "decorators": [], 783 "loc": { 784 "start": { 785 "line": 20, 786 "column": 27, 787 "program": "function_subtyping_1.ets" 788 }, 789 "end": { 790 "line": 20, 791 "column": 32, 792 "program": "function_subtyping_1.ets" 793 } 794 } 795 }, 796 "loc": { 797 "start": { 798 "line": 20, 799 "column": 27, 800 "program": "function_subtyping_1.ets" 801 }, 802 "end": { 803 "line": 20, 804 "column": 32, 805 "program": "function_subtyping_1.ets" 806 } 807 } 808 } 809 ], 810 "returnType": { 811 "type": "ETSTypeReference", 812 "part": { 813 "type": "ETSTypeReferencePart", 814 "name": { 815 "type": "Identifier", 816 "name": "B", 817 "decorators": [], 818 "loc": { 819 "start": { 820 "line": 20, 821 "column": 34, 822 "program": "function_subtyping_1.ets" 823 }, 824 "end": { 825 "line": 20, 826 "column": 35, 827 "program": "function_subtyping_1.ets" 828 } 829 } 830 }, 831 "loc": { 832 "start": { 833 "line": 20, 834 "column": 34, 835 "program": "function_subtyping_1.ets" 836 }, 837 "end": { 838 "line": 20, 839 "column": 38, 840 "program": "function_subtyping_1.ets" 841 } 842 } 843 }, 844 "loc": { 845 "start": { 846 "line": 20, 847 "column": 34, 848 "program": "function_subtyping_1.ets" 849 }, 850 "end": { 851 "line": 20, 852 "column": 38, 853 "program": "function_subtyping_1.ets" 854 } 855 } 856 }, 857 "body": { 858 "type": "BlockStatement", 859 "statements": [ 860 { 861 "type": "ReturnStatement", 862 "argument": { 863 "type": "ETSNewClassInstanceExpression", 864 "typeReference": { 865 "type": "ETSTypeReference", 866 "part": { 867 "type": "ETSTypeReferencePart", 868 "name": { 869 "type": "Identifier", 870 "name": "B", 871 "decorators": [], 872 "loc": { 873 "start": { 874 "line": 20, 875 "column": 52, 876 "program": "function_subtyping_1.ets" 877 }, 878 "end": { 879 "line": 20, 880 "column": 53, 881 "program": "function_subtyping_1.ets" 882 } 883 } 884 }, 885 "loc": { 886 "start": { 887 "line": 20, 888 "column": 52, 889 "program": "function_subtyping_1.ets" 890 }, 891 "end": { 892 "line": 20, 893 "column": 54, 894 "program": "function_subtyping_1.ets" 895 } 896 } 897 }, 898 "loc": { 899 "start": { 900 "line": 20, 901 "column": 52, 902 "program": "function_subtyping_1.ets" 903 }, 904 "end": { 905 "line": 20, 906 "column": 54, 907 "program": "function_subtyping_1.ets" 908 } 909 } 910 }, 911 "arguments": [], 912 "loc": { 913 "start": { 914 "line": 20, 915 "column": 48, 916 "program": "function_subtyping_1.ets" 917 }, 918 "end": { 919 "line": 20, 920 "column": 57, 921 "program": "function_subtyping_1.ets" 922 } 923 } 924 }, 925 "loc": { 926 "start": { 927 "line": 20, 928 "column": 41, 929 "program": "function_subtyping_1.ets" 930 }, 931 "end": { 932 "line": 20, 933 "column": 57, 934 "program": "function_subtyping_1.ets" 935 } 936 } 937 } 938 ], 939 "loc": { 940 "start": { 941 "line": 20, 942 "column": 39, 943 "program": "function_subtyping_1.ets" 944 }, 945 "end": { 946 "line": 20, 947 "column": 57, 948 "program": "function_subtyping_1.ets" 949 } 950 } 951 }, 952 "loc": { 953 "start": { 954 "line": 20, 955 "column": 26, 956 "program": "function_subtyping_1.ets" 957 }, 958 "end": { 959 "line": 20, 960 "column": 57, 961 "program": "function_subtyping_1.ets" 962 } 963 } 964 }, 965 "loc": { 966 "start": { 967 "line": 20, 968 "column": 26, 969 "program": "function_subtyping_1.ets" 970 }, 971 "end": { 972 "line": 20, 973 "column": 57, 974 "program": "function_subtyping_1.ets" 975 } 976 } 977 }, 978 "loc": { 979 "start": { 980 "line": 20, 981 "column": 9, 982 "program": "function_subtyping_1.ets" 983 }, 984 "end": { 985 "line": 20, 986 "column": 57, 987 "program": "function_subtyping_1.ets" 988 } 989 } 990 } 991 ], 992 "kind": "let", 993 "loc": { 994 "start": { 995 "line": 20, 996 "column": 5, 997 "program": "function_subtyping_1.ets" 998 }, 999 "end": { 1000 "line": 20, 1001 "column": 57, 1002 "program": "function_subtyping_1.ets" 1003 } 1004 } 1005 } 1006 ], 1007 "loc": { 1008 "start": { 1009 "line": 19, 1010 "column": 23, 1011 "program": "function_subtyping_1.ets" 1012 }, 1013 "end": { 1014 "line": 21, 1015 "column": 2, 1016 "program": "function_subtyping_1.ets" 1017 } 1018 } 1019 }, 1020 "loc": { 1021 "start": { 1022 "line": 19, 1023 "column": 10, 1024 "program": "function_subtyping_1.ets" 1025 }, 1026 "end": { 1027 "line": 21, 1028 "column": 2, 1029 "program": "function_subtyping_1.ets" 1030 } 1031 } 1032 }, 1033 "loc": { 1034 "start": { 1035 "line": 19, 1036 "column": 10, 1037 "program": "function_subtyping_1.ets" 1038 }, 1039 "end": { 1040 "line": 21, 1041 "column": 2, 1042 "program": "function_subtyping_1.ets" 1043 } 1044 } 1045 }, 1046 "overloads": [], 1047 "decorators": [], 1048 "loc": { 1049 "start": { 1050 "line": 19, 1051 "column": 1, 1052 "program": "function_subtyping_1.ets" 1053 }, 1054 "end": { 1055 "line": 21, 1056 "column": 2, 1057 "program": "function_subtyping_1.ets" 1058 } 1059 } 1060 } 1061 ], 1062 "loc": { 1063 "start": { 1064 "line": 1, 1065 "column": 1, 1066 "program": "function_subtyping_1.ets" 1067 }, 1068 "end": { 1069 "line": 1, 1070 "column": 1, 1071 "program": "function_subtyping_1.ets" 1072 } 1073 } 1074 }, 1075 "loc": { 1076 "start": { 1077 "line": 1, 1078 "column": 1, 1079 "program": "function_subtyping_1.ets" 1080 }, 1081 "end": { 1082 "line": 1, 1083 "column": 1, 1084 "program": "function_subtyping_1.ets" 1085 } 1086 } 1087 } 1088 ], 1089 "loc": { 1090 "start": { 1091 "line": 1, 1092 "column": 1, 1093 "program": "function_subtyping_1.ets" 1094 }, 1095 "end": { 1096 "line": 21, 1097 "column": 2, 1098 "program": "function_subtyping_1.ets" 1099 } 1100 } 1101} 1102