Skip to content

Inherit parent's LoaderOpts.strictImplicitModuleContext value when creating an build sub-InterfaceSubContextDelegateImpl #66743

@Fushj89

Description

@Fushj89

Description

when set -Xfrontend -strict-implicit-module-context on OTHER_SWIFT_FLAGSto solve compile error, it did better for most scenarios, the relational pull request is #61919.

But in some case, it does not work as expected.

when we build a swift file which imports AModule, the AModule is a swiftinterface file;
in AModule swiftinterface file which imports BModule ,the BModule also is a swiftinterface file;
in BModule swiftinterface file which imports a Clang Module, then we will get a No Such Module compile error.

The reason of the error is when we create a sub-InterfaceSubContextDelegateImpl to build BModule, the LoaderOpts. strictImplicitModuleContext argument passed to su-astDeletate is false not true.

Steps to reproduce
1、download SwiftIssue demo
2、unzip
3、cd SwiftIssue && sh build.sh

Expected behavior

compile success

image

Environment

  • Swift compiler version info 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)
  • Xcode version info Xcode 14.3 Build version 14E222b

SwiftIssue.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions