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-13050] Error compiling .swiftinterface file #55496
Comments
I don't see any setup error. Here are the steps I ran: 1. Ran I do see a warning like [!] The Podfile contains framework or static library targets (MyLibrary), for which the Podfile does not contain host targets (targets which embed the framework).
If this project is for doing framework development, you can ignore this message. Otherwise, add a target to the Podfile that embeds these frameworks to make this message go away (e.g. a test target). after the |
Comment by Marcos Hernandez (JIRA) The setup is correct. But when I try to compile the app, it fails, as the compiler can't infer the generic types defined within the .swiftinterface. |
Gotcha'. When I compile the app, I end up seeing errors like Cannot find type 'Success' in scope
Cannot find type 'Failure' in scope and so on in |
@swift-ci create |
Comment by Marcos Hernandez (JIRA) Indeed, it looks like PromiseKit's Result might be impacting somehow. I expected these types to be somehow "namespaced" so to say, to avoid collisions. I'm not sure how much context the compiler has when it's evaluating a library's swiftinterface. Thanks for moving this forward theindigamer (JIRA User) ! |
When we print the module interface for MyLibrary, we print |
printExtendedTypeName() does this on purpose, but as far as I can tell, this was done back when this code was only used for user-facing features, like documentation and Xcode generated interfaces. It may not be desired behavior for module interfaces. On the other hand, at least one test (SourceKit/CodeComplete/complete_swiftinterface.swift) starts failing when I fix it because of the sort of module name shadowing issue that forces use of |
Attachment: Download
Environment
MacOS Catalina 10.15.5 (19F101)
XCode 11.5 (11E608c)
Ruby 2.6.4
The attachment includes both the app project and the library project, including Gemfiles and Podfiles to fix versions as much as possible.
Additional Detail from JIRA
md5: c8192564d3ce9290205bc02403bb0bdf
Issue Description:
Previously raised in: https://forums.swift.org/t/swifinterface-undeclared-generic-types/37706
Good afternoon.
I'm trying to extract some internal frameworks from our project and move them to their own repository. I've started with a framework which is a dependency of both the app and most of the other internal frameworks in the app (yes exactly, the "utils" library 🙂).
The utils library also have other third party dependencies, which are resolved using Cocoapods. The library is compiled into an XCFramework correctly. This XCFramework is then linked back to the main app and to every internal framework depending on it. "Utils" dependencies are added to the main app and the internal frameworks using Cocoapods as well.
When I try to compile the app, the compilation of the swiftinterface fails, as it can't infer the types being used in a generic class's extension. This generic class is Result, which is part of Swift. The interface file contains import Swift so I have the impression some of the other imports may be failing and causing this, but my knowledge of how the compiler works is pretty limited.
I understand this is a pretty specific case of interface, as it contains imports of third parties, but I'd assume this is a pretty standard setup in big projects. I also understand the setup might be wrong, in which case I'd need to understand where the error is.
I've attached a test project with an app/ and a library/ folders containing a __ minimal version of this setup. Run bundler install and bundle exec pod install in both projects beforehand. The library one contains the standard script to create xcframeworks, and the one included in the app has been generated in this way.
Please, do let me know if I can provide more info and help. I hope it's a setup error in the end. Thanks!
The text was updated successfully, but these errors were encountered: