aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/small_SUITE_data/src/failing_funs.erl
blob: 1784c4a494da87727123af69dfd0e2c8d8b965c5 (plain) (blame)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
-module(failing_funs).

-compile(export_all).

% Crashes with system call. No spec.
foo1() -> halt().

% Crashes with system call. With spec.
-spec foo2() -> no_return().
foo2() -> halt().

% Crashes on its own. No spec.
foo3() -> case a of b -> ok end.

% Crashes on its own. With spec.
-spec foo4() -> no_return().
foo4() -> case a of b -> ok end.

% Creates fun that crashes with system call. No spec.
foo5() -> fun() -> halt() end.

% Creates fun that crashes with system call. With spec.
-spec foo6() -> fun(() -> no_return()).
foo6() -> fun() -> halt() end.

% Creates fun from named fun that will crash. Neither have spec.
foo7() -> fun foo1/0.

% Creates fun from named fun that will crash. Has spec.
-spec foo8() -> fun(() -> no_return()).
foo8() -> fun foo1/0.

% Creates fun from named fun that will crash. Named has spec.
foo9() -> fun foo2/0.

% Creates fun from named fun that will crash. Both have specs.
-spec foo10() -> fun(() -> no_return()).
foo10() -> fun foo2/0.

% Creates fun from named fun that will crash. Neither have spec.
foo11() -> fun foo3/0.

% Creates fun from named fun that will crash. Has spec.
-spec foo12() -> fun(() -> no_return()).
foo12() -> fun foo3/0.

% Creates fun from named fun that will crash. Named has spec.
foo13() -> fun foo4/0.

% Creates fun from named fun that will crash. Both have specs.
-spec foo14() -> fun(() -> no_return()).
foo14() -> fun foo4/0.

% Creates fun calling a named fun that will crash. Neither have spec.
foo15() -> fun() -> foo1() end.

% Creates fun calling a named fun that will crash. Has spec.
-spec foo16() -> fun(() -> no_return()).
foo16() -> fun() -> foo1() end.

% Creates fun calling a named fun that will crash. Named has spec.
foo17() -> fun() -> foo2() end.

% Creates fun calling a named fun that will crash. Both have specs.
-spec foo18() -> fun(() -> no_return()).
foo18() -> fun() -> foo2() end.

% Creates fun calling a named fun that will crash. Neither have spec.
foo19() -> fun() -> foo3() end.

% Creates fun calling a named fun that will crash. Has spec.
-spec foo20() -> fun(() -> no_return()).
foo20() -> fun() -> foo3() end.

% Creates fun calling a named fun that will crash. Named has spec.
foo21() -> fun() -> foo4() end.

% Creates fun calling a named fun that will crash. Both have specs.
-spec foo22() -> fun(() -> no_return()).
foo22() -> fun() -> foo4() end.

% Creates two funs with no local return and will return one or die. No spec.
foo23() ->
    Bomb = fun() -> halt() end,
    case get(42) of
	a -> Bomb();
	b -> fun() -> halt() end
    end.

% Creates two funs with no local return and will return one or die. With spec.
-spec foo24() -> fun(() -> no_return()).
foo24() ->
    Bomb = fun() -> halt() end,
    case get(42) of
	a -> Bomb();
	b -> fun() -> halt() end
    end.

% Creates two funs with no local return and will return one or die. No spec.
foo25() ->
    Bomb = fun() -> foo1() end,
    case get(42) of
	a -> Bomb();
	b -> fun() -> foo1() end
    end.

% Creates two funs with no local return and will return one or die. With spec.
-spec foo26() -> fun(() -> no_return()).
foo26() ->
    Bomb = fun foo1/0,
    case get(42) of
	a -> Bomb();
	b -> fun foo1/0
    end.

% Creates two funs with no local return and will return one or die. No spec.
foo27() ->
    Bomb = fun foo1/0,
    case get(42) of
	a -> Bomb();
	b -> fun foo1/0
    end.

% Creates two funs with no local return and will return one or die. With spec.
-spec foo28() -> fun(() -> no_return()).
foo28() ->
    Bomb = fun() -> foo1() end,
    case get(42) of
	a -> Bomb();
	b -> fun() -> foo1() end
    end.

% Creates two funs with no local return and will return one or die. No spec.
foo29() ->
    Bomb = fun() -> foo2() end,
    case get(42) of
	a -> Bomb();
	b -> fun() -> foo2() end
    end.

% Creates two funs with no local return and will return one or die. With spec.
-spec foo30() -> fun(() -> no_return()).
foo30() ->
    Bomb = fun foo2/0,
    case get(42) of
	a -> Bomb();
	b -> fun foo2/0
    end.

% Creates two funs with no local return and will return one or die. No spec.
foo31() ->
    Bomb = fun foo2/0,
    case get(42) of
	a -> Bomb();
	b -> fun foo2/0
    end.

% Creates two funs with no local return and will return one or die. With spec.
-spec foo32() -> fun(() -> no_return()).
foo32() ->
    Bomb = fun() -> foo2() end,
    case get(42) of
	a -> Bomb();
	b -> fun() -> foo2() end
    end.

% Creates two funs with no local return and will return one or die. No spec.
foo33() ->
    Bomb = fun() -> foo3() end,
    case get(42) of
	a -> Bomb();
	b -> fun() -> foo3() end
    end.

% Creates two funs with no local return and will return one or die. With spec.
-spec foo34() -> fun(() -> no_return()).
foo34() ->
    Bomb = fun foo3/0,
    case get(42) of
	a -> Bomb();
	b -> fun foo3/0
    end.

% Creates two funs with no local return and will return one or die. No spec.
foo35() ->
    Bomb = fun foo3/0,
    case get(42) of
	a -> Bomb();
	b -> fun foo3/0
    end.

% Creates two funs with no local return and will return one or die. With spec.
-spec foo36() -> fun(() -> no_return()).
foo36() ->
    Bomb = fun() -> foo3() end,
    case get(42) of
	a -> Bomb();
	b -> fun() -> foo3() end
    end.

% Creates two funs with no local return and will return one or die. No spec.
foo37() ->
    Bomb = fun() -> foo4() end,
    case get(42) of
	a -> Bomb();
	b -> fun() -> foo4() end
    end.

% Creates two funs with no local return and will return one or die. With spec.
-spec foo38() -> fun(() -> no_return()).
foo38() ->
    Bomb = fun foo4/0,
    case get(42) of
	a -> Bomb();
	b -> fun foo4/0
    end.

% Creates two funs with no local return and will return one or die. No spec.
foo39() ->
    Bomb = fun foo4/0,
    case get(42) of
	a -> Bomb();
	b -> fun foo4/0
    end.

% Creates two funs with no local return and will return one or die. With spec.
-spec foo40() -> fun(() -> no_return()).
foo40() ->
    Bomb = fun() -> foo4() end,
    case get(42) of
	a -> Bomb();
	b -> fun() -> foo4() end
    end.

% Obtains two funs with no local return and will return one or die. No spec.
foo41() ->
    Bomb = foo5(),
    case get(42) of
	a -> Bomb();
	b -> foo5()
    end.

% Obtains two funs with no local return and will return one or die. With spec.
-spec foo42() -> fun(() -> no_return()).
foo42() ->
    Bomb = foo5(),
    case get(42) of
	a -> Bomb();
	b -> foo5()
    end.