Infer property type if not null
I have a function like the following:
fun getCommonItemsFrom(element: Element): List? =
if (element.parent is CommonElementWrapper) element.items
else null
So let's assume that Element has a property called parent, which is of type ElementWrapper? (an interface). And this property may or may not be a concrete instance of CommonElementWrapper.
This function returns the items (that is non-nullable List) of an Element, as long as the parent property is an instance of...