Commit 90d0660
committed
refactor: properly separate type resolution between parser and compiler
**Architecture**:
- Parser builds TypedAST with Type::Unresolved for unknown types
- Parser tracks declared types (from @opaque, struct, enum) for immediate resolution
- Compiler resolves all Type::Unresolved via TypeRegistry before lowering
- SSA builder now sees fully resolved types for proper trait dispatch
**Changes**:
- Added Type::Unresolved variant for types to be resolved by compiler
- Parser tracks declared_types HashMap for types defined in current file
- Added resolve_unresolved_types pass in runtime before lowering
- Removed duplicate type resolution logic from embed runtime
- Fixed constraint solver to handle Type::Unresolved
- Lowering still has Type::Unresolved handling as fallback
**Result**:
Operator overloading with imported types now works correctly - types are
resolved before SSA, enabling proper trait dispatch for binary operations.1 parent 3c873ff commit 90d0660
5 files changed
Lines changed: 268 additions & 32 deletions
File tree
- crates
- compiler/src
- typed_ast/src
- zyn_peg/src
- zyntax_embed/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
966 | 966 | | |
967 | 967 | | |
968 | 968 | | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
969 | 982 | | |
970 | 983 | | |
971 | 984 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
| 251 | + | |
| 252 | + | |
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| |||
2644 | 2645 | | |
2645 | 2646 | | |
2646 | 2647 | | |
| 2648 | + | |
| 2649 | + | |
| 2650 | + | |
| 2651 | + | |
2647 | 2652 | | |
2648 | 2653 | | |
2649 | 2654 | | |
| |||
3400 | 3405 | | |
3401 | 3406 | | |
3402 | 3407 | | |
3403 | | - | |
| 3408 | + | |
| 3409 | + | |
3404 | 3410 | | |
3405 | 3411 | | |
3406 | 3412 | | |
| |||
3458 | 3464 | | |
3459 | 3465 | | |
3460 | 3466 | | |
3461 | | - | |
| 3467 | + | |
3462 | 3468 | | |
3463 | 3469 | | |
3464 | 3470 | | |
| |||
3571 | 3577 | | |
3572 | 3578 | | |
3573 | 3579 | | |
3574 | | - | |
| 3580 | + | |
| 3581 | + | |
3575 | 3582 | | |
3576 | 3583 | | |
3577 | 3584 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
439 | 444 | | |
440 | 445 | | |
441 | 446 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1113 | 1113 | | |
1114 | 1114 | | |
1115 | 1115 | | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
1116 | 1119 | | |
1117 | 1120 | | |
1118 | 1121 | | |
| |||
1145 | 1148 | | |
1146 | 1149 | | |
1147 | 1150 | | |
| 1151 | + | |
1148 | 1152 | | |
1149 | 1153 | | |
1150 | 1154 | | |
| |||
1607 | 1611 | | |
1608 | 1612 | | |
1609 | 1613 | | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
1610 | 1622 | | |
1611 | 1623 | | |
1612 | 1624 | | |
| |||
2090 | 2102 | | |
2091 | 2103 | | |
2092 | 2104 | | |
2093 | | - | |
2094 | | - | |
2095 | | - | |
2096 | | - | |
2097 | | - | |
2098 | | - | |
2099 | | - | |
2100 | | - | |
2101 | | - | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
2102 | 2109 | | |
2103 | 2110 | | |
2104 | 2111 | | |
| |||
2124 | 2131 | | |
2125 | 2132 | | |
2126 | 2133 | | |
2127 | | - | |
2128 | | - | |
2129 | | - | |
2130 | | - | |
2131 | | - | |
2132 | | - | |
2133 | | - | |
2134 | | - | |
2135 | | - | |
2136 | | - | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
2137 | 2144 | | |
2138 | 2145 | | |
2139 | 2146 | | |
| |||
0 commit comments