Commit a1bde15
Josh Learn
[diagnose-unreachable] Fix incorrect diagnostic on keypath creation
If the property referred to by the final component of a KeyPath is a
type that is considered uninhabited by the compiler (e.g. caseless enums),
we currently emit an unreachable code warning at the location of the KeyPath
expression. This warning is emitted by the NoReturnFolding pass of the SILOptimizer
when it checks the property getter function generated for the KeyPath. This
change fixes the issue by emitting keypath accessor functions with artificial
SILLocations so that the diagnostics pass will skip it as non-user-written code.
rdar://804158111 parent ce660f5 commit a1bde15
File tree
3 files changed
+78
-7
lines changed- lib/SILGen
- test
- SILGen
- SILOptimizer
3 files changed
+78
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2692 | 2692 | | |
2693 | 2693 | | |
2694 | 2694 | | |
2695 | | - | |
2696 | 2695 | | |
2697 | 2696 | | |
2698 | 2697 | | |
| |||
2759 | 2758 | | |
2760 | 2759 | | |
2761 | 2760 | | |
| 2761 | + | |
| 2762 | + | |
2762 | 2763 | | |
2763 | 2764 | | |
2764 | 2765 | | |
| |||
2806 | 2807 | | |
2807 | 2808 | | |
2808 | 2809 | | |
2809 | | - | |
2810 | 2810 | | |
2811 | 2811 | | |
2812 | 2812 | | |
| |||
2832 | 2832 | | |
2833 | 2833 | | |
2834 | 2834 | | |
2835 | | - | |
2836 | 2835 | | |
2837 | 2836 | | |
2838 | 2837 | | |
| |||
2907 | 2906 | | |
2908 | 2907 | | |
2909 | 2908 | | |
| 2909 | + | |
2910 | 2910 | | |
2911 | 2911 | | |
2912 | 2912 | | |
| |||
3536 | 3536 | | |
3537 | 3537 | | |
3538 | 3538 | | |
3539 | | - | |
| 3539 | + | |
3540 | 3540 | | |
3541 | 3541 | | |
3542 | 3542 | | |
3543 | 3543 | | |
3544 | 3544 | | |
3545 | | - | |
| 3545 | + | |
3546 | 3546 | | |
3547 | 3547 | | |
3548 | 3548 | | |
| |||
3587 | 3587 | | |
3588 | 3588 | | |
3589 | 3589 | | |
3590 | | - | |
| 3590 | + | |
3591 | 3591 | | |
3592 | 3592 | | |
3593 | 3593 | | |
| |||
3596 | 3596 | | |
3597 | 3597 | | |
3598 | 3598 | | |
3599 | | - | |
| 3599 | + | |
3600 | 3600 | | |
3601 | 3601 | | |
3602 | 3602 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
0 commit comments