Commit 007485f
[analyzer] Dot shorthands: Issue 61209 - Constant parameter mismatch error fix.
In the specific case where a dot shorthand is referencing a const constructor invocation of a imported class and the constructor has an optional parameter with a default value, the analyzer currently fails to compute the the constant result from that default value.
With the changes in this CL, we're properly calculating the dependencies we need to do that computation and prevent the `const_constructor_param_type_mismatch` error. We're missing a couple of visitors for the `DotShorthandConstructorInvocation` AST that tell the constant evaluator to evaluate its dependencies. This should work exactly like visiting `InstanceCreationExpression`s, in the same class.
Fixes: #61209
Bug: #59835
Change-Id: I6544e11e19f814b62108a736d1c778f8c4eda0cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446181
Reviewed-by: Chloe Stefantsova <[email protected]>
Commit-Queue: Kallen Tu <[email protected]>1 parent 2e8c2a5 commit 007485f
File tree
2 files changed
+86
-0
lines changed- pkg/analyzer
- lib/src/dart/constant
- test/src/dart/constant
2 files changed
+86
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
29 | 40 | | |
30 | 41 | | |
31 | 42 | | |
| |||
221 | 232 | | |
222 | 233 | | |
223 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
224 | 248 | | |
225 | 249 | | |
226 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6436 | 6436 | | |
6437 | 6437 | | |
6438 | 6438 | | |
| 6439 | + | |
| 6440 | + | |
| 6441 | + | |
| 6442 | + | |
| 6443 | + | |
| 6444 | + | |
| 6445 | + | |
| 6446 | + | |
| 6447 | + | |
| 6448 | + | |
| 6449 | + | |
| 6450 | + | |
| 6451 | + | |
| 6452 | + | |
| 6453 | + | |
| 6454 | + | |
| 6455 | + | |
| 6456 | + | |
| 6457 | + | |
| 6458 | + | |
| 6459 | + | |
| 6460 | + | |
| 6461 | + | |
| 6462 | + | |
| 6463 | + | |
| 6464 | + | |
| 6465 | + | |
| 6466 | + | |
| 6467 | + | |
| 6468 | + | |
| 6469 | + | |
| 6470 | + | |
| 6471 | + | |
| 6472 | + | |
| 6473 | + | |
| 6474 | + | |
| 6475 | + | |
| 6476 | + | |
| 6477 | + | |
| 6478 | + | |
| 6479 | + | |
| 6480 | + | |
| 6481 | + | |
| 6482 | + | |
| 6483 | + | |
| 6484 | + | |
| 6485 | + | |
| 6486 | + | |
| 6487 | + | |
| 6488 | + | |
| 6489 | + | |
| 6490 | + | |
| 6491 | + | |
| 6492 | + | |
| 6493 | + | |
| 6494 | + | |
| 6495 | + | |
| 6496 | + | |
| 6497 | + | |
| 6498 | + | |
| 6499 | + | |
| 6500 | + | |
6439 | 6501 | | |
6440 | 6502 | | |
6441 | 6503 | | |
| |||
0 commit comments