dart-lang / dart-lang/language
Null-aware operator with cascade doesn't work with newlines?
Open
request
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
Following code works:
```dart
void main() {
int? x;
x?..abs()..ceil()..floor();
}
```
This code gives an error:
```dart
void main() {
int? x;
x? // <- Conditions must have a static type of 'bool' - line 3
..abs()
..ceil()
..floor();
}
```
Contributor guide
Research direction
Start by comparing the two Dart snippets and reproducing the diagnostic for the newline-separated cascade. Read the language specification sections covering null-aware operators and cascades, then determine whether the newline form should have the same meaning as the one-line form; done means the expected behavior is specified and verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100