Commit ab4fc52
[analyzer] Use LocatableDiagnostic in constant evaluation.
Changes the error reporting logic in analyzer constant evaluation so
that diagnostic messages are converted as early as possible into
`LocatableDiagnostic` objects by using the statically-checked
`.withArguments` methods. Thereafter, the `LocatableDiagnostic`
objects are passed around but not modified further (except to add
context messages when appropriate).
This should make it impossible for bugs like
#61761 to occur during constant
evaluation, by preventing the diagnostic code for a constant
evaluation error from getting out of sync with the corresponding
arguments.
Change-Id: I6a6a69646130b5a19cbacba8e964fcdebf20d10f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459941
Commit-Queue: Paul Berry <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>1 parent c30b974 commit ab4fc52
File tree
4 files changed
+257
-288
lines changed- pkg/analyzer/lib/src/dart
- constant
- element
4 files changed
+257
-288
lines changedLines changed: 9 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
672 | 673 | | |
673 | 674 | | |
674 | 675 | | |
675 | | - | |
| 676 | + | |
676 | 677 | | |
677 | 678 | | |
678 | 679 | | |
| |||
803 | 804 | | |
804 | 805 | | |
805 | 806 | | |
806 | | - | |
807 | | - | |
808 | | - | |
| 807 | + | |
| 808 | + | |
809 | 809 | | |
810 | 810 | | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | 811 | | |
815 | 812 | | |
816 | 813 | | |
| |||
911 | 908 | | |
912 | 909 | | |
913 | 910 | | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
919 | | - | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
920 | 916 | | |
921 | 917 | | |
922 | 918 | | |
| |||
0 commit comments