Skip to content

[NFC] TypeCheckType No Longer Returns Null #32321

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 14 commits into from
Jun 12, 2020
Merged

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Jun 11, 2020

Make it structurally impossible for TypeCheckType to return the null type to both itself and its callers. A large amount of this is based on the work in #29780, but there's some additional deletions and structural assertions here.

Resolves SR-12085 and rdar://58879303

@CodaFi
Copy link
Contributor Author

CodaFi commented Jun 11, 2020

@swift-ci smoke test

@CodaFi
Copy link
Contributor Author

CodaFi commented Jun 11, 2020

@swift-ci test source compatibility

@@ -7,4 +7,4 @@ protocol P1 {
}
extension Foo: P1 where A : P1 {} // expected-error {{unsupported recursion for reference to associated type 'A' of type 'Foo<T>'}}
// expected-error@-1 {{type 'Foo<T>' does not conform to protocol 'P1'}}
// expected-error@-2 {{type 'Foo<T>' in conformance requirement does not refer to a generic parameter or associated type}}
// expected-error@-2 {{type '<<error type>>' in conformance requirement does not refer to a generic parameter or associated type}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this change?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like the result of a !ty -> ty->hasError() transition somewhere in TypeCheckType.cpp. The error message is bogus though, anyway..

Copy link
Contributor Author

@CodaFi CodaFi Jun 11, 2020

Choose a reason for hiding this comment

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

The second time we come around to add these requirements while computing the generic signature for the extension, the base is invalidated somewhere else in the stack. I think we should just not emit this diagnostic if the subject is an ErrorType - it doesn't make sense here in the first place.

@CodaFi
Copy link
Contributor Author

CodaFi commented Jun 12, 2020

Lost connection to macOS nodes

@swift-ci smoke test macOS

@CodaFi
Copy link
Contributor Author

CodaFi commented Jun 12, 2020

Release builder died.

@swift-ci test source compatibility Release

@CodaFi
Copy link
Contributor Author

CodaFi commented Jun 12, 2020

@swift-ci smoke test macOS

@CodaFi CodaFi merged commit 080bea5 into swiftlang:master Jun 12, 2020
@CodaFi CodaFi deleted the type-check branch June 12, 2020 04:01
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