Annotations not returning on #ancestors

https://play.crystal-lang.org/#/r/6n36

Wanted to make sure this is a bug before creating an issue.

It seems when using #ancestors, #annotation always returns nil?

Which annotation should it show? Grandchild inherits directly from Parent which doesn’t have an annotation.

If you print the class names alongside the expected output, you would notice that Child is not an ancestor (what you probably expected).

2 Likes

Oops that was a typo on my part, sorry about that.

https://play.crystal-lang.org/#/r/6n7a was the actual issue i was seeing, however after trying to reproduce this i noticed i had an extra .class before calling ancestors, which prob made parent not what i was thinking it was, thus returning nil on annotation.

EDIT: Hmm, but that caused some of my other specs to fail…
EDIT2: Nvm, moved the .class somewhere else.