Skip to content

Conversation

@tshortli
Copy link
Contributor

@tshortli tshortli commented Jan 6, 2024

Sometimes the compiler may need to build with an out-of-date standard library and we can't assume recently added well-known declarations are present. When synthesizing Hashable and Equatable conformances, if _diagnoseUnavailableCodeReached() isn't present then just generate the body of the case normally instead. This isn't ideal, but there isn't any existing infrastructure to generate a call to fatalError() at the AST level and this should be a rare edge case where we're simply falling back to the previous behavior where unavailable cases weren't handled at all.

No tests because it isn't straight forward to compile with an intentionally broken standard library that's missing some declarations.

Resolves rdar://120554183

…lib.

Sometimes the compiler may need to build with an out-of-date standard library
and we can't assume recently added well-known declarations are present. When
synthesizing Hashable and Equatable conformances, if
`_diagnoseUnavailableCodeReached()` isn't present then just generate the body
of the case normally instead. This isn't ideal, but there isn't any existing
infrastructure to generate a call to `fatalError()` at the AST level and this
should be a rare edge case where we're simply falling back to the previous
behavior where unavailable cases weren't handled at all.

No tests because it isn't straight forward to compile with an intentionally
broken standard library that's missing some declarations.

Resolves rdar://120554183
@tshortli tshortli requested a review from slavapestov as a code owner January 6, 2024 01:42
@tshortli tshortli enabled auto-merge January 6, 2024 02:52
@tshortli
Copy link
Contributor Author

tshortli commented Jan 8, 2024

@swift-ci please smoke test

@tshortli tshortli merged commit c5840e8 into swiftlang:main Jan 8, 2024
@tshortli tshortli deleted the unavailable-code-reached-diagnostic-synthesis branch January 8, 2024 17:39
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