Xcode Playgrounds in project sometimes forgets about module contents

Originator:bruno
Number:rdar://29945409 Date Originated:2017-01-10
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode Version 8.2.1 (8C1002)
Classification:Other bug Reproducible:Sometimes
 
Summary:
Sometimes (sadly, not always) Xcode can build modules in a project and recognize them in a Playground embedded in the project, but it can't parse any of the classes or types defined in the module. 

A previously working playground will just give a lot of 'unresolved identifier' errors and not run. 

Current work-around is as follows: 
1. Export all files in your current project HEAD. 
2. Delete all files in your project dir (except for dot-files, such as the git repo).
3. Copy paste all exported file back into the project dir.
4. Open project again, build and run Playgrounds.

The above workaround solves the 'unresolved identifier' issue, but is less than ideal, of course.

Steps to Reproduce:
1. Create new project.
2. Create new Cocoa Touch framework target with default settings.
3. Add a public class to the framework target.
4. Create a playgrounds inside the project.
5. Build to make sure the module is compiled.
6. Import the module in the playgrounds.
7. Create a variable with the public class in the module.
8. Keep working on the project, while returning to the playgrounds to test things.

Expected Results:
Playgrounds can always resolve public classes imported from modules within the project.


Actual Results:
Sometimes, the playgrounds does recognise the module, but it doesn't resolve any of the public identifiers within it.


Version:
Xcode Version 8.2.1 (8C1002) & macOS Version 10.12.2 (16C67)


Notes:
Attached is a project that exhibited the problem. Sadly, this is the export which solved the issue, so it will probably work out of the box. But hopefully it's useful.

Comments


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!