Open mmcdon20 opened 4 months ago
Can you say what version of Dart you are using? When I plug your first example into dartpad, stable channel, beta channel, or main channel, I only see that position.y
is marked as dead.
@srawlins
Issue is happening with:
Dart SDK version: 3.3.4 (stable) (Tue Apr 16 19:56:12 2024 +0000) on "windows_x64"
and
Dart SDK version: 3.5.0-131.0.dev (dev) (Fri May 3 09:02:58 2024 -0700) on "windows_x64"
I don't see the issue on dartpad either, but it's happening in vscode.
Weeird I can repro this in vscode as well. Thanks for the instructions, great find, and great investigation!
In the following program, you get an incorrect dead code waring for the code after the ternary expression:
There is no dead code warning if
position
is a class withx
andy
fields, so it appears to be specific to records.However it only seems to fail on variables containing records, it works fine when using record literals in the ternary expression: