Skip to content

Conversation

slavapestov
Copy link
Contributor

This test case crashes when prepared overloads are disabled, but passes when enabled. To avoid messing up tests if we have to turn the flag on and off, fix the crash.

@slavapestov slavapestov enabled auto-merge October 20, 2025 21:07
@slavapestov slavapestov force-pushed the prepared-fuzz branch 2 times, most recently from abbd56a to cb58dd8 Compare October 20, 2025 21:11
This test case crashes when prepared overloads are disabled, but passes when enabled. To avoid messing up tests if we have to turn the flag on and off, fix the crash.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

for (auto &fix : contextualFixes)
genericParamInferredTypes.insert(fix.first->getFixedType(resultTypeVar));
for (auto &fix : contextualFixes) {
if (fix.first->hasFixedType(resultTypeVar))
Copy link
Contributor

Choose a reason for hiding this comment

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

Free type variables are allowed only with FreeTypeVariableBinding::Allow set, I think a better fix here might be to actually get an overload from every solution instead and extra their result type because if hasFixedType is ever produces true it could mean that overloads were chosen in sub-scope when solutions diverged.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is indeed the case:

Solution 1: locator@0xbb4859000 [OverloadedDeclRef@<stdin>:4:12] with Swift.(file).?? as ??: (consuming $T8?, @autoclosure () throws -> $T8) throws -> $T8

Solution 2: locator@0xbb4859000 [OverloadedDeclRef@<stdin>:4:12] with Swift.(file).?? as ??: (consuming $T17?, @autoclosure () throws -> $T17) throws -> $T17

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok! I’ll hold off on landing this until I figure out the right fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

Slightly higher up is where we get an overload from the first fix, I think all you need to do here is just that for each of the solutions involved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

extra their result type

This should say "extract" right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, sorry!

@slavapestov slavapestov disabled auto-merge October 20, 2025 23:51
@slavapestov slavapestov marked this pull request as draft October 20, 2025 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants