Skip to content

Redo The Notes For "Uninhabited" Parameter Types #39477

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 2 commits into from
Sep 28, 2021

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Sep 28, 2021

The use of the term 'uninhabited' does not make sense outside of formal type theoretic contexts. In Swift, we also do not use this term in a standard way - hence the term "structurally uninhabited" since we only consider products and sums eligible for the check. (Aside: We do not do exponentials because... well, Swift's type system implements Harper's "typerec" operator and as a consequence parametricity is just not a thing). I digress...

So, improve upon the old diagnostic in two ways:

  1. Do away with 'uninhabited' - instead, mention that it's either an enum or a tuple with an enum in it that 'has no cases'
  2. Since the SIL parameter convention flattens all tuples, point directly at the offending uninhabited element type

rdar://83600669

@CodaFi
Copy link
Contributor Author

CodaFi commented Sep 28, 2021

For those that care, here's Harper's paper https://www.cs.cmu.edu/~rwh/papers/intensional/popl95.pdf

The use of the term 'uninhabited' does not make sense outside of formal type theoretic contexts. In Swift, we also do not use this term in a standard way - hence the term "structurally uninhabited" since we only consider products and sums eligible for the check. (Aside: We do not do exponentials because... well, Swift's type system implements Harper's "typerec" operator and as a consequence parametricity is just _not a thing_). I digress...

So, improve upon the old diagnostic in two ways:
1) Do away with 'uninhabited' - instead, mention that it's either an enum or a tuple with an enum in it that 'has no cases'
2) Since the SIL parameter convention flattens all tuples, point directly at the offending uninhabited element type

rdar://83600669
@CodaFi
Copy link
Contributor Author

CodaFi commented Sep 28, 2021

@swift-ci smoke test

@CodaFi
Copy link
Contributor Author

CodaFi commented Sep 28, 2021

@CodaFi CodaFi merged commit 86a4e05 into swiftlang:main Sep 28, 2021
@CodaFi CodaFi deleted the tenancy-in-common branch September 28, 2021 07: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.

1 participant