Jump to definition with pre-compiled Swift modules results in SourceKit error

Originator:keithbsmiley
Number:rdar://42087654 Date Originated:11-Jul-2018 01:53 PM
Status:Not an issue Resolved:
Product:Developer Tools Product Version:Xcode 10.0 beta 3 (10L201y)
Classification:UI/Usability Reproducible:Always
 
Summary:
If you have a project that links a pre-compiled Swift module (specifically a static framework in the attached sample project), the project will build successfully, but if you try to jump to definition on a symbol or the import from the pre-compiled module, you get this error:

```
Couldn't Generate Swift Representation

Error (from SourceKit):
"Could not load module: MODULE"
```

Steps to Reproduce:
1. Pre-compile a Swift static framework in 1 project
2. Create a new project, copy the pre-compiled framework to the root of the project
3. Add `$(SRCROOT)` to `FRAMEWORK_SEARCH_PATHS` in Build Settings
4. Add `-framework MODULE` to `OTHER_LDFLAGS`
5. Add an import, and a reference to the symbols from the pre-compiled framework
6. Build (this should be successfully)
7. Try to jump to definition on the import, or any of the referenced symbols

Expected Results:
You see a generated representation of Swift module

Actual Results:
You get the above error

Version:
Xcode 10.0 beta 3 (10L201y)

Notes:
- See the attached project for an example (this Swift framework was built with Xcode 10 beta 3, so you must use the same version to reproduce this)
- In Xcode 9.4.1 jumping to definition in this case works

Comments

I was just experiencing https://openradar.appspot.com/42088037

By keithbsmiley at July 14, 2018, 8:53 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!