Commit 9dcec05
committed
Fix non-public imported declaration diagnostic bug
When DiagnosticEngine needs to diagnose something about an imported declaration, it uses ASTPrinter to print the declaration’s interface into a source buffer and then diagnoses it there. However, this code only printed public declarations, so it failed to account for features like `@testable import` which allow less-than-public declarations to be imported. Errors involving these declarations would therefore be diagnosed at <unknown>:0.
This commit changes DiagnosticEngine to determine the access level of the declaration it needs to print and, if it is below `Public`, instead prints a separate interface whose minimum access level is low enough to include the desired declaration.1 parent 5c877c5 commit 9dcec05
File tree
5 files changed
+59
-10
lines changed- include/swift/AST
- lib
- AST
- Sema
- test/diagnostics
- Inputs
5 files changed
+59
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
502 | | - | |
| 502 | + | |
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
515 | | - | |
| 515 | + | |
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
525 | | - | |
| 525 | + | |
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
846 | 846 | | |
847 | 847 | | |
848 | 848 | | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
849 | 863 | | |
850 | 864 | | |
851 | 865 | | |
| |||
867 | 881 | | |
868 | 882 | | |
869 | 883 | | |
| 884 | + | |
870 | 885 | | |
871 | 886 | | |
872 | 887 | | |
873 | 888 | | |
874 | | - | |
875 | | - | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
876 | 892 | | |
877 | 893 | | |
878 | | - | |
| 894 | + | |
| 895 | + | |
879 | 896 | | |
880 | 897 | | |
881 | 898 | | |
882 | 899 | | |
883 | 900 | | |
884 | 901 | | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
885 | 909 | | |
886 | 910 | | |
887 | 911 | | |
| |||
942 | 966 | | |
943 | 967 | | |
944 | 968 | | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
945 | 979 | | |
946 | 980 | | |
947 | | - | |
948 | | - | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
949 | 984 | | |
950 | 985 | | |
951 | 986 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2974 | 2974 | | |
2975 | 2975 | | |
2976 | 2976 | | |
2977 | | - | |
| 2977 | + | |
| 2978 | + | |
2978 | 2979 | | |
2979 | | - | |
2980 | 2980 | | |
2981 | 2981 | | |
2982 | 2982 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments