Silver: is and as? operator does work with extensions of base

IDE: Fire
Version: 8.4.96.2043
Target (If relevant): Java
Description:

After extending java.io.File and making it comply to protocol is and as? operators will fail to identify the instance as being of type java.io.File.
When creating my own class, extending, and making it comply to the very same protocol, works fine.

Compiler generated extension subclass:

entity: lakestonecore.tests.__Extension_File$Duck_File_AnyFileOrDirectory

code (TestDirectory.swift):

for entity in testDirectory.filesAndSubdirectories {
	if entity.isDirectory {
		Assert.IsTrue(entity is Directory)
	} else {
                 //fails here
		//Assert.IsTrue(entity is File)
	}
}

Actual code can be found here:

We’ve got some ideas on how to solve this in a limited way, ie if you have the interfaces it can allow casting back, but it won’t work as say Object -> File when originating as a AnyFileOrDrecitory.

Thanks, logged as bugs://76302

Yeah, right. It’s not a big deal, I only intented using is type check for this API in unit test case, but overall I guess it might be more or less common issue.

bugs://76302 got closed with status fixed.

So this works (well partially); when you have a File and cast it to AnyFileOrDirectory (which is an extension) it works, is works too. When you have an Object/Any containing a File it won’t work unfortunately, that’s a runtime limitation.