Commit 31f2278
committed
Consolidate various isdefined functionality into a new builtin
In #54999 I extended `:isdefined` with the ability to specify whether
or not to consider imported bindings defined. As a result, we now have
two mechanisms for querying `isdefined` on globals (the other being
`Core.isdefined`) with incompatible feature sets (`Core.isdefined`
supports an atomic ordering argument, but not `allow_import`).
Additionally, only one of them had proper codegen support.
I also don't like to have IR forms for things that could be
perfectly well handled by builtin calls (along the lines of #56713).
So this tries to clean that all up by:
1. Adding a new builtin `isdefinedglobal` that has the full feature set
2. Dropping `:isdefined` on globals as an IR form (the frontend form gets
lowered to the intrinsic if called on globals)
3. Wiring up codegen and correcting inference for that new builtin
An additional motivation is that `isdefined` on globals needs support
for partition edges (like other builtins), and having to have a special
case for :isdefined was marginally annoying. Just using an intrinsic
for this is much cleaner.
Lastly, the reason for a new intrinsic over extending the existing
`isdefined`, is that over time we've moved away from conflating
fields and globals for Module (e.g. introducing `getglobal`/`setglobal!`),
so this is a natural extension of that. Of course, the existing
behavior is retained for ordinary `isdefined`.1 parent ec2b509 commit 31f2278
File tree
12 files changed
+243
-95
lines changed- Compiler/src
- base
- docs
- src
- test
12 files changed
+243
-95
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2637 | 2637 | | |
2638 | 2638 | | |
2639 | 2639 | | |
2640 | | - | |
2641 | | - | |
2642 | | - | |
2643 | | - | |
2644 | | - | |
2645 | | - | |
2646 | | - | |
2647 | | - | |
2648 | | - | |
2649 | | - | |
2650 | | - | |
2651 | | - | |
2652 | | - | |
2653 | | - | |
2654 | | - | |
| 2640 | + | |
| 2641 | + | |
| 2642 | + | |
| 2643 | + | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
| 2647 | + | |
2655 | 2648 | | |
2656 | 2649 | | |
2657 | 2650 | | |
| |||
3203 | 3196 | | |
3204 | 3197 | | |
3205 | 3198 | | |
3206 | | - | |
| 3199 | + | |
| 3200 | + | |
3207 | 3201 | | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
3208 | 3206 | | |
3209 | | - | |
3210 | | - | |
3211 | | - | |
3212 | | - | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
3213 | 3217 | | |
3214 | 3218 | | |
3215 | 3219 | | |
3216 | 3220 | | |
3217 | 3221 | | |
3218 | | - | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
| 3232 | + | |
| 3233 | + | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
| 3242 | + | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
| 3247 | + | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
3219 | 3251 | | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
| 3257 | + | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
3220 | 3269 | | |
3221 | 3270 | | |
3222 | 3271 | | |
| |||
3443 | 3492 | | |
3444 | 3493 | | |
3445 | 3494 | | |
3446 | | - | |
| 3495 | + | |
3447 | 3496 | | |
3448 | 3497 | | |
3449 | 3498 | | |
| 3499 | + | |
| 3500 | + | |
3450 | 3501 | | |
| 3502 | + | |
3451 | 3503 | | |
3452 | 3504 | | |
3453 | 3505 | | |
3454 | 3506 | | |
3455 | 3507 | | |
| 3508 | + | |
| 3509 | + | |
3456 | 3510 | | |
| 3511 | + | |
| 3512 | + | |
| 3513 | + | |
3457 | 3514 | | |
3458 | 3515 | | |
3459 | 3516 | | |
3460 | 3517 | | |
3461 | | - | |
| 3518 | + | |
| 3519 | + | |
3462 | 3520 | | |
3463 | 3521 | | |
3464 | 3522 | | |
| |||
3468 | 3526 | | |
3469 | 3527 | | |
3470 | 3528 | | |
3471 | | - | |
| 3529 | + | |
3472 | 3530 | | |
3473 | 3531 | | |
3474 | 3532 | | |
3475 | 3533 | | |
3476 | 3534 | | |
3477 | | - | |
3478 | 3535 | | |
3479 | 3536 | | |
3480 | 3537 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2754 | 2754 | | |
2755 | 2755 | | |
2756 | 2756 | | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
2757 | 2760 | | |
2758 | 2761 | | |
2759 | 2762 | | |
| |||
2781 | 2784 | | |
2782 | 2785 | | |
2783 | 2786 | | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
2784 | 2818 | | |
2785 | 2819 | | |
2786 | 2820 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1352 | 1352 | | |
1353 | 1353 | | |
1354 | 1354 | | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
1355 | 1382 | | |
1356 | 1383 | | |
1357 | 1384 | | |
| |||
2451 | 2478 | | |
2452 | 2479 | | |
2453 | 2480 | | |
| 2481 | + | |
2454 | 2482 | | |
2455 | 2483 | | |
2456 | 2484 | | |
| |||
0 commit comments