Fix using statements for overloaded methods

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10176 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2007-11-30 22:34:50 +00:00
commit 575efcdd53
9 changed files with 317 additions and 52 deletions

View file

@ -2,10 +2,33 @@ from using_composition import *
f = FooBar()
if f.blah(3) != 3:
raise RuntimeError,"blah(int)"
raise RuntimeError,"FooBar::blah(int)"
if f.blah(3.5) != 3.5:
raise RuntimeError,"blah(double)"
raise RuntimeError,"FooBar::blah(double)"
if f.blah("hello") != "hello":
raise RuntimeError,"blah(char *)"
raise RuntimeError,"FooBar::blah(char *)"
f = FooBar2()
if f.blah(3) != 3:
raise RuntimeError,"FooBar2::blah(int)"
if f.blah(3.5) != 3.5:
raise RuntimeError,"FooBar2::blah(double)"
if f.blah("hello") != "hello":
raise RuntimeError,"FooBar2::blah(char *)"
f = FooBar3()
if f.blah(3) != 3:
raise RuntimeError,"FooBar3::blah(int)"
if f.blah(3.5) != 3.5:
raise RuntimeError,"FooBar3::blah(double)"
if f.blah("hello") != "hello":
raise RuntimeError,"FooBar3::blah(char *)"

View file

@ -2,7 +2,48 @@ from using_inherit import *
b = Bar()
if b.test(3) != 3:
raise RuntimeError,"test(int)"
raise RuntimeError,"Bar::test(int)"
if b.test(3.5) != 3.5:
raise RuntimeError, "test(double)"
raise RuntimeError, "Bar::test(double)"
b = Bar2()
if b.test(3) != 6:
raise RuntimeError,"Bar2::test(int)"
if b.test(3.5) != 7.0:
raise RuntimeError, "Bar2::test(double)"
b = Bar3()
if b.test(3) != 6:
raise RuntimeError,"Bar3::test(int)"
if b.test(3.5) != 7.0:
raise RuntimeError, "Bar3::test(double)"
b = Bar4()
if b.test(3) != 6:
raise RuntimeError,"Bar4::test(int)"
if b.test(3.5) != 7.0:
raise RuntimeError, "Bar4::test(double)"
b = Fred1()
if b.test(3) != 3:
raise RuntimeError,"Fred1::test(int)"
if b.test(3.5) != 7.0:
raise RuntimeError, "Fred1::test(double)"
b = Fred2()
if b.test(3) != 3:
raise RuntimeError,"Fred2::test(int)"
if b.test(3.5) != 7.0:
raise RuntimeError, "Fred2::test(double)"

View file

@ -15,14 +15,42 @@ include Using_composition
f = FooBar.new
if f.blah(3) != 3
raise RuntimeError,"blah(int)"
raise RuntimeError,"FooBar::blah(int)"
end
if f.blah(3.5) != 3.5
raise RuntimeError,"blah(double)"
raise RuntimeError,"FooBar::blah(double)"
end
if f.blah("hello") != "hello"
raise RuntimeError,"blah(char *)"
raise RuntimeError,"FooBar::blah(char *)"
end
f = FooBar2.new
if f.blah(3) != 3
raise RuntimeError,"FooBar2::blah(int)"
end
if f.blah(3.5) != 3.5
raise RuntimeError,"FooBar2::blah(double)"
end
if f.blah("hello") != "hello"
raise RuntimeError,"FooBar2::blah(char *)"
end
f = FooBar3.new
if f.blah(3) != 3
raise RuntimeError,"FooBar3::blah(int)"
end
if f.blah(3.5) != 3.5
raise RuntimeError,"FooBar3::blah(double)"
end
if f.blah("hello") != "hello"
raise RuntimeError,"FooBar3::blah(char *)"
end

View file

@ -15,10 +15,60 @@ include Using_inherit
b = Bar.new
if b.test(3) != 3
raise RuntimeError,"test(int)"
raise RuntimeError,"Bar::test(int)"
end
if b.test(3.5) != 3.5
raise RuntimeError, "test(double)"
raise RuntimeError, "Bar::test(double)"
end
b = Bar2.new
if b.test(3) != 6
raise RuntimeError,"Bar2::test(int)"
end
if b.test(3.5) != 7.0
raise RuntimeError, "Bar2::test(double)"
end
b = Bar3.new
if b.test(3) != 6
raise RuntimeError,"Bar3::test(int)"
end
if b.test(3.5) != 7.0
raise RuntimeError, "Bar3::test(double)"
end
b = Bar4.new
if b.test(3) != 6
raise RuntimeError,"Bar4::test(int)"
end
if b.test(3.5) != 7.0
raise RuntimeError, "Bar4::test(double)"
end
b = Fred1.new
if b.test(3) != 3
raise RuntimeError,"Fred1::test(int)"
end
if b.test(3.5) != 7.0
raise RuntimeError, "Fred1::test(double)"
end
b = Fred2.new
if b.test(3) != 3
raise RuntimeError,"Fred2::test(int)"
end
if b.test(3.5) != 7.0
raise RuntimeError, "Fred2::test(double)"
end

View file

@ -26,4 +26,18 @@ public:
char *blah(char *x) { return x; }
};
class FooBar2 : public Foo, public Bar {
public:
char *blah(char *x) { return x; }
using Foo::blah;
using Bar::blah;
};
class FooBar3 : public Foo, public Bar {
public:
using Foo::blah;
char *blah(char *x) { return x; }
using Bar::blah;
};
%}

View file

@ -17,5 +17,38 @@ public:
using Foo::test;
};
class Bar2 : public Foo {
public:
int test(int x) { return x*2; }
double test(double x) { return x*2; };
using Foo::test;
};
class Bar3 : public Foo {
public:
int test(int x) { return x*2; }
double test(double x) { return x*2; };
using Foo::test;
};
class Bar4 : public Foo {
public:
int test(int x) { return x*2; }
using Foo::test;
double test(double x) { return x*2; };
};
class Fred1 : public Foo {
public:
using Foo::test;
double test(double x) { return x*2; };
};
class Fred2 : public Foo {
public:
double test(double x) { return x*2; };
using Foo::test;
};
%}