The kwargs feature no longer turns on compactdefaultargs for languages that don't support kwargs.
Affects all languages except Python and Ruby. Closes #242
This commit is contained in:
parent
b57a675d00
commit
bfde148887
14 changed files with 72 additions and 21 deletions
|
|
@ -249,6 +249,7 @@ CPP_TEST_CASES += \
|
|||
insert_directive \
|
||||
keyword_rename \
|
||||
kind \
|
||||
kwargs_feature \
|
||||
langobj \
|
||||
li_attribute \
|
||||
li_attribute_template \
|
||||
|
|
|
|||
23
Examples/test-suite/java/kwargs_feature_runme.java
Normal file
23
Examples/test-suite/java/kwargs_feature_runme.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import kwargs_feature.*;
|
||||
|
||||
public class kwargs_feature_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("kwargs_feature");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
// Check normal overloading still works (no compactdefaultargs) if the kwargs feature is used,
|
||||
// as the kwargs feature is not supported
|
||||
Foo f = new Foo(99);
|
||||
if (f.foo() != 1)
|
||||
throw new RuntimeException("It went wrong");
|
||||
if (Foo.statfoo(2) != 2)
|
||||
throw new RuntimeException("It went wrong");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
%module kwargs_feature
|
||||
|
||||
%nocopyctor;
|
||||
%kwargs;
|
||||
%feature("kwargs");
|
||||
|
||||
%rename(myDel) del;
|
||||
%inline
|
||||
|
|
@ -35,9 +35,7 @@
|
|||
|
||||
virtual ~Foo() {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
%}
|
||||
|
||||
|
||||
|
|
@ -64,8 +62,7 @@
|
|||
|
||||
// Functions
|
||||
%inline %{
|
||||
int foo(int a = 1, int b = 0) {return a + b; }
|
||||
|
||||
int foo_fn(int a = 1, int b = 0) {return a + b; }
|
||||
|
||||
template<typename T> T templatedfunction(T a = 1, T b = 0) { return a + b; }
|
||||
%}
|
||||
|
|
@ -73,10 +70,8 @@
|
|||
%template(templatedfunction) templatedfunction<int>;
|
||||
|
||||
|
||||
// Deafult args with references
|
||||
%inline
|
||||
%{
|
||||
|
||||
// Default args with references
|
||||
%inline %{
|
||||
typedef int size_type;
|
||||
|
||||
struct Hello
|
||||
|
|
@ -84,13 +79,10 @@
|
|||
static const size_type hello = 3;
|
||||
};
|
||||
|
||||
|
||||
|
||||
int rfoo( const size_type& x = Hello::hello, const Hello& y = Hello() )
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
%}
|
||||
%{
|
||||
const int Hello::hello;
|
||||
|
|
@ -104,9 +96,7 @@
|
|||
|
||||
int foo_kw(int from = 1, int except = 2) {return from + except; }
|
||||
|
||||
|
||||
int foo_nu(int from = 1, int = 0) {return from; }
|
||||
|
||||
int foo_mm(int min = 1, int max = 2) {return min + max; }
|
||||
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ CPP_TEST_CASES += \
|
|||
inout \
|
||||
inplaceadd \
|
||||
input \
|
||||
kwargs_feature \
|
||||
li_cstring \
|
||||
li_cwstring \
|
||||
li_factory \
|
||||
|
|
|
|||
|
|
@ -44,10 +44,10 @@ if BarInt_sbar(b=2) != 3:
|
|||
if templatedfunction(b=2) != 3:
|
||||
raise RuntimeError
|
||||
|
||||
if foo(a=1,b=2) != 3:
|
||||
if foo_fn(a=1,b=2) != 3:
|
||||
raise RuntimeError
|
||||
|
||||
if foo(b=2) != 3:
|
||||
if foo_fn(b=2) != 3:
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ top_srcdir = @top_srcdir@
|
|||
top_builddir = @top_builddir@
|
||||
|
||||
CPP_TEST_CASES = \
|
||||
kwargs_feature \
|
||||
li_cdata \
|
||||
li_cstring \
|
||||
li_factory \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue