Skip to content

[Sema] Handle invalid @_specialize generic signatures#89239

Open
Jiaxu-Li wants to merge 2 commits into
swiftlang:mainfrom
Jiaxu-Li:fix-89154-specialize-invalid-signature
Open

[Sema] Handle invalid @_specialize generic signatures#89239
Jiaxu-Li wants to merge 2 commits into
swiftlang:mainfrom
Jiaxu-Li:fix-89154-specialize-invalid-signature

Conversation

@Jiaxu-Li

Copy link
Copy Markdown
Contributor

Reject invalid @_specialize generic signatures before serialization can reconstruct interface types from inconsistent requirement-machine state.

Add a reduced regression test for swiftlang#89154.

Resolves swiftlang#89154

@slavapestov slavapestov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you spilt this up into multiple commits? It's a pretty involved set of changes and I'd like to go through them one by one.

Comment thread lib/AST/RequirementMachine/ConcreteTypeWitness.cpp
Comment thread lib/Sema/TypeCheckAttr.cpp Outdated
Comment thread lib/AST/RequirementMachine/InterfaceType.cpp
Comment thread lib/AST/RequirementMachine/ConcreteTypeWitness.cpp Outdated
@Jiaxu-Li Jiaxu-Li requested a review from slavapestov May 20, 2026 14:14
@Jiaxu-Li

Copy link
Copy Markdown
Contributor Author

@swift-ci Please test

@slavapestov

Copy link
Copy Markdown
Contributor

@Jiaxu-Li quoting your bug report:

MyStruct4.DP2 resolves to MyStruct3, but because MyStruct3 is declared twice (making it ambiguous), the conformance of MyStruct3 to P1 is not reliably resolved.

If this is indeed the root cause of the problem, the fix should be in conformance lookup itself. We shouldn't be adding workarounds to the requirement machine, otherwise other callers might similarly get inconsistent results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants