Skip to content

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Sep 12, 2025

Description: It is possible to customize the SerializationRequirement that DistributedActorSystem enforces on all parameters/return types. When this was set to Any, which can be useful for some special in memory transports, the compiler would emit incorrect code and cause a crash due to another bug null-pointer-dereferencing a type while emitting a diagnostic.

This PR resolves both the issue in the diagnostic emitting, as well as the underlying issue -- which was an un-necessary cast to as Any.Type which then would result in emitting an error diagnostic.

Scope/Impact: Specifically actor systems which use Any as the serialization requirement. They would previously crash the compiler, and with this fix can work correctly.

Risk: Low, specific to Any using DistributedActorSystems. Has no impact on other types. The diagnostic fix just avoids null pointers.

Testing: Added test to exercise the problem.

Reviewed by: @xedin

Original PR: #84119
Radar: resolves rdar://159285863

It should be possible to disable SerializationRequirement by assigning
Any to it. This effectively disables the checking, since any type
conforms to that.

Previously we would crash trying to check for this conformance; or
rather, emitting diagnostics about un-necessary casts then encountering
incomplete types in CSDiagnostics.

Avoiding the cast entirely sounds like a good solution here.

resolves rdar://159285863

[Distributed] Simplify checking for Any type

Harden diagnoseForcedCastExpr for lack of cast-to type
@ktoso ktoso requested a review from a team as a code owner September 12, 2025 06:57
@ktoso ktoso force-pushed the pick-allow-any-serialization-requirement branch from 202cec0 to 7842a46 Compare September 12, 2025 06:57
@ktoso
Copy link
Contributor Author

ktoso commented Sep 12, 2025

@swift-ci please test

@ktoso ktoso changed the title [6.2][Distributed] Allow disabling SerializationRequirement by using Any #84119 [6.2][Distributed] Allow disabling SerializationRequirement by using Any Sep 12, 2025
@ktoso ktoso closed this Sep 16, 2025
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