blob: ae8ab75d18fd93d03b987daeb80fdf0a547ebc6d (
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
|
:(scenarios transform) // many of the tests below are *extremely* unsafe
:(scenario abandon_in_same_recipe_as_new)
recipe test [
x:address:number <- new number:type
abandon x
]
# no warnings
:(scenario abandon_in_separate_recipe_from_new)
recipe test [
x:address:number <- test-new
test-abandon x
]
recipe test-new -> result:address:number [
result <- new number:type
]
recipe test-abandon x:address:number [
load-ingredients
abandon x
]
# no warnings
:(scenario define_after_abandon_in_same_recipe_as_new)
recipe test [
x:address:number <- new number:type
abandon x
x <- new number:type
reply x
]
# no warnings
:(scenario define_after_abandon_in_separate_recipe_from_new)
recipe test [
x:address:number <- test-new
test-abandon x
x <- test-new
reply x
]
recipe test-new -> result:address:number [
result <- new number:type
]
recipe test-abandon x:address:number [
load-ingredients
abandon x
]
# no warnings
:(scenario abandon_inside_loop_initializing_variable)
recipe test [
{
x:address:number <- new number:type
abandon x
loop
}
]
# no warnings
:(scenario abandon_inside_loop_initializing_variable_2)
recipe test [
{
x:address:number <- test-new
test-abandon x
loop
}
]
recipe test-new -> result:address:number [
result <- new number:type
]
recipe test-abandon x:address:number [
load-ingredients
abandon x
]
# no warnings
:(scenario abandon_inside_loop_initializing_variable_3)
recipe test [
{
x:address:number <- test-new
test-abandon x
x:address:number <- test-new # modify x to a new value
y:address:number <- copy x # use x after reinitialization
loop
}
]
recipe test-new -> result:address:number [
result <- new number:type
]
recipe test-abandon x:address:number [
load-ingredients
abandon x
]
# no warnings
:(scenario abandon_inside_loop_initializing_variable_4)
container test-list [
value:number
next:address:test-list
]
recipe test-cleanup x:address:test-list [
load-ingredients
{
next:address:test-list <- test-next x
test-abandon x
x <- copy next
loop
}
]
recipe test-next x:address:test-list -> result:address:test-list/contained-in:x [
load-ingredients
result <- get *x, next:offset
]
recipe test-abandon x:address:test-list [
load-ingredients
abandon x
]
# no warnings
:(scenario abandon_non_unique_address_after_define)
recipe test [
x:address:number <- new number:type
y:address:number <- copy x
abandon x
y:address:number <- new number:type # overwrite alias
z:address:number <- copy y
]
# no warnings
|