File: module-aliasing-repl-code-complete.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (44 lines) | stat: -rw-r--r-- 1,495 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/// Test REPL code completion with module aliasing
/// When -module-alias <alias_name>=<real_name> is applied, code completion should show
/// the <alias_name> as that's the name which should appear in source files including import statements,
/// decls, expressions, etc. while getting visible decls come from the module of <real_name>, which
/// is the name of the binary.
/// Below, XLogging is the alias and mapped to the real name AppleLogging. Note that the binary name
/// AppleLogging should not appear in the code completion results.
///
// RUN: %empty-directory(%t)
// RUN: %{python} %utils/split_file.py -o %t %s

// RUN: %target-swift-frontend %t/FileLogging.swift -module-name AppleLogging -module-alias XLogging=AppleLogging -emit-module -o %t/AppleLogging.swiftmodule

// RUN: %target-swift-ide-test -repl-code-completion -source-filename %t/FileLib1.swift -module-alias XLogging=AppleLogging -I %t > %t/result1.txt
// RUN: %FileCheck %s < %t/result1.txt

// RUN: %target-swift-ide-test -repl-code-completion -source-filename %t/FileLib2.swift -module-alias XLogging=AppleLogging -I %t > %t/result2.txt
// RUN: %FileCheck %s < %t/result2.txt

// CHECK-NOT: AppleLogging
// CHECK: XLogging

// BEGIN FileLogging.swift
public struct Logger {
  public init() {}
}

public protocol Logging {
  var content: String { get }
}

public func setupLogger() -> XLogging.Logger? {
  return Logger()
}

// BEGIN FileLib1.swift
import

// BEGIN FileLib2.swift
import XLogging
func f() {
  X
}