Why does the following not work in Nim? type Entity = ref object of RootObj Enemy = ref object of Entity name: string method some_method(enemy: Enemy) = echo enemy.name if obj of Enemy: obj.some_method() I would have thought that the "of" operator would narrow the type so I could call the method on Enemy