Commit cb3447f
[analyzer] Fix "yield in non-generator" error reporting.
The analyzer unit tests `YieldEachInNonGeneratorTest.test_async` and
`YieldInNonGeneratorTest.test_async` were marked with a `@FailingTest`
annotation that claimed that the tests were failing because the parser
was trying to parse the yield statement as a binary expression. The
actual reason they were failing was because (a) both the analyzer and
the shared parser were redundantly flagging the error, resulting in
two errors rather than one, and (b) the tests had an incorrect offset
and length for the expected error.
As a result of these tests being marked with a `@FailingTest`
annotation, we had no test coverage of the
`YIELD_EACH_IN_NON_GENERATOR` and `YIELD_IN_NON_GENERATOR` errors.
I've resolved the redundancy by suppressing the error from the parser
and keeping the analyzer's logic to flag the error, since the
analyzer's logic produces a more specific error (it correctly
distinguishes between `YIELD_EACH_IN_NON_GENERATOR` and
`YIELD_IN_NON_GENERATOR`, whereas the shared parser does not). And
I've updated the tests with the correct offset and length for the
expected error. So the tests no longer fail and test coverage is
restored.
Change-Id: Ibbee3329d4699d7e78bec964303e9c9b239f0b8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400140
Auto-Submit: Paul Berry <[email protected]>
Commit-Queue: Brian Wilkerson <[email protected]>
Reviewed-by: Brian Wilkerson <[email protected]>1 parent 023473d commit cb3447f
File tree
3 files changed
+3
-13
lines changed- pkg/analyzer
- lib/src/fasta
- test/src/diagnostics
3 files changed
+3
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
| 507 | + | |
512 | 508 | | |
513 | 509 | | |
514 | 510 | | |
| |||
Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
27 | | - | |
| 24 | + | |
28 | 25 | | |
29 | 26 | | |
30 | 27 | | |
| |||
Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
27 | | - | |
| 24 | + | |
28 | 25 | | |
29 | 26 | | |
30 | 27 | | |
| |||
0 commit comments