Skip to content

[CSSimplify] When trying to simplify bind with error type fail gracefully #16866

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
May 29, 2018

Conversation

xedin
Copy link
Contributor

@xedin xedin commented May 28, 2018

Since member lookup doesn't check requirements
it might sometimes return types which are not
visible in the current context e.g. typealias
defined in constrained extension, substitution
of which might produce error type for base, so
assignement should thead lightly and just fail
if it encounters such types.

Resolves: rdar://problem/39931339
Resolves SR-5013.

…efully

Since member lookup doesn't check requirements
it might sometimes return types which are not
visible in the current context e.g. typealias
defined in constrained extension, substitution
of which might produce error type for base, so
assignement should thead lightly and just fail
if it encounters such types.

Resolves: rdar://problem/39931339
Resolves: SR-5013
@xedin xedin requested a review from rudkx May 28, 2018 07:28
@xedin
Copy link
Contributor Author

xedin commented May 28, 2018

@rudkx I've talked to @DougGregor about this as well and we came to the conclusion that there is no obviously better way to handle situations like that at the moment. I'm working on the separate patch which is going to add typealias' requirements to constraint system to check them earlier which helps to diagnose some expressions better but not when types like that are involved in disjunctions e.g.

protocol P {}
struct S<T> {}

extension S where T : P {
  typealias A = Int
}

_ = S<Int>.A() // currently succeeds but should produce error saying that `Int` doesn't conform to `P`.

@xedin
Copy link
Contributor Author

xedin commented May 28, 2018

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented May 28, 2018

@swift-ci please test source compatibility

Copy link
Contributor

@rudkx rudkx left a comment

Choose a reason for hiding this comment

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

Seems reasonable if unfortunate.

@xedin xedin merged commit 5918fa7 into swiftlang:master May 29, 2018
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