Repository navigation
Commit 57b93bf
committed
fix(incremental): re-link inbound edges across an arity change
Arity is now part of a node's identity, so adding or removing a parameter
renames the node. An edit that changed both a function's body and its signature
dropped every inbound cross-file edge into it until each caller's file happened
to be re-parsed. A full reindex and an incremental reindex of the same tree
disagreed.
incr_restore_inbound_edges keeps exact QN as its primary key, as it always was.
When that misses and the captured target carries a fence, a node whose QN
differs only by its fence is the same function, so the edge follows it.
Ambiguity (several arities of the same name in the same container) keeps the old
behaviour and drops the edge, because nothing says which arity the caller meant.
The lookup goes through an index. Restoring N captured edges against a graph of
M nodes scanned all M for every fenced miss, so the pass cost the product of the
two largest quantities in an incremental reindex. One walk builds the table and
each miss after it is a hash lookup. The walk is deferred to the first fenced
miss, so a corpus with no arity fences (every language but Elixir today) builds
nothing and pays nothing.
An allocation failure mid-build marks the index unusable rather than partial. A
partial index would answer "sole match" for a name whose rival arity never got
inserted.
Measured on a two-file Elixir fixture: caller calls `landing/1`, then the file
declaring `landing` is edited to `landing/2` and reindexed incrementally. Before
this commit the CALLS edge is gone from the incremental store and present in a
full reindex of the same final tree; after, both stores bind the same
`...landing#2`. With two surviving arities the incremental store drops the edge
and so does the full reindex. The test there asserts that the two stores agree,
not that the edge survives.
tests/test_pipeline.c: pipeline_incremental_preserves_edges_across_arity_change
and pipeline_incremental_ambiguous_arity_successor_matches_full_index. Both
compare the target's qualified_name rather than its bare name, because
cross_file_edge_exists matches nodes by name and every arity of one function
looks alike to it.
Depends on #N+6 (module/arity identity) and #N+9 (resolution), which make the
pre-edit edge exist to be captured.
Signed-off-by: Chad <4307099+BobbieBarker@users.noreply.github.com>1 parent 117b91d commit 57b93bf
2 files changed
Lines changed: 322 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
988 | 988 | | |
989 | 989 | | |
990 | 990 | | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
991 | 1111 | | |
992 | | - | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
993 | 1122 | | |
994 | 1123 | | |
| 1124 | + | |
995 | 1125 | | |
996 | 1126 | | |
997 | 1127 | | |
998 | 1128 | | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
999 | 1132 | | |
1000 | 1133 | | |
1001 | 1134 | | |
1002 | 1135 | | |
1003 | 1136 | | |
| 1137 | + | |
1004 | 1138 | | |
1005 | 1139 | | |
1006 | 1140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1017 | 1017 | | |
1018 | 1018 | | |
1019 | 1019 | | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
1020 | 1058 | | |
1021 | 1059 | | |
1022 | 1060 | | |
| |||
15107 | 15145 | | |
15108 | 15146 | | |
15109 | 15147 | | |
| 15148 | + | |
| 15149 | + | |
| 15150 | + | |
| 15151 | + | |
| 15152 | + | |
| 15153 | + | |
| 15154 | + | |
| 15155 | + | |
| 15156 | + | |
| 15157 | + | |
| 15158 | + | |
| 15159 | + | |
| 15160 | + | |
| 15161 | + | |
| 15162 | + | |
| 15163 | + | |
| 15164 | + | |
| 15165 | + | |
| 15166 | + | |
| 15167 | + | |
| 15168 | + | |
| 15169 | + | |
| 15170 | + | |
| 15171 | + | |
| 15172 | + | |
| 15173 | + | |
| 15174 | + | |
| 15175 | + | |
| 15176 | + | |
| 15177 | + | |
| 15178 | + | |
| 15179 | + | |
| 15180 | + | |
| 15181 | + | |
| 15182 | + | |
| 15183 | + | |
| 15184 | + | |
| 15185 | + | |
| 15186 | + | |
| 15187 | + | |
| 15188 | + | |
| 15189 | + | |
| 15190 | + | |
| 15191 | + | |
| 15192 | + | |
| 15193 | + | |
| 15194 | + | |
| 15195 | + | |
| 15196 | + | |
| 15197 | + | |
| 15198 | + | |
| 15199 | + | |
| 15200 | + | |
| 15201 | + | |
| 15202 | + | |
| 15203 | + | |
| 15204 | + | |
| 15205 | + | |
| 15206 | + | |
| 15207 | + | |
| 15208 | + | |
| 15209 | + | |
| 15210 | + | |
| 15211 | + | |
| 15212 | + | |
| 15213 | + | |
| 15214 | + | |
| 15215 | + | |
| 15216 | + | |
| 15217 | + | |
| 15218 | + | |
| 15219 | + | |
| 15220 | + | |
| 15221 | + | |
| 15222 | + | |
| 15223 | + | |
| 15224 | + | |
| 15225 | + | |
| 15226 | + | |
| 15227 | + | |
| 15228 | + | |
| 15229 | + | |
| 15230 | + | |
| 15231 | + | |
| 15232 | + | |
| 15233 | + | |
| 15234 | + | |
| 15235 | + | |
| 15236 | + | |
| 15237 | + | |
| 15238 | + | |
| 15239 | + | |
| 15240 | + | |
| 15241 | + | |
| 15242 | + | |
| 15243 | + | |
| 15244 | + | |
| 15245 | + | |
| 15246 | + | |
| 15247 | + | |
| 15248 | + | |
| 15249 | + | |
| 15250 | + | |
| 15251 | + | |
| 15252 | + | |
| 15253 | + | |
| 15254 | + | |
| 15255 | + | |
| 15256 | + | |
| 15257 | + | |
| 15258 | + | |
| 15259 | + | |
| 15260 | + | |
| 15261 | + | |
| 15262 | + | |
| 15263 | + | |
| 15264 | + | |
| 15265 | + | |
| 15266 | + | |
| 15267 | + | |
| 15268 | + | |
| 15269 | + | |
| 15270 | + | |
| 15271 | + | |
| 15272 | + | |
| 15273 | + | |
| 15274 | + | |
| 15275 | + | |
| 15276 | + | |
| 15277 | + | |
| 15278 | + | |
| 15279 | + | |
| 15280 | + | |
| 15281 | + | |
| 15282 | + | |
| 15283 | + | |
| 15284 | + | |
| 15285 | + | |
| 15286 | + | |
| 15287 | + | |
| 15288 | + | |
| 15289 | + | |
| 15290 | + | |
| 15291 | + | |
| 15292 | + | |
| 15293 | + | |
| 15294 | + | |
15110 | 15295 | | |
15111 | 15296 | | |
15112 | 15297 | | |
| |||
15230 | 15415 | | |
15231 | 15416 | | |
15232 | 15417 | | |
| 15418 | + | |
| 15419 | + | |
15233 | 15420 | | |
15234 | 15421 | | |
15235 | 15422 | | |
| |||
0 commit comments