Remove the -rename option in the Go language support. Do a much

better job of checking for name conflicts.  Ignore conflicting names
with a warning.  Adjust the testsuite accordingly.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12135 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Ian Lance Taylor 2010-06-17 18:59:26 +00:00
commit 2970f53c21
18 changed files with 232 additions and 94 deletions

View file

@ -21,22 +21,6 @@ top_builddir = @top_builddir@
include $(srcdir)/../common.mk
# Custom tests - tests with additional commandline options
constant_pointers.cpptest: SWIGOPT += -rename foo=foofn
director_enum.cpptest: SWIGOPT += -rename Hello=Helloe
director_finalizer.cpptest: SWIGOPT += -rename deleteFoo=deleteFooFn
enum_thorough.cpptest: SWIGOPT += -rename One=Onee -rename Two=Twoe
mixed_types.cpptest: SWIGOPT += -rename Hello=Helloe
overload_simple.cpptest: SWIGOPT += -rename foo=foofn
smart_pointer_extend.cpptest: SWIGOPT += -rename CPtrFoo=CPtrFoos
smart_pointer_member.cpptest: SWIGOPT += -rename Foo=Foos
special_variable_macros.cpptest: SWIGOPT += -rename Name=Names
template_partial_specialization.cpptest: SWIGOPT += -rename b=bfn
template_partial_specialization_typedef.cpptest: SWIGOPT += -rename b=bfn
template_specialization_enum.cpptest: SWIGOPT += -rename Hello=Helloe
preproc.ctest: SWIGOPT += -rename a5=a5c -rename a6=a6c
mod.multicpptest: SWIGOPT += -rename GetC=GetCFn
.SUFFIXES: .cpptest .ctest .multicpptest
# Rules for the different types of tests

View file

@ -3,7 +3,7 @@ package main
import "./director_enum"
type MyFoo struct{} // From director_enum.Foo
func (p *MyFoo) Say_hi(val director_enum.EnumDirectorHelloe) director_enum.EnumDirectorHelloe {
func (p *MyFoo) Say_hi(val director_enum.EnumDirectorHello) director_enum.EnumDirectorHello {
return val
}

View file

@ -3,57 +3,57 @@ package main
import . "./overload_simple"
func main() {
if Foofn(3) != "foo:int" {
if Foo(3) != "foo:int" {
panic("foo(int)")
}
if Foofn(float64(3.0)) != "foo:double" {
if Foo(float64(3.0)) != "foo:double" {
panic("foo(double)")
}
if Foofn("hello") != "foo:char *" {
if Foo("hello") != "foo:char *" {
panic("foo(char *)")
}
f := NewFoo()
f := NewFoos()
b := NewBar()
if Foofn(f) != "foo:Foo *" {
if Foo(f) != "foo:Foo *" {
panic("foo(Foo *)")
}
if Foofn(b) != "foo:Bar *" {
if Foo(b) != "foo:Bar *" {
panic("foo(Bar *)")
}
v := Malloc_void(32)
if Foofn(v) != "foo:void *" {
if Foo(v) != "foo:void *" {
panic("foo(void *)")
}
s := NewSpam()
if s.Foofn(3) != "foo:int" {
if s.Foo(3) != "foo:int" {
panic("Spam::foo(int)")
}
if s.Foofn(float64(3.0)) != "foo:double" {
if s.Foo(float64(3.0)) != "foo:double" {
panic("Spam::foo(double)")
}
if s.Foofn("hello") != "foo:char *" {
if s.Foo("hello") != "foo:char *" {
panic("Spam::foo(char *)")
}
if s.Foofn(f) != "foo:Foo *" {
if s.Foo(f) != "foo:Foo *" {
panic("Spam::foo(Foo *)")
}
if s.Foofn(b) != "foo:Bar *" {
if s.Foo(b) != "foo:Bar *" {
panic("Spam::foo(Bar *)")
}
if s.Foofn(v) != "foo:void *" {
if s.Foo(v) != "foo:void *" {
panic("Spam::foo(void *)")
}

View file

@ -4,7 +4,7 @@ import "fmt"
import . "./smart_pointer_member"
func main() {
f := NewFoos()
f := NewFoo()
f.SetY(1)
if f.GetY() != 1 {
@ -24,7 +24,7 @@ func main() {
panic(0)
}
if b.GetZ() != GetFoosZ() {
if b.GetZ() != GetFooZ() {
panic(0)
}
}

View file

@ -3,7 +3,7 @@ package main
import "./special_variable_macros"
func main() {
name := special_variable_macros.NewNames()
name := special_variable_macros.NewName()
if special_variable_macros.TestFred(name) != "none" {
panic("test failed")
}