Support complex hierarchy in desugared library

Bug: b/202188674
Change-Id: I23d6ef12ec723f50a62e8da7b79c557058a4de99