I expected PsiElement.firstChild and PsiElement.children.first() to always return the same PsiElement, however, it turns out that (considering KtElements):
- for
KtBlockExpressionthey are not the same:firstChildreturns a left curly brace andchildren.first()returns the first expression of the body. - for
KtTypeReferencethey are the same thing.
So the questions is:
- Why are they not equivalent in general?
- When are the equivalent and when are they different (I am interested mainly in classes derived from
KtElement)?