Commit 9099b51
Move circular definition detection from runtime to compile-time
Based on PR feedback, circular definitions like `a = a` are now detected
during type checking rather than at runtime in the interpreter.
Changes:
- Add `circular_def` problem type to Check with clear error message
- Detect circular non-function definitions in the `.processing` case
when checking local lookups
- Allow recursive functions (lambdas and closures) to reference themselves
- Keep runtime check as safety net for edge cases
The compile-time check provides better error messages and catches the
issue earlier in the compilation pipeline.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent a120549 commit 9099b51
File tree
4 files changed
+91
-7
lines changed- src/check
- test/snapshots
- fuzz_crash
- nominal
4 files changed
+91
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3359 | 3359 | | |
3360 | 3360 | | |
3361 | 3361 | | |
3362 | | - | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
| 3380 | + | |
| 3381 | + | |
| 3382 | + | |
| 3383 | + | |
| 3384 | + | |
| 3385 | + | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
| 3389 | + | |
| 3390 | + | |
| 3391 | + | |
3363 | 3392 | | |
3364 | 3393 | | |
3365 | 3394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
102 | 111 | | |
103 | 112 | | |
104 | 113 | | |
| |||
587 | 596 | | |
588 | 597 | | |
589 | 598 | | |
| 599 | + | |
590 | 600 | | |
591 | 601 | | |
592 | 602 | | |
| |||
3307 | 3317 | | |
3308 | 3318 | | |
3309 | 3319 | | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
| 3330 | + | |
| 3331 | + | |
| 3332 | + | |
| 3333 | + | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
| 3347 | + | |
| 3348 | + | |
| 3349 | + | |
| 3350 | + | |
| 3351 | + | |
3310 | 3352 | | |
3311 | 3353 | | |
3312 | 3354 | | |
| |||
Binary file not shown.
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
483 | 483 | | |
484 | 484 | | |
485 | 485 | | |
| 486 | + | |
486 | 487 | | |
487 | 488 | | |
488 | 489 | | |
| |||
530 | 531 | | |
531 | 532 | | |
532 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
533 | 546 | | |
534 | 547 | | |
535 | 548 | | |
| |||
3611 | 3624 | | |
3612 | 3625 | | |
3613 | 3626 | | |
3614 | | - | |
3615 | | - | |
3616 | | - | |
| 3627 | + | |
| 3628 | + | |
| 3629 | + | |
3617 | 3630 | | |
3618 | 3631 | | |
3619 | 3632 | | |
| |||
3945 | 3958 | | |
3946 | 3959 | | |
3947 | 3960 | | |
3948 | | - | |
3949 | | - | |
3950 | | - | |
| 3961 | + | |
| 3962 | + | |
| 3963 | + | |
3951 | 3964 | | |
3952 | 3965 | | |
3953 | 3966 | | |
| |||
0 commit comments