Skip to content

[CSSimplify] Tuple splat should account for single dependent member p… #22960

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
merged 1 commit into from
Feb 28, 2019

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Feb 27, 2019

…arameters

12a65ff restricted tuple splat
to a single tuple or type variable parameter, but it has to
support dependent member types as well because they could be
resolved to Void (or empty tuple).

Resolves: rdar://problem/48443263

…arameters

12a65ff restricted tuple splat
to a single tuple or type variable parameter, but it has to
support dependent member types as well because they could be
resolved to `Void` (or empty tuple).

Resolves: rdar://problem/48443263
@xedin xedin requested a review from slavapestov February 27, 2019 20:21
@xedin
Copy link
Contributor Author

xedin commented Feb 27, 2019

@slavapestov Looks like my original fix was a bit overly optimistic, looks like I need to figure out a way to restrict that conversion in salvage mode so we can get good diagnostics...

@xedin
Copy link
Contributor Author

xedin commented Feb 27, 2019

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Feb 27, 2019

@swift-ci please test

_ = S(arr, id: \.self_) {
// expected-error@-1 {{contextual type for closure argument list expects 1 argument, which cannot be implicitly ignored}} {{30-30=_ in }}
// expected-error@-1 {{type '_' has no member 'self_'}}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think fixing this completely will require not re-typechecking at all. You're replacing the dependent member type with UnresolvedType here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually this error is just unrelated :( C.Element is resolved properly to Int later on (on the first solve) so we end up comparing () to Int and failing. I'm trying to think of a way to fix this in salvage mode. Maybe we shouldn't attempt splat at all, and let fixMissingArgument and other fixes do their thing, I'll need to add fixes for extraneous and destructuring first though...

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we try both, build a disjunction with splat and without splat and see what fixes each possibility produces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking about trying to replace argument with type variable and then add conversion constraint to it with original type, this would act similar to disjunction because potential bindings would get both parameter and argument type.

@xedin
Copy link
Contributor Author

xedin commented Feb 27, 2019

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Feb 28, 2019

@swift-ci please test macOS platform

@xedin
Copy link
Contributor Author

xedin commented Feb 28, 2019

@shahmishal Is there a long macOS CI queue?

@shahmishal
Copy link
Member

@xedin
Copy link
Contributor Author

xedin commented Feb 28, 2019

@shahmishal Thanks!

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 59a86c35919ab93aa3b589bbd576e4a6b0953ceb

@xedin
Copy link
Contributor Author

xedin commented Feb 28, 2019

@swift-ci please test macOS platform

@xedin xedin merged commit 551e3aa into swiftlang:master Feb 28, 2019
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.

4 participants