gosu-lang
gosu-lang copied to clipboard
Gosu compiler doesn't report an error if static imports are ambiguous
uses SomeClass#foo(String)
uses SomeOtherClass#foo(String)
class Test {
public function f() {
foo("hi")
}
}
Gosu executes the method from SomeClass.
Expected behavior: Gosu reports an error when trying to run the method.
Also if a class declares a method and statically imports another method with the same name, Gosu resolve the method call to the method that was imported. This seems wrong too.
class Test2 {
static function f():String {
return "from Test2"
}
}
uses Test2#f()
class Test {
static function f():String {
return "from Test"
}
static function test() {
print(f()) // prints "from Test2"
}
}
Expected behavior: Gosu reports an error when trying to run the method.
I'd argue that it should be a compiler error rather than a run-time error.