1-module(failing_funs).
2
3-compile(export_all).
4
5% Crashes with system call. No spec.
6foo1() -> halt().
7
8% Crashes with system call. With spec.
9-spec foo2() -> no_return().
10foo2() -> halt().
11
12% Crashes on its own. No spec.
13foo3() -> case a of b -> ok end.
14
15% Crashes on its own. With spec.
16-spec foo4() -> no_return().
17foo4() -> case a of b -> ok end.
18
19% Creates fun that crashes with system call. No spec.
20foo5() -> fun() -> halt() end.
21
22% Creates fun that crashes with system call. With spec.
23-spec foo6() -> fun(() -> no_return()).
24foo6() -> fun() -> halt() end.
25
26% Creates fun from named fun that will crash. Neither have spec.
27foo7() -> fun foo1/0.
28
29% Creates fun from named fun that will crash. Has spec.
30-spec foo8() -> fun(() -> no_return()).
31foo8() -> fun foo1/0.
32
33% Creates fun from named fun that will crash. Named has spec.
34foo9() -> fun foo2/0.
35
36% Creates fun from named fun that will crash. Both have specs.
37-spec foo10() -> fun(() -> no_return()).
38foo10() -> fun foo2/0.
39
40% Creates fun from named fun that will crash. Neither have spec.
41foo11() -> fun foo3/0.
42
43% Creates fun from named fun that will crash. Has spec.
44-spec foo12() -> fun(() -> no_return()).
45foo12() -> fun foo3/0.
46
47% Creates fun from named fun that will crash. Named has spec.
48foo13() -> fun foo4/0.
49
50% Creates fun from named fun that will crash. Both have specs.
51-spec foo14() -> fun(() -> no_return()).
52foo14() -> fun foo4/0.
53
54% Creates fun calling a named fun that will crash. Neither have spec.
55foo15() -> fun() -> foo1() end.
56
57% Creates fun calling a named fun that will crash. Has spec.
58-spec foo16() -> fun(() -> no_return()).
59foo16() -> fun() -> foo1() end.
60
61% Creates fun calling a named fun that will crash. Named has spec.
62foo17() -> fun() -> foo2() end.
63
64% Creates fun calling a named fun that will crash. Both have specs.
65-spec foo18() -> fun(() -> no_return()).
66foo18() -> fun() -> foo2() end.
67
68% Creates fun calling a named fun that will crash. Neither have spec.
69foo19() -> fun() -> foo3() end.
70
71% Creates fun calling a named fun that will crash. Has spec.
72-spec foo20() -> fun(() -> no_return()).
73foo20() -> fun() -> foo3() end.
74
75% Creates fun calling a named fun that will crash. Named has spec.
76foo21() -> fun() -> foo4() end.
77
78% Creates fun calling a named fun that will crash. Both have specs.
79-spec foo22() -> fun(() -> no_return()).
80foo22() -> fun() -> foo4() end.
81
82% Creates two funs with no local return and will return one or die. No spec.
83foo23() ->
84    Bomb = fun() -> halt() end,
85    case get(42) of
86	a -> Bomb();
87	b -> fun() -> halt() end
88    end.
89
90% Creates two funs with no local return and will return one or die. With spec.
91-spec foo24() -> fun(() -> no_return()).
92foo24() ->
93    Bomb = fun() -> halt() end,
94    case get(42) of
95	a -> Bomb();
96	b -> fun() -> halt() end
97    end.
98
99% Creates two funs with no local return and will return one or die. No spec.
100foo25() ->
101    Bomb = fun() -> foo1() end,
102    case get(42) of
103	a -> Bomb();
104	b -> fun() -> foo1() end
105    end.
106
107% Creates two funs with no local return and will return one or die. With spec.
108-spec foo26() -> fun(() -> no_return()).
109foo26() ->
110    Bomb = fun foo1/0,
111    case get(42) of
112	a -> Bomb();
113	b -> fun foo1/0
114    end.
115
116% Creates two funs with no local return and will return one or die. No spec.
117foo27() ->
118    Bomb = fun foo1/0,
119    case get(42) of
120	a -> Bomb();
121	b -> fun foo1/0
122    end.
123
124% Creates two funs with no local return and will return one or die. With spec.
125-spec foo28() -> fun(() -> no_return()).
126foo28() ->
127    Bomb = fun() -> foo1() end,
128    case get(42) of
129	a -> Bomb();
130	b -> fun() -> foo1() end
131    end.
132
133% Creates two funs with no local return and will return one or die. No spec.
134foo29() ->
135    Bomb = fun() -> foo2() end,
136    case get(42) of
137	a -> Bomb();
138	b -> fun() -> foo2() end
139    end.
140
141% Creates two funs with no local return and will return one or die. With spec.
142-spec foo30() -> fun(() -> no_return()).
143foo30() ->
144    Bomb = fun foo2/0,
145    case get(42) of
146	a -> Bomb();
147	b -> fun foo2/0
148    end.
149
150% Creates two funs with no local return and will return one or die. No spec.
151foo31() ->
152    Bomb = fun foo2/0,
153    case get(42) of
154	a -> Bomb();
155	b -> fun foo2/0
156    end.
157
158% Creates two funs with no local return and will return one or die. With spec.
159-spec foo32() -> fun(() -> no_return()).
160foo32() ->
161    Bomb = fun() -> foo2() end,
162    case get(42) of
163	a -> Bomb();
164	b -> fun() -> foo2() end
165    end.
166
167% Creates two funs with no local return and will return one or die. No spec.
168foo33() ->
169    Bomb = fun() -> foo3() end,
170    case get(42) of
171	a -> Bomb();
172	b -> fun() -> foo3() end
173    end.
174
175% Creates two funs with no local return and will return one or die. With spec.
176-spec foo34() -> fun(() -> no_return()).
177foo34() ->
178    Bomb = fun foo3/0,
179    case get(42) of
180	a -> Bomb();
181	b -> fun foo3/0
182    end.
183
184% Creates two funs with no local return and will return one or die. No spec.
185foo35() ->
186    Bomb = fun foo3/0,
187    case get(42) of
188	a -> Bomb();
189	b -> fun foo3/0
190    end.
191
192% Creates two funs with no local return and will return one or die. With spec.
193-spec foo36() -> fun(() -> no_return()).
194foo36() ->
195    Bomb = fun() -> foo3() end,
196    case get(42) of
197	a -> Bomb();
198	b -> fun() -> foo3() end
199    end.
200
201% Creates two funs with no local return and will return one or die. No spec.
202foo37() ->
203    Bomb = fun() -> foo4() end,
204    case get(42) of
205	a -> Bomb();
206	b -> fun() -> foo4() end
207    end.
208
209% Creates two funs with no local return and will return one or die. With spec.
210-spec foo38() -> fun(() -> no_return()).
211foo38() ->
212    Bomb = fun foo4/0,
213    case get(42) of
214	a -> Bomb();
215	b -> fun foo4/0
216    end.
217
218% Creates two funs with no local return and will return one or die. No spec.
219foo39() ->
220    Bomb = fun foo4/0,
221    case get(42) of
222	a -> Bomb();
223	b -> fun foo4/0
224    end.
225
226% Creates two funs with no local return and will return one or die. With spec.
227-spec foo40() -> fun(() -> no_return()).
228foo40() ->
229    Bomb = fun() -> foo4() end,
230    case get(42) of
231	a -> Bomb();
232	b -> fun() -> foo4() end
233    end.
234
235% Obtains two funs with no local return and will return one or die. No spec.
236foo41() ->
237    Bomb = foo5(),
238    case get(42) of
239	a -> Bomb();
240	b -> foo5()
241    end.
242
243% Obtains two funs with no local return and will return one or die. With spec.
244-spec foo42() -> fun(() -> no_return()).
245foo42() ->
246    Bomb = foo5(),
247    case get(42) of
248	a -> Bomb();
249	b -> foo5()
250    end.
251