Commit b714cdd
committed
types: a module's interface carries the records and opaque types it references
ModuleExports held only what a module declares, so anything its exports
referred to fell off at the next boundary: an extern type could not be
named across a module at all (#72, there was no slot for it), and a
record reached only through another module's exports had invisible
fields (#75, the field registry crossed one hop while the type crossed
two).
Both get the same treatment the scheme side got in #26: the interface
now closes over what it references. extern type declarations export as
name + arity and register in a consumer like any imported type, clash
check included. Records and opaque types mentioned by exported schemes,
constructors, or record fields are pulled from the imports' interfaces,
tagged with their declaring module, and re-exported; the walk follows
newly pulled records and terminates on cycles.
A carried type registers under its bare identity name only, so it can
be named, unified, and field-accessed, while construction and patterns
still require importing the declaring module. A taken bare name skips
the carried entry silently (local and direct declarations win; the same
record along two paths is admitted once), and a shadowed record's
fields feed the unknown-field diagnostic, which now names the record
and the module that declares it. Record updates in a consumer that
never imports the declaring module reconstruct via that module's class,
with its import hoisted.
Closes #75
Closes #721 parent 27edeea commit b714cdd
6 files changed
Lines changed: 853 additions & 99 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
893 | 893 | | |
894 | 894 | | |
895 | 895 | | |
896 | | - | |
| 896 | + | |
| 897 | + | |
897 | 898 | | |
898 | 899 | | |
899 | 900 | | |
| |||
904 | 905 | | |
905 | 906 | | |
906 | 907 | | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
911 | 923 | | |
912 | 924 | | |
913 | 925 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
433 | | - | |
434 | | - | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
435 | 436 | | |
436 | 437 | | |
437 | 438 | | |
| |||
456 | 457 | | |
457 | 458 | | |
458 | 459 | | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
459 | 476 | | |
460 | 477 | | |
461 | 478 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
125 | 131 | | |
126 | 132 | | |
127 | 133 | | |
| |||
149 | 155 | | |
150 | 156 | | |
151 | 157 | | |
| 158 | + | |
152 | 159 | | |
153 | 160 | | |
154 | 161 | | |
| |||
318 | 325 | | |
319 | 326 | | |
320 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
321 | 333 | | |
322 | 334 | | |
323 | 335 | | |
| |||
610 | 622 | | |
611 | 623 | | |
612 | 624 | | |
| 625 | + | |
613 | 626 | | |
614 | 627 | | |
615 | 628 | | |
| |||
2850 | 2863 | | |
2851 | 2864 | | |
2852 | 2865 | | |
2853 | | - | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
2854 | 2870 | | |
2855 | 2871 | | |
2856 | | - | |
| 2872 | + | |
2857 | 2873 | | |
2858 | 2874 | | |
2859 | 2875 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
246 | 249 | | |
247 | | - | |
248 | 250 | | |
249 | 251 | | |
250 | 252 | | |
| |||
294 | 296 | | |
295 | 297 | | |
296 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
297 | 319 | | |
298 | 320 | | |
299 | 321 | | |
| |||
0 commit comments