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

@@ -295,4 +295,17 @@ class DecimalModuleTest {
assertEquals(2, ex.pos.line)
}
@Test
fun testOverloading() = runTest {
eval("""
import lyng.decimal
assert( 1.d is Decimal )
assertEquals(Decimal, abs(1.d)::class)
// here the inference must work:
val t = abs(-10.d)
assert(t is Decimal)
assertEquals(10,t)
""".trimIndent())
}
}