rhogen: fix problems with nested return types