-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.c interopFeature: Interoperability with CFeature: Interoperability with CcompilerThe Swift compiler itselfThe Swift compiler itselfswift 5.3textual interfacesunexpected errorBug: Unexpected errorBug: Unexpected error
Description
| Previous ID | SR-13032 |
| Radar | rdar://problem/64517049 |
| Original Reporter | martinboehme (JIRA User) |
| Type | Bug |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, ParseableInterfaces |
| Assignee | None |
| Priority | Medium |
md5: 13b4c87976347810d07df29fa015e2a2
Issue Description:
The following commit contains a failing test demonstrating the problem:
It generates a .swiftinterface for module MainModule, but this .swiftinterface then fails to compile with the error message:
MainModule.swiftinterface:6:46: error: cannot find type 'ForeignA' in scope
public func funcTakingForeignStruct(_ param: ForeignA.ForeignStruct)
^~~~~~~~To summarize the situation:
- The Swift module
SubModuleimports Clang modulesForeignAandForeignB. BothForeignAandForeignBinclude a textual header containing the structForeignStruct.
- SubModule re-exports
ForeignBbut notForeignA.ForeignStructis therefore available to clients ofSubModule; those clients can use it either using the unqualified nameForeignStructor the qualified nameForeignB.ForeignStruct, but notForeignA.ForeignStruct(becauseSubModuledoesn't re-exportForeignA).
- The Swift module
MainModuleimportsSubModuleand usesForeignStructin the signature offuncTakingForeignStruct. WhenMainModuleis compiled to a.swiftinterfacefile, that signature erroneously refers toForeignStructasForeignA.ForeignStructinstead ofForeignB.ForeignStruct. Because of this, the resulting.swiftinterfacefile does not compile.
I discovered this issue in the course of investigating a CI failure on #32404. The repro above corresponds to the situation in the failing test as follows:
-
SubModuleisGlibc -
ForeignAisSwiftOverlayShims -
ForeignBisSwiftGlibc -
The textual header is
sys/time.h, andForeignStructisstruct timeval
I believe this needs to be fixed in TypePrinter::printModuleContext(), but I'm not sure exactly how.
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.c interopFeature: Interoperability with CFeature: Interoperability with CcompilerThe Swift compiler itselfThe Swift compiler itselfswift 5.3textual interfacesunexpected errorBug: Unexpected errorBug: Unexpected error