Improved instance method resolution logic and added test for Decimal overloading.

This commit is contained in:
sergeych committed 2026-03-30 08:53:07 +03:00
1 parent 286ec30422
commit cdd48ec871
2 files changed
+18 -2

No files matched your search

@@ -1180,8 +1180,11 @@ open class ObjClass(
scope: Scope, name: String, args: Arguments,
onNotFoundResult: (suspend () -> Obj?)?
): Obj {
getInstanceMemberOrNull(name)?.let { rec ->
val decl = rec.declaringClass ?: findDeclaringClassOf(name) ?: this
classScope?.objects?.get(name)?.let { rec ->
val decl = rec.declaringClass ?: this
if (!rec.visibility.isPublic) {
return super.invokeInstanceMethod(scope, name, args, onNotFoundResult)
}
if (rec.type == ObjRecord.Type.Delegated) {
val del = rec.delegate ?: scope.raiseError("Internal error: delegated member $name has no delegate")
val allArgs = (listOf(this, ObjString(name)) + args.list).toTypedArray()