XSharpPublic icon indicating copy to clipboard operation
XSharpPublic copied to clipboard

Inheriting more interfaces results to ambiguous warning

Open hpetriffer opened this issue 2 months ago • 1 comments

The following code

interface ITest inherit ITest1, ITest2
end interface

interface ITest1
   property Caption as string get set

	method Start() as void
end interface

interface ITest2
   property Caption as string get set
	method Start() as void
end interface



class TestClass implements ITest
	property Caption as string auto get set := "Test"
	method Start() as void
		return
end class

function Start() as void strict
	var test := (ITest)TestClass{}

	test.Start()
	test.Caption := "New Caption"

	return

When compiling this code I get in the line with test.Start() and test.Caption errors and warnings:

C:\Projects\Tests\XSharpSlowTests\XSharpTests\Program.prg(31,2): error XS0121: The call is ambiguous between the following methods or properties: 'ITest1.Start()' and 'ITest2.Start()'
C:\Projects\Tests\XSharpSlowTests\XSharpTests\Program.prg(32,2): warning XS9043: 'Caption' is ambiguous. Could be Property 'ITest1.Caption' in XSharpTests or Property 'ITest2.Caption' in XSharpTests. Using the first one.

hpetriffer avatar Oct 31 '25 06:10 hpetriffer

It looks like #1742

hpetriffer avatar Oct 31 '25 06:10 hpetriffer