flutter / flutter/flutter-intellij

Complex `if-pattern` breaks inspection in all branches.

Open
#6,924 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
2k
Forks
356
Avg merge
1d 11h
Merged PRs (30d)
27

Description

When I Cmd+B `timestamp.difference` in IntellijIdea, it says "Cannot find declaration to go to".
Hover on any token also doesn't work.

Removing `when` part makes everything inspectable again.

```dart
void main() {
DateTime? tapTimestamp;

if (tapTimestamp case final timestamp?
when timestamp.difference(DateTime.timestamp()).inMilliseconds < 300) {
} else {
tapTimestamp = DateTime.timestamp();
}
}
```
[✓] Flutter (Channel stable, 3.13.6, on macOS 14.0 23A344 darwin-arm64, locale en-RU)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.1)
[✓] VS Code (version 1.82.2)
[✓] Connected device (2 available)
[✓] Network resources

It's not reproducible in both VScode and DartPad

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.