Skip to content

Commit 2161f8a

Browse files
committed
Add test to make sure generic signatures are serialized
1 parent 47e5bcb commit 2161f8a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/Serialization/debug-value.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,23 @@ public func bar(_ x: [Int64], sum: Int64) -> Int64 {
2020
return temp
2121
}
2222

23+
// Make sure the generic signature of foo is always serialized. Otherwise, the
24+
// sil scope in fooCaller refers to the generic version of foo
25+
@inlinable @inline(__always)
26+
func foo<T: AdditiveArithmetic>(_ x: T, _ y : T) -> T {
27+
return x + y
28+
}
29+
30+
@inline(never) @_alwaysEmitIntoClient
31+
public func fooCaller<T: AdditiveArithmetic>(_ x: T, _ y : T) -> T {
32+
return foo(x, y)
33+
}
34+
2335
// BEGIN Main.swift
2436
import MyModule
37+
// sil_scope should refer to the specialized version of foo
38+
//CHECK: sil_scope {{.*}} { loc "{{.*}}MyModule.swift":11:6 parent @$s8MyModule3fooyxx_xts18AdditiveArithmeticRzlFSi_TG5 {{.*}} inlined_at {{.*}} }
39+
let _ = fooCaller(1, 2)
2540

2641
func test() {
2742
let _ = bar([10], sum: 0)

0 commit comments

Comments
 (0)