Mark
03/27/2026, 12:32 PMA extends B and we have two extension funs declared in different packages:
fun A.foo()
fun B.foo()
How can we call both of these from the same class/file which is in the same package as A? Because as soon as we include the import for B.foo(), it will be used for both calls.Ving
03/27/2026, 12:41 PMMark
03/27/2026, 12:44 PMMark
03/27/2026, 12:45 PMVing
03/27/2026, 12:45 PMMark
03/27/2026, 12:47 PMA was resolving to use B.foo() instead of A.foo()Mark
03/27/2026, 12:52 PMB.foo() which added the import, which then meant that a pre-existing a.foo() switched from resolving A.foo() to B.foo()phldavies
03/27/2026, 12:59 PM(a as B).foo() to force B.foo() to be resolvedMark
03/27/2026, 1:00 PMMark
03/27/2026, 1:01 PMA and so the IDE showed the as A as redundant. And anyway, it clicked through to B.foo()phldavies
03/27/2026, 1:02 PMphldavies
03/27/2026, 1:03 PMfoo from the same package additionally (explicit imports have a higher resolution priority)Mark
03/27/2026, 1:04 PMimport packageB.foo as bfoo instead of import packageB.foo . No need to import current package A.foo . Although I suppose it might be good for clarity to import both.phldavies
03/27/2026, 1:08 PMMark
03/27/2026, 1:08 PMMark
03/27/2026, 1:09 PMMark
03/27/2026, 1:11 PMphldavies
03/27/2026, 1:11 PMMark
03/27/2026, 1:11 PMphldavies
03/27/2026, 1:11 PM