-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy pathbasic-modules-validation-no-stdlib.swift
31 lines (21 loc) · 1.29 KB
/
basic-modules-validation-no-stdlib.swift
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
// RUN: %empty-directory(%t)
// RUN: %{python} %utils/split_file.py -o %t %s
// both modules are embedded - ok
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -parse-stdlib -enable-experimental-feature Embedded -wmo
// RUN: %target-swift-frontend -emit-ir -I %t %t/Main.swift -parse-stdlib -enable-experimental-feature Embedded -wmo
// MyModule is not embedded - error
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -parse-stdlib -wmo
// RUN: not %target-swift-frontend -emit-ir -I %t %t/Main.swift -parse-stdlib -enable-experimental-feature Embedded -wmo 2>&1 | %FileCheck %s --check-prefix CHECK-A
// main module is not embedded - error
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -parse-stdlib -enable-experimental-feature Embedded -wmo
// RUN: not %target-swift-frontend -emit-ir -I %t %t/Main.swift -parse-stdlib -wmo 2>&1 | %FileCheck %s --check-prefix CHECK-B
// REQUIRES: swift_in_compiler
// BEGIN MyModule.swift
public func foo() { }
// BEGIN Main.swift
import MyModule
public func main() {
foo()
}
// CHECK-A: error: module 'MyModule' cannot be imported in embedded Swift mode
// CHECK-B: error: module 'MyModule' cannot be imported because it was built with embedded Swift