XCTest framework can not be imported in the Swift REPL even framework path provided

Originator:shashikantjagtaplondon
Number:rdar://47878251 Date Originated:05/02/2019
Status:Open Resolved:NO
Product:Xcode/XCTest Product Version:Xcode10.1
Classification:Bug Reproducible:Always
 
Summary:

XCTest framework can not be imported in the Swift REPL. Whenever tried to import XCTest framework on the user gets an error
"error: repl.swift:2:8: error: cannot load underlying module for 'XCTest'"

Its likely because the XCTest framework is not located at the right place in the Xcode. The most of the shared frameworks located at the path 
"/Applications/Xcode.app/Contents/SharedFrameworks" However XCTest framework is located at the path "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/" and dylibs are located at the "/Applications/Xcode.app/Contents/Frameworks/libswiftXCTest.dylib" 

When Swift REPL invoked with the path to the framework using the command 
 $ swift -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/
and import XCTest then user gets and error :

error: Couldn't lookup symbols:
  __swift_FORCE_LOAD_$_swiftXCTest

Attached Screenshots for reference. 

Steps to Reproduce:

1] Open Swift REPL using `swift' command then import XCTest framework. 
2] Open Swift REPL by passing the path to the xctest framework and import XCTest framework e.g 
$ swift -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/

Expected Results:

XCTest framework should import successfully and user should able to access all the features of XCTest without any issue 


Actual Results:
 User gets an error while importing XCTest framework 

Version/Build:

Swift Version-
Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
Target: x86_64-apple-darwin18.0.0
MacOS Mojave: (10.14)
Xcode Version: Version 10.1 (10B61)
Comments

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!