-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy pathgeneric-modules.swift
49 lines (36 loc) · 1.03 KB
/
generic-modules.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// RUN: %empty-directory(%t)
// RUN: %{python} %utils/split_file.py -o %t %s
// Check that this compiles successfully.
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
// RUN: %target-swift-frontend -c -o %t/Main.o -I %t %t/Main.swift -enable-experimental-feature Embedded -parse-as-library
// REQUIRES: swift_feature_Embedded
// BEGIN MyModule.swift
public func foo<Info: Collection>(info: Info) {
let b = MyContainer()
_ = b.dropFirst()
}
struct MyContainer {
var x = 42
init() { }
}
extension MyContainer: Collection {
typealias Index = Int
var startIndex: Index { fatalError() }
var endIndex: Index { fatalError() }
subscript(_ index: Index) -> UInt8 {
get {
fatalError()
}
set {
fatalError()
}
}
func index(after i: Int) -> Int {
fatalError()
}
}
// BEGIN Main.swift
import MyModule
public func main() {
foo(info: [1, 2, 3])
}