Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-13482] Generated Obj-C header imports framework if any extension exists even if nonobjc #55924

Closed
lilyball mannequin opened this issue Sep 1, 2020 · 3 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@lilyball
Copy link
Mannequin

lilyball mannequin commented Sep 1, 2020

Previous ID SR-13482
Radar None
Original Reporter @lilyball
Type Bug
Status Resolved
Resolution Duplicate
Environment

Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
Target: x86_64-apple-darwin19.6.0

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: ff75f9655f0a8f6168e6a3ff0a1d6d33

duplicates:

  • SR-7051 Compiler fails with "Module not found" error

Issue Description:

In a mixed app target, if I import a framework and then add an extension to one of the framework's classes, the generated Obj-C header adds an import to the framework. This is true even if the extension is private, or if every declaration in it is @nonobjc. This is even true if the extension is completely empty.

import WebKit
private extension WKWebView {}
// Generated by Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)

// […]

#if __has_feature(modules)
#if __has_warning("-Watimport-in-framework-header")
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
#endif
@import WebKit;
#endif

#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
#if __has_warning("-Wpragma-clang-attribute")
# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
#endif
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wnullability"

#if __has_attribute(external_source_symbol)
# pragma push_macro("any")
# undef any
# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="unnamed",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
# pragma pop_macro("any")
#endif



#if __has_attribute(external_source_symbol)
# pragma clang attribute pop
#endif
#pragma clang diagnostic pop

Notice how it's importing WebKit even though this header contains literally no declarations.

@typesanitizer
Copy link

Is this the same issue as https://bugs.swift.org/browse/SR-7051? They look very similar but I'm not sure if they're the same exact thing.

@lilyball
Copy link
Mannequin Author

lilyball mannequin commented Sep 1, 2020

It does look as though this bug I've filed is the root cause for SR-7051.

@typesanitizer
Copy link

Marking this as a dupe, we can track the fix in SR-7051, since that one's older and already has a linked radar.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

1 participant