dart-lang / dart-lang/language

[proposal] Enable `default` outside switch case

Open
#2,156 4 comments 6 reactions 0 assignees View on GitHub
feature
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

```dart
class PermissionStatus {
static final granted = PermissionStatus._('granted');
static final denied = PermissionStatus._('denied');
static final default = PermissionStatus._('default');

PermissionStatus._(this.value);

final String value;
}
```

'default' can't be used as an identifier because it's a keyword.
Try renaming this to be an identifier that isn't a keyword.dart(expected_identifier_but_got_keyword)

Contributor guide

Open the contributing guide

Research direction

Start by reviewing Dart's keyword and identifier rules, focusing on why `default` is restricted to switch cases. Define the allowed contexts and compatibility implications for using it as an identifier, then document the language change and its expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.