Skip to content

Conversation

@hamishknight
Copy link
Contributor

@hamishknight hamishknight commented Aug 14, 2025

Make sure we preserve TVO_CanBindToHole. This unfortunately requires introducing the concept of a "non representative" hole for representatives where the actual hole is given by another type variable in the equivalence class. This avoids disturbing binding order and regressing diagnostics. Once binding is less sensitive to ordering we ought to be able to always choose the hole as the representative.

@hamishknight hamishknight changed the title [DNM] [CS] Handle holes in mergeEquivalenceClasses [CS] Handle holes in mergeEquivalenceClasses Oct 19, 2025
@hamishknight hamishknight marked this pull request as ready for review October 19, 2025 17:13
@hamishknight
Copy link
Contributor Author

hamishknight commented Oct 19, 2025

Table(self.data) {
// expected-error@-1 {{expected expression of type 'Columns' in result builder 'TableColumnBuilder'}} {{23-23=<#T##Columns#>}}
// expected-error@-1 {{expected expression of type 'Column' in result builder 'TableColumnBuilder'}} {{23-23=<#T##Column#>}}
// expected-error@-2 {{generic parameter 'Column' could not be inferred}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a little unfortunate, but it's because we're now no longer stripping TVO_CanBindToHole from the generic parameter. We can't eagerly bind the missing argument to a hole because we rely on type inference to infer the type for better diagnostics. Maybe we could rework those diagnostics to instead look at the parameter type, or maybe we could tweak the diagnostic logic for a defaulted generic parameter to account for missing argument fixes (unfortunately it currently gets defaulted before we match arguments though). In any case, I'm going to leave this as future work.

@hamishknight
Copy link
Contributor Author

hamishknight commented Oct 19, 2025

We know this is where the issue is so we ought to always produce a
concrete hole.
Unwrap a metatype before checking if we have an associated fix.
Make sure we preserve `TVO_CanBindToHole`. This unfortunately requires
introducing the concept of a "non-representative" hole for
representatives where the actual hole is given by another type variable
in the equivalence class. This avoids disturbing binding order and
regressing diagnostics. Once binding is less sensitive to ordering we
ought to be able to always choose the hole as the representative.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight
Copy link
Contributor Author

Oh fun this breaks swift-testing on Windows

@hamishknight hamishknight marked this pull request as draft October 20, 2025 21:18
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