Commit 57778f2
committed
refactor: use same error types for const and expression record updates
Refactor the record update logic so const updates use the same error types as
regular record updates. This produces consistent messages for users and removes
cases where similar problems surfaced in different forms.
The change:
- restores InvalidRecordConstructor instead of InvalidRecordUpdate with reasons
- uses UnsafeRecordUpdate for variant mismatches to align with expression handling
- adds a constructor_location field so the compiler can point at the constructor when
reporting InvalidRecordConstructor
- and introduces validation for incompatible field types in spreads1 parent 111eea2 commit 57778f2
File tree
19 files changed
+179
-94
lines changed- compiler-core/src
- ast
- parse/snapshots
- type_
- snapshots
- tests/snapshots
19 files changed
+179
-94
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
| 693 | + | |
693 | 694 | | |
694 | 695 | | |
695 | 696 | | |
| |||
699 | 700 | | |
700 | 701 | | |
701 | 702 | | |
702 | | - | |
| 703 | + | |
703 | 704 | | |
704 | 705 | | |
705 | 706 | | |
| |||
800 | 801 | | |
801 | 802 | | |
802 | 803 | | |
| 804 | + | |
803 | 805 | | |
804 | 806 | | |
805 | 807 | | |
| |||
1044 | 1046 | | |
1045 | 1047 | | |
1046 | 1048 | | |
| 1049 | + | |
1047 | 1050 | | |
1048 | 1051 | | |
1049 | 1052 | | |
| |||
1052 | 1055 | | |
1053 | 1056 | | |
1054 | 1057 | | |
1055 | | - | |
| 1058 | + | |
1056 | 1059 | | |
1057 | 1060 | | |
1058 | 1061 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
985 | 985 | | |
986 | 986 | | |
987 | 987 | | |
| 988 | + | |
988 | 989 | | |
989 | 990 | | |
990 | 991 | | |
991 | 992 | | |
992 | 993 | | |
993 | 994 | | |
994 | 995 | | |
995 | | - | |
| 996 | + | |
996 | 997 | | |
997 | 998 | | |
998 | 999 | | |
| |||
1096 | 1097 | | |
1097 | 1098 | | |
1098 | 1099 | | |
| 1100 | + | |
1099 | 1101 | | |
1100 | 1102 | | |
1101 | 1103 | | |
1102 | 1104 | | |
1103 | 1105 | | |
1104 | 1106 | | |
1105 | 1107 | | |
| 1108 | + | |
1106 | 1109 | | |
1107 | 1110 | | |
1108 | 1111 | | |
| |||
1218 | 1221 | | |
1219 | 1222 | | |
1220 | 1223 | | |
| 1224 | + | |
1221 | 1225 | | |
1222 | 1226 | | |
1223 | 1227 | | |
| |||
1237 | 1241 | | |
1238 | 1242 | | |
1239 | 1243 | | |
| 1244 | + | |
1240 | 1245 | | |
1241 | 1246 | | |
1242 | 1247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
3096 | 3096 | | |
3097 | 3097 | | |
3098 | 3098 | | |
3099 | | - | |
3100 | | - | |
3101 | | - | |
3102 | | - | |
3103 | | - | |
3104 | | - | |
3105 | | - | |
3106 | | - | |
3107 | | - | |
3108 | | - | |
3109 | | - | |
3110 | | - | |
3111 | | - | |
3112 | | - | |
3113 | | - | |
3114 | | - | |
3115 | | - | |
3116 | | - | |
3117 | | - | |
3118 | | - | |
3119 | | - | |
3120 | | - | |
3121 | | - | |
3122 | | - | |
3123 | | - | |
3124 | | - | |
3125 | | - | |
3126 | | - | |
3127 | | - | |
3128 | | - | |
3129 | | - | |
3130 | | - | |
3131 | | - | |
3132 | | - | |
3133 | | - | |
3134 | | - | |
3135 | | - | |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
| 3102 | + | |
| 3103 | + | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
| 3113 | + | |
3136 | 3114 | | |
3137 | 3115 | | |
3138 | 3116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3371 | 3371 | | |
3372 | 3372 | | |
3373 | 3373 | | |
| 3374 | + | |
3374 | 3375 | | |
3375 | 3376 | | |
3376 | 3377 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
258 | 257 | | |
259 | 258 | | |
260 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
261 | 264 | | |
262 | 265 | | |
263 | 266 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
212 | 216 | | |
213 | 217 | | |
214 | 218 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
212 | 216 | | |
213 | 217 | | |
214 | 218 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | 142 | | |
156 | 143 | | |
157 | 144 | | |
| |||
353 | 340 | | |
354 | 341 | | |
355 | 342 | | |
356 | | - | |
| 343 | + | |
357 | 344 | | |
358 | | - | |
359 | 345 | | |
360 | 346 | | |
361 | 347 | | |
| |||
1295 | 1281 | | |
1296 | 1282 | | |
1297 | 1283 | | |
1298 | | - | |
| 1284 | + | |
1299 | 1285 | | |
1300 | 1286 | | |
1301 | 1287 | | |
| |||
0 commit comments