Skip to content

Commit bf9e19c

Browse files
authored
Merge pull request #266 from maleadt/tb/assume
Fix return value of assume.
2 parents 8ad6382 + f9f0787 commit bf9e19c

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "LLVM"
22
uuid = "929cbde3-209d-540e-8aea-75f648917ca0"
3-
version = "4.5.0"
3+
version = "4.5.1"
44

55
[deps]
66
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"

src/interop/intrinsics.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ export trap, assume
1515
Nothing, Tuple{Bool}, cond)
1616

1717
# do-block syntax
18-
@inline function assume(f::F, val...) where {F}
19-
assume(f(val...))
18+
@inline function assume(f::F) where {F}
19+
assume(f())
20+
return
21+
end
22+
@inline function assume(f::F, val) where {F}
23+
assume(f(val))
2024
return val
2125
end

test/interop.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,13 @@ end
131131

132132

133133
@testset "intrinsics" begin
134-
assume(true)
135-
assume() do
134+
@test assume(true) === nothing
135+
@test assume() do
136136
true
137-
end
137+
end === nothing
138+
@test assume(rand()) do x
139+
0 <= x <= 1
140+
end isa Float64
138141
end
139142

140143
using Core: LLVMPtr

0 commit comments

Comments
 (0)