|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %{python} %utils/split_file.py -o %t %s |
| 3 | + |
| 4 | +// RUN: %empty-directory(%t/Modules) |
| 5 | +// RUN: %target-swift-frontend -emit-module -module-name AppleLogging -module-alias XLogging=AppleLogging -o %t/Modules %t/FileLogging.swift |
| 6 | + |
| 7 | +// BEGIN FileLogging.swift |
| 8 | +public struct Logger { |
| 9 | + public init() {} |
| 10 | +} |
| 11 | + |
| 12 | +public protocol Logging { |
| 13 | + var name: String { get } |
| 14 | +} |
| 15 | + |
| 16 | +public func setupLogger() -> XLogging.Logger? { |
| 17 | + return Logger() |
| 18 | +} |
| 19 | + |
| 20 | +// RUN: %empty-directory(%t/Out) |
| 21 | +// RUN: %target-swift-ide-test -batch-code-completion -source-filename %t/FileLib1.swift -module-alias XLogging=AppleLogging -filecheck %raw-FileCheck -completion-output-dir %t/Out -I %t/Modules |
| 22 | + |
| 23 | +// BEGIN FileLib1.swift |
| 24 | +import XLogging |
| 25 | + |
| 26 | +func testModuleNameInBody() { |
| 27 | + #^EXPR^# |
| 28 | +} |
| 29 | + |
| 30 | +// EXPR: Begin completion |
| 31 | +// EXPR-NOT: AppleLogging |
| 32 | +// EXPR-DAG: Decl[Module]/None: XLogging[#Module#]; name=XLogging |
| 33 | +// EXPR-DAG: Decl[Protocol]/OtherModule[XLogging]/Flair[RareType]: Logging[#Logging#]; name=Logging |
| 34 | +// EXPR-DAG: Decl[Struct]/OtherModule[XLogging]: Logger[#Logger#]; name=Logger |
| 35 | +// EXPR-DAG: Decl[FreeFunction]/OtherModule[XLogging]: setupLogger()[#Logger?#]; name=setupLogger() |
| 36 | +// EXPR: End completions |
| 37 | + |
| 38 | +// RUN: %empty-directory(%t/Out) |
| 39 | +// RUN: %target-swift-ide-test -batch-code-completion -source-filename %t/FileLib2.swift -module-alias XLogging=AppleLogging -filecheck %raw-FileCheck -completion-output-dir %t/Out -I %t/Modules |
| 40 | + |
| 41 | +// BEGIN FileLib2.swift |
| 42 | +import XLogging |
| 43 | + |
| 44 | +class ModuleNameInClause: #^MODULE^# { |
| 45 | +} |
| 46 | + |
| 47 | +// MODULE: Begin completion |
| 48 | +// MODULE-NOT: AppleLogging |
| 49 | +// MODULE-DAG: Decl[Module]/None: XLogging[#Module#]; name=XLogging |
| 50 | + |
| 51 | +// MODULE-DAG: Decl[Protocol]/OtherModule[XLogging]: Logging[#Logging#]; name=Logging |
| 52 | +// MODULE-DAG: Decl[Struct]/OtherModule[XLogging]: Logger[#Logger#]; name=Logger |
| 53 | +// MODULE: End completions |
| 54 | + |
| 55 | +// RUN: %empty-directory(%t/Out) |
| 56 | +// RUN: %target-swift-ide-test -batch-code-completion -source-filename %t/FileLib3.swift -module-alias XLogging=AppleLogging -filecheck %raw-FileCheck -completion-output-dir %t/Out -I %t/Modules |
| 57 | + |
| 58 | +// BEGIN FileLib3.swift |
| 59 | +import XLogging |
| 60 | + |
| 61 | +func testModuleNameInDecl() -> #^TYPE^# { |
| 62 | +} |
| 63 | + |
| 64 | +// TYPE: Begin completion |
| 65 | +// TYPE-NOT: AppleLogging |
| 66 | +// TYPE-DAG: Decl[Module]/None: XLogging[#Module#]; name=XLogging |
| 67 | +// TYPE-DAG: Decl[Protocol]/OtherModule[XLogging]: Logging[#Logging#]; name=Logging |
| 68 | +// TYPE-DAG: Decl[Struct]/OtherModule[XLogging]: Logger[#Logger#]; name=Logger |
| 69 | +// TYPE: End completions |
| 70 | + |
| 71 | +// RUN: %empty-directory(%t/Out) |
| 72 | +// RUN: %target-swift-ide-test -batch-code-completion -source-filename %t/FileLib4.swift -module-alias XLogging=AppleLogging -filecheck %raw-FileCheck -completion-output-dir %t/Out -I %t/Modules |
| 73 | + |
| 74 | +// BEGIN FileLib4.swift |
| 75 | +import #^IMPORT^# |
| 76 | + |
| 77 | +// IMPORT: Begin completion |
| 78 | +// IMPORT-NOT: AppleLogging |
| 79 | +// IMPORT: Decl[Module]/None: XLogging[#Module#]; name=XLogging |
| 80 | +// IMPORT: End completions |
0 commit comments