Skip to content

fix HasFusion for union types#6970

Merged
mccanne merged 2 commits into
mainfrom
fix-has-fusion
May 21, 2026
Merged

fix HasFusion for union types#6970
mccanne merged 2 commits into
mainfrom
fix-has-fusion

Conversation

@mccanne
Copy link
Copy Markdown
Collaborator

@mccanne mccanne commented May 20, 2026

This commit fixes HasFusion for union types.

HasFusion previously returned false for unions that had descendents with fusion types. Since type fusion wraps such unions in fusion types, this behavior doesn't create any current problems but it is odd not to include this case here and is confusing during debugging when such conditions arise.

This commit fixes HasFusion for union types.

HasFusion previously returned false for unions that had descendents
with fusion types.  Since type fusion wraps such unions in fusion types,
this behavior doesn't create any current problems but it is odd not to include
this case here and is confusing during debugging when such conditions arise.
Comment thread runtime/sam/expr/function/defuse.go Outdated
case *super.TypeSet:
has = d.HasFusion(typ.Type)
case *super.TypeUnion:
has = slices.ContainsFunc(typ.Types, func(t super.Type) bool { return d.HasFusion(t) })
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
has = slices.ContainsFunc(typ.Types, func(t super.Type) bool { return d.HasFusion(t) })
has = slices.ContainsFunc(typ.Types, d.HasFusion)

@mccanne mccanne merged commit 6c7f0c6 into main May 21, 2026
2 checks passed
@mccanne mccanne deleted the fix-has-fusion branch May 21, 2026 00:25
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.

2 participants