Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
christiangnrd committed Jan 25, 2025
1 parent f533585 commit 7a96bf4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/generator/codegen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ function generateautopropertydecl(propdeclnode, minsup, versiongetter, options::
if isnothing(version_introduced) || isnothing(minsup) || isnothing(versiongetter) || version_introduced <= minsup
return expr
else
return Expr(:macrocall, Symbol("@static"), nothing, Expr(:if, Expr(:call, :(>=), versiongetter, version_introduced), Expr(:block, expr)))
return Expr(:macrocall, Symbol("@static"), nothing, Expr(:if, Expr(:call, versiongetter, version_introduced), Expr(:block, expr)))
end
end

Expand Down Expand Up @@ -906,7 +906,7 @@ end
if isnothing(version_introduced) || isnothing(minsupported) || isnothing(versiongetter) || version_introduced <= minsupported
push!(node.exprs, tmpexprs...)
else
verexpr = Expr(:macrocall, Symbol("@static"), nothing, Expr(:if, Expr(:call, :(>=), versiongetter, version_introduced), Expr(:block, tmpexprs...)))
verexpr = Expr(:macrocall, Symbol("@static"), nothing, Expr(:if, Expr(:call, versiongetter, version_introduced), Expr(:block, tmpexprs...)))
push!(node.exprs, verexpr)
end

Expand Down
6 changes: 3 additions & 3 deletions test/generators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ end
@static if Sys.isapple()
@testset "Objective-C" begin
args = [get_default_args(); ["-x","objective-c"]]
options = Dict("codegen" => Dict{String,Any}("version_function" => "version_function()"))
options = Dict("codegen" => Dict{String,Any}("version_function" => "version_function"))

ctx = create_context([joinpath(@__DIR__, "include/objectiveC.h")], args, options)
mktemp() do path, io
Expand All @@ -253,8 +253,8 @@ end
@test contains(output[],"@objcwrapper immutable = true TestProtocol2 <: TestProtocol") # Protocol subtyping Protocol
@test contains(output[],"@objcwrapper immutable = true TestInterface <: NSObject") # Interface

@test contains(output[],"@static if version_function() >= v\"100.11.0\"") # Wrapper Availability
@test contains(output[],"@static if version_function() >= v\"101.11.0\"") # Property Availability
@test contains(output[],"@static if version_function(v\"100.11.0\")") # Wrapper Availability
@test contains(output[],"@static if version_function(v\"101.11.0\")") # Property Availability

# Interface Properties
@test contains(output[],"@objcproperties TestInterfaceProperties begin")
Expand Down

0 comments on commit 7a96bf4

Please sign in to comment.