Skip to content

[CodeCompletion] Record key path component types in the constraint system solution #38389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jul 14, 2021

The added test case fails because the result builder inside List2 is being type checked twice: Once for every overload of List2. Because of the way that result builders are being type checked right now, each overload of List2 creates a new type variable for the key components in foo and the constraint system only keeps track of the key path component -> type mapping for the last solution discovered.

When we are now trying to look up the type of the first key path component for the first solution, the constraint system returns the type variable that is being used by the second solution and simplifying that type variable through the first solution fails because it doesn’t know about the type variable.

To fix the issue, make sure that the solutions keep track of the their type variables associated to key path components. That way the first solution owns its own key path component -> type variable mapping and is thus also able to simplify the type variable it has associated with the component.

Fixes rdar://80522345 [SR-14916]

…stem solution

The added test case fails because the result builder inside `List2` is being type checked twice: Once for every overload of `List2`. Because of the way that result builders are being type checked right now, each overload of `List2` creates a new type variable for the key components in `foo` and the constraint system only keeps track of the key path component -> type mapping for the last solution discovered.

When we are now trying to look up the type of the first key path component for the first solution, the constraint system returns the type variable that is being used by the second solution and simplifying that type variable through the first solution fails because it doesn’t know about the type variable.

To fix the issue, make sure that the solutions keep track of the their type variables associated to key path components. That way the first solution owns its own key path component -> type variable mapping and is thus also able to simplify the type variable it has associated with the component.

Fixes rdar://80522345 [SR-14916]
@ahoppen ahoppen requested a review from xedin July 14, 2021 15:58
@ahoppen
Copy link
Member Author

ahoppen commented Jul 16, 2021

@swift-ci Please smoke test

@ahoppen
Copy link
Member Author

ahoppen commented Jul 16, 2021

@swift-ci Please test Linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 2eeff36

@ahoppen
Copy link
Member Author

ahoppen commented Jul 17, 2021

@swift-ci Please smoke test

1 similar comment
@ahoppen
Copy link
Member Author

ahoppen commented Jul 19, 2021

@swift-ci Please smoke test

@ahoppen
Copy link
Member Author

ahoppen commented Jul 20, 2021

@swift-ci Please smoke test Linux

@ahoppen
Copy link
Member Author

ahoppen commented Jul 20, 2021

@swift-ci Please smoke test Windows

@ahoppen
Copy link
Member Author

ahoppen commented Jul 21, 2021

Windows failure is unrelated

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.

3 participants