```(file.decls[0] as Node.Decl.Structured).members...
# effective-kotlin
a
Copy code
(file.decls[0] as Node.Decl.Structured).members.forEach {
            when (it) {
                is Node.Decl.Structured -> println("this is probably a companion object")
                is Node.Decl.Property -> convertToClassProperty(it, classProperties, className, path)
                is Node.Decl.Func -> breakdownClassMethod(it, classMethods)
            }
        }
l
If you want to match a when branch on it being the companion object, just remove the
is
. Smart casts work on it, I used it again just today.