From 1799fa78819905b68e7a2536062de65328399e42 Mon Sep 17 00:00:00 2001 From: Melven Roehrig-Zoellner Date: Tue, 16 Jan 2024 10:50:48 +0100 Subject: [PATCH] extra_arg: fix compatibility with different julia versions --- src/CxxWrap.jl | 2 +- test/functions.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CxxWrap.jl b/src/CxxWrap.jl index 11c2544..4cfea73 100644 --- a/src/CxxWrap.jl +++ b/src/CxxWrap.jl @@ -646,7 +646,7 @@ function build_function_expression(func::CppFunctionInfo, funcidx, julia_mod) # Build an array of arg1::Type1... expressions function argmap(signature) result = Expr[] - for (t, s, i) in zip(signature, argsymbols, range(1,length(signature))) + for (t, s, i) in zip(signature, argsymbols, 1:length(signature)) argt = map_julia_arg_type_named(func.name, t) if isassigned(arg_default_values, i) # somewhat strange syntax to define default argument argument... diff --git a/test/functions.jl b/test/functions.jl index e83f7f5..0dc6f5e 100644 --- a/test/functions.jl +++ b/test/functions.jl @@ -73,7 +73,7 @@ end # Test functions from the CppTestFunctions module @test CppTestFunctions.concatenate_numbers(4, 2.) == "42" -@test methods(CppTestFunctions.concatenate_numbers_with_named_args)[1].slot_syms == "#self#\0i\0d\0val\0" +@test startswith(methods(CppTestFunctions.concatenate_numbers_with_named_args)[1].slot_syms, "#self#\0i\0d\0") @test CppTestFunctions.concatenate_numbers_with_kwargs(d=2., i=4) == "42" @test CppTestFunctions.concatenate_numbers_with_default_values(3) == "35.2" @test CppTestFunctions.concatenate_numbers_with_default_values_of_different_type(3) == "35"