Skip to content

Fix switch-default block handling - #2

Open
vslavski wants to merge 1 commit into
crypt0lith:mainfrom
vslavski:fix-switch-default
Open

vslavski wants to merge 1 commit into
crypt0lith:mainfrom
vslavski:fix-switch-default

Conversation

@vslavski

Copy link
Copy Markdown
Contributor

Repro script

switch ("foo") { "" {} }

switch ("foo") { default { "default case" } }

switch ("foo") { "bar" { "bar case" } "baz" { "baz case" } }

switch ("foo") { "bar" { "bar case" } default { "default case" } }

switch ("foo") { default { "default case" } "bar" { "bar case" } }

switch ("foo") { "bar" { "bar case" } "baz" { "baz case" } default { "default case" } }

Before fix

switch("foo"){""{}}

switch("foo"){}

switch("foo"){"bar"{"bar case"}"baz"{"baz case"}}

switch("foo"){"bar"{"bar case"}}

switch("foo"){"bar"{"bar case"}}

switch("foo"){"bar"{"bar case"}"baz"{"baz case"}}

After fix

switch("foo"){""{}}

switch("foo"){default{"default case"}}

switch("foo"){"bar"{"bar case"}"baz"{"baz case"}}

switch("foo"){"bar"{"bar case"}default{"default case"}}

switch("foo"){"bar"{"bar case"}default{"default case"}}

switch("foo"){"bar"{"bar case"}"baz"{"baz case"}default{"default case"}}

What was fixed

  1. Default-block property name: DefaultClause → Default
  2. Removed redundant null check

Checked on

pwsh --version
PowerShell 7.6.10

Reviewed-by: Codex v26.1117.41037 - GPT-6.2 Sol - Extra High
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