-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
area:toolingArea: tooling and CLIArea: tooling and CLIbugSomething isn't workingSomething isn't workingpriority:p2Priority P2 (medium)Priority P2 (medium)
Milestone
Description
Summary
splitTopLevel in src/tywrap.ts doesn’t track string literal boundaries. Annotations like Literal["a,b"] or Literal["x|y"] are split incorrectly, leading to malformed PythonType parsing and invalid TS types.
Failure mode
Literal["a,b"]is split into two parts and mapped to"a"and"b"instead of the single literal"a,b".Literal["x|y"]is split at|, producing a union that isn’t in the source.
Evidence
src/tywrap.tssplitTopLevelonly tracks bracket/paren depth; it ignores quoted strings.
Proposed fix
- Teach
splitTopLevelto recognize quoted string sections and ignore separators inside them. - Add tests for Literal strings containing commas and pipes.
Acceptance criteria
- Literal annotations with embedded
,or|parse correctly. - Tests cover
Literal["a,b"],Literal["x|y"], and nested cases.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:toolingArea: tooling and CLIArea: tooling and CLIbugSomething isn't workingSomething isn't workingpriority:p2Priority P2 (medium)Priority P2 (medium)