goplus / gop

The Go+ programming language is designed for engineering, STEM education, and data science
https://goplus.org
Apache License 2.0
8.89k stars 547 forks source link

overload in classfile can't run #1874

Closed luoliwoshang closed 2 months ago

luoliwoshang commented 2 months ago

Is it expected that the overloaded function defined in classfile is not recognized as overload

over.gox

func addString(a, b string) string {
    return a + b
}

func add = (
    func(a, b int) int {
        return a + b
    }
    addString
)

main.gop

ov := &over{}
println ov.add__0(1, 1) // 2
println ov.addString("1", "1") // 11

// println ov.add(1, 1) // got error

Expected result

2
11
2

Got

$ gop run .
main.gop:5:9: ov.add undefined (type *over has no field or method add)

===> errors stack:
gop.LoadDir(".", 0x140000a35e0, false)
        /Users/zhangzhiyang/Documents/Code/goplus/gop/gengo.go:169 LoadDir(dir, conf, genTestPkg)
gop.GenGo(".", 0x140000a35e0, false)
        /Users/zhangzhiyang/Documents/Code/goplus/gop/build_install_run.go:142 GenGo(dir, conf, false)

Gop Version

v1.2.x

Additional Notes

No response