Skip to content

Conversation

@lynxplay
Copy link
Contributor

Vineflower's previous implementation of the type casting pattern
matching in switch statements was not strict enough, considering any
form of cast in the first expression of the case block a result of type
pattern matching.

This would incorrectly attempt to emit such type pattern matching source
code for switches that simply yielded different types.

This commit tightens the logic to consider a switch case a type pattern
matching one if the first expression is a simple cast of the switch
head's variable.

Vineflower's previous implementation of the type casting pattern
matching in switch statements was not strict enough, considering any
form of cast in the first expression of the case block a result of type
pattern matching.

This would incorrectly attempt to emit such type pattern matching source
code for switches that simply yielded different types.

This commit tightens the logic to consider a switch case a type pattern
matching one if the first expression is a simple cast of the switch
head's variable.
@jaskarth jaskarth added Subsystem: Statement Structure Anything concerning how statements are structured in a method Priority: High High priority bugfix Fixes a bug labels Feb 26, 2025
Copy link
Member

@jaskarth jaskarth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks a lot!

@jaskarth jaskarth merged commit 643008a into Vineflower:develop/1.11.1 Feb 26, 2025
4 checks passed
@lynxplay lynxplay deleted the bugfix/incorrect-instance-of-assumptions-in-switch branch February 26, 2025 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes a bug Priority: High High priority Subsystem: Statement Structure Anything concerning how statements are structured in a method

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants