forked from swiftlang/swift
- Notifications
You must be signed in to change notification settings - Fork 0
/
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
publicfunc foo<Info:Collection>(info:Info){
letb=MyContainer()
_ = b.dropFirst()
}
structMyContainer{
varx=42
init(){}
}
extensionMyContainer:Collection{
typealiasIndex=Int
varstartIndex:Index{fatalError()}
varendIndex:Index{fatalError()}
subscript(_ index:Index)->UInt8{
get{
fatalError()
}
set{
fatalError()
}
}
func index(after i:Int)->Int{
fatalError()
}
}
// BEGIN Main.swift
import MyModule
publicfunc main(){
foo(info:[1,2,3])
}