Skip to content

[SILGen]: extend uninhabited parameter checks to self param #75795

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jamieQ
Copy link
Contributor

@jamieQ jamieQ commented Aug 9, 2024

SILGenProlog contains logic to emit an unreachable location if a function contains a structurally uninhabited parameter. This change extends this logic to include the self parameter, so instance members of structurally uninhabited types will produce the same diagnostics and have the same SIL emission behavior.


// IMPORTANT: An unreachable block should be the last one in `emitProlog`,
// since it is a terminator and no instructions should be insterted after it.
if (selfParam)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

with this change, at least one part of the standard library now emits a warning when built – the Never conformance to Identifiable. should that be changed? i think if this change is also merged, then the implementation could perhaps just be removed.

@jamieQ
Copy link
Contributor Author

jamieQ commented Aug 20, 2024

@jckarter when (if?) you have time, do you have any thoughts on the approach taken here?

@jamieQ jamieQ marked this pull request as ready for review October 17, 2024 12:17
@jamieQ jamieQ requested a review from jckarter as a code owner October 17, 2024 12:17
SILGenProlog contains logic to emit an unreachable location if a
function contains a structurally uninhabited parameter. This change
extends this logic to include the `self` parameter, so instance members
of structurally uninhabited types will produce the same diagnostics and
have the same SIL emission behavior.
@jamieQ
Copy link
Contributor Author

jamieQ commented Nov 21, 2024

@jckarter – any chance you've had time to consider this? if not, is there someone else you'd recommend i try to involve for a review?

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