5
5
// RUN: %target-swift-frontend %s -typecheck -DNOCRASH2 -sdk %clang-importer-sdk -use-clang-function-types
6
6
// RUN: %target-swift-frontend %s -DAUXMODULE -module-name Foo -emit-module -o %t
7
7
8
+ // rdar://problem/57644243 : We shouldn't crash if -use-clang-function-types is not enabled.
9
+ // RUN: %target-swift-frontend %s -typecheck -DNOCRASH3 -I %t
10
+
8
11
// FIXME: [clang-function-type-serialization] This should stop crashing once we
9
12
// start serializing clang function types.
10
13
// RUN: not --crash %target-swift-frontend %s -typecheck -DCRASH -I %t -use-clang-function-types
@@ -25,12 +28,38 @@ func f() {
25
28
#endif
26
29
27
30
#if AUXMODULE
28
- public var DUMMY_SIGNAL : Optional < @convention ( c) ( Int32 ) -> Void > = . none
31
+ public var DUMMY_SIGNAL1 : Optional < @convention ( c) ( Int32 ) -> ( ) > = . none
32
+ public var DUMMY_SIGNAL2 : Optional < @convention ( c) ( Int32 ) -> Void > = . none
33
+ #endif
34
+
35
+ #if NOCRASH3
36
+ import Foo
37
+ public func my_signal1( ) -> Optional < @convention ( c) ( Int32 ) -> ( ) > {
38
+ return Foo . DUMMY_SIGNAL1
39
+ }
40
+ public func my_signal2( ) -> Optional < @convention ( c) ( Int32 ) -> Void > {
41
+ return Foo . DUMMY_SIGNAL1
42
+ }
43
+ public func my_signal3( ) -> Optional < @convention ( c) ( Int32 ) -> ( ) > {
44
+ return Foo . DUMMY_SIGNAL2
45
+ }
46
+ public func my_signal4( ) -> Optional < @convention ( c) ( Int32 ) -> Void > {
47
+ return Foo . DUMMY_SIGNAL2
48
+ }
29
49
#endif
30
50
31
51
#if CRASH
32
52
import Foo
33
- public func my_signal( ) -> Optional < @convention ( c) ( Int32 ) -> Void > {
34
- return Foo . DUMMY_SIGNAL
53
+ public func my_signal1( ) -> Optional < @convention ( c) ( Int32 ) -> ( ) > {
54
+ return Foo . DUMMY_SIGNAL1
55
+ }
56
+ public func my_signal2( ) -> Optional < @convention ( c) ( Int32 ) -> Void > {
57
+ return Foo . DUMMY_SIGNAL1
58
+ }
59
+ public func my_signal3( ) -> Optional < @convention ( c) ( Int32 ) -> ( ) > {
60
+ return Foo . DUMMY_SIGNAL2
61
+ }
62
+ public func my_signal4( ) -> Optional < @convention ( c) ( Int32 ) -> Void > {
63
+ return Foo . DUMMY_SIGNAL2
35
64
}
36
65
#endif
0 commit comments