Skip to content

feat(dart-modern-features): add list/split pattern discovery regexes and case/Set guardrails - #53

Merged
kevmoo merged 1 commit into
mainfrom
list-split-patterns
Sep 23, 2026
Merged

kevmoo merged 1 commit into
mainfrom
list-split-patterns

Conversation

@kevmoo

@kevmoo kevmoo commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Adds list/segment and String.split() discovery regexes and two Pragmatic Balance guardrails to dart-modern-features:

  • Discovery > Pattern Matching Candidates:
    • Adds regexes for .length + index checks, .skip(1)/.sublist(1) tail slicing, and .split(...) followed by length/index checks.
  • Pragmatic Balance:
    • #### 3. Use switch Expressions or Inline if-case for Boolean Returns: Documents that <expr> case <pattern> is a caseClause valid only in if/for/while headers (not a standalone boolean expression), preventing Unexpected token 'case' compile errors.
    • #### 4. Use Set.contains in when Guards over Long || Pattern Chains: Shows how to combine list destructuring with Set.contains in a when guard (case [final first, ...final rest] when allowedTopLevel.contains(first)) to avoid +1 per || cognitive complexity inflation (analytica.dart).
  • Cross-links dart-use-pattern-matching.

@kevmoo
kevmoo merged commit d9e03c6 into main Sep 23, 2026
7 checks passed
@kevmoo
kevmoo deleted the list-split-patterns branch September 23, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant