- Notifications
You must be signed in to change notification settings - Fork26.8k
Commit0aa35ec
fix(compiler-cli): remove the concept of an errored trait (#39967)
Previously, if a trait's analysis step resulted in diagnostics, the traitwould be considered "errored" and no further operations, including register,would be performed. Effectively, this meant that the compiler would pretendthe class in question was actually undecorated.However, this behavior is problematic for several reasons:1. It leads to inaccurate diagnostics being reported downstream.For example, if a component is put into the error state, for example due toa template error, the NgModule which declares the component would produce adiagnostic claiming that the declaration is neither a directive nor a pipe.This happened because the compiler wouldn't register() the component trait,so the component would not be recorded as actually being a directive.2. It can cause incorrect behavior on incremental builds.This bug is more complex, but the general issue is that if the compilerfails to associate a component and its module, then incremental builds willnot correctly re-analyze the module when the component's template changes.Failing to register the component as such is one link in the larger chain ofissues that result in these kinds of issues.3. It lumps together diagnostics produced during analysis and resolve steps.This is not causing issues currently as the dependency graph ensures theright classes are re-analyzed when needed, instead of showing stalediagnostics. However, the dependency graph was not intended to serve thisrole, and could potentially be optimized in ways that would break thisfunctionality.This commit removes the concept of an "errored" trait entirely from thetrait system. Instead, analyzed and resolved traits have corresponding (andseparate) diagnostics, in addition to potentially `null` analysis results.Analysis (but not resolution) diagnostics are carried forward duringincremental build operations. Compilation (emit) is only performed whena trait reaches the resolved state with no diagnostics.This change is functionally different than before as the `register` step isnow performed even in the presence of analysis errors, as long as analysisresults are also produced. This fixes problem 1 above, and is part of thelarger solution to problem 2.PRClose#399671 parent1e3534f commit0aa35ec
File tree
9 files changed
+164
-140
lines changed- packages/compiler-cli
- ngcc
- src/analysis
- test
- analysis
- host
- src/ngtsc/transform
- src
- test/ngtsc
9 files changed
+164
-140
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | | - | |
| 410 | + | |
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
82 | | - | |
| 83 | + | |
| 84 | + | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
86 | | - | |
87 | | - | |
| 88 | + | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
234 | 235 | | |
235 | 236 | | |
236 | 237 | | |
237 | | - | |
| 238 | + | |
| 239 | + | |
238 | 240 | | |
239 | 241 | | |
240 | 242 | | |
241 | | - | |
242 | | - | |
| 243 | + | |
| 244 | + | |
243 | 245 | | |
244 | 246 | | |
245 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
Lines changed: 47 additions & 46 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
185 | | - | |
186 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | | - | |
192 | | - | |
193 | 191 | | |
194 | 192 | | |
195 | 193 | | |
| |||
314 | 312 | | |
315 | 313 | | |
316 | 314 | | |
317 | | - | |
| 315 | + | |
318 | 316 | | |
319 | 317 | | |
320 | 318 | | |
| |||
332 | 330 | | |
333 | 331 | | |
334 | 332 | | |
335 | | - | |
| 333 | + | |
336 | 334 | | |
337 | 335 | | |
338 | 336 | | |
| |||
343 | 341 | | |
344 | 342 | | |
345 | 343 | | |
346 | | - | |
| 344 | + | |
347 | 345 | | |
348 | 346 | | |
349 | 347 | | |
350 | 348 | | |
351 | 349 | | |
352 | 350 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
| 351 | + | |
| 352 | + | |
365 | 353 | | |
| 354 | + | |
| 355 | + | |
366 | 356 | | |
367 | 357 | | |
368 | 358 | | |
| |||
372 | 362 | | |
373 | 363 | | |
374 | 364 | | |
375 | | - | |
376 | | - | |
| 365 | + | |
377 | 366 | | |
378 | | - | |
| 367 | + | |
379 | 368 | | |
380 | 369 | | |
381 | | - | |
| 370 | + | |
382 | 371 | | |
383 | 372 | | |
384 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
385 | 379 | | |
386 | 380 | | |
387 | | - | |
| 381 | + | |
388 | 382 | | |
389 | 383 | | |
390 | 384 | | |
| |||
393 | 387 | | |
394 | 388 | | |
395 | 389 | | |
396 | | - | |
| 390 | + | |
397 | 391 | | |
398 | 392 | | |
399 | 393 | | |
400 | 394 | | |
401 | 395 | | |
402 | 396 | | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
| 397 | + | |
412 | 398 | | |
413 | 399 | | |
414 | 400 | | |
| |||
436 | 422 | | |
437 | 423 | | |
438 | 424 | | |
439 | | - | |
| 425 | + | |
440 | 426 | | |
441 | 427 | | |
442 | 428 | | |
443 | 429 | | |
444 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
445 | 433 | | |
446 | 434 | | |
447 | 435 | | |
| |||
450 | 438 | | |
451 | 439 | | |
452 | 440 | | |
453 | | - | |
| 441 | + | |
454 | 442 | | |
455 | 443 | | |
456 | 444 | | |
457 | 445 | | |
458 | 446 | | |
459 | 447 | | |
460 | 448 | | |
461 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
462 | 452 | | |
463 | 453 | | |
464 | 454 | | |
| |||
475 | 465 | | |
476 | 466 | | |
477 | 467 | | |
478 | | - | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
479 | 471 | | |
480 | 472 | | |
481 | 473 | | |
482 | 474 | | |
483 | 475 | | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
484 | 481 | | |
485 | 482 | | |
486 | 483 | | |
487 | | - | |
| 484 | + | |
488 | 485 | | |
489 | 486 | | |
490 | | - | |
| 487 | + | |
491 | 488 | | |
492 | 489 | | |
493 | 490 | | |
| |||
522 | 519 | | |
523 | 520 | | |
524 | 521 | | |
525 | | - | |
| 522 | + | |
526 | 523 | | |
527 | 524 | | |
528 | 525 | | |
| |||
542 | 539 | | |
543 | 540 | | |
544 | 541 | | |
545 | | - | |
546 | | - | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
547 | 548 | | |
548 | 549 | | |
549 | 550 | | |
| |||
0 commit comments
Comments
(0)