Skip to content

Implement wildcard match pattern#5576

Draft
StachuDotNet wants to merge 2 commits intodarklang:mainfrom
StachuDotNet:wildcard-match-pattern
Draft

Implement wildcard match pattern#5576
StachuDotNet wants to merge 2 commits intodarklang:mainfrom
StachuDotNet:wildcard-match-pattern

Conversation

@StachuDotNet
Copy link
Member

Needs more work in the space of tree-sitter parsing, etc.

StachuDotNet and others added 2 commits January 22, 2026 23:37
Add LPWildcard case to LetPattern types across the codebase. The wildcard
pattern `_` now properly matches any value without binding it to a variable,
distinguishing it from a regular variable named "_".

Changes:
- Added LPWildcard to LetPattern in all type definitions (ProgramTypes,
  RuntimeTypes, WrittenTypes, and Darklang language tools)
- Updated parser to recognize `_` as LPWildcard instead of LPVariable
- Updated type converters to handle LPWildcard conversion
- Updated interpreter to match wildcards without extracting bindings
- Added binary serialization support for LPWildcard
- Updated pretty printers and semantic tokens for wildcard display
- Added comprehensive tests for wildcard patterns in tuples and let bindings
- Fixed symbol threading in ProgramTypesToRuntimeTypes to preserve symbols
  from previous patterns when processing wildcards

Closes darklang#5460

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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

Comments