I was browsing the Swift source code (in C++ using the LLVM interface libraries). I was reading the file about recognizing type expressions and another file about recognizing value expressions. I was thinking about trying to add a type construction that involves an opaque type. I was ready to think about parsing a "some
" followed by another type expression, but I got worried about what if the opaque type is hidden behind a type alias. I recently tried a (macOS) playground, and it doesn't allow making an opaque type into an alias.
That's good from a user viewpoint. But now I'm wondering how opaque types are identified. Does each type expression that allows an opaque type within it search for a "some
" followed by another type expression? Or is there a common code all those experiences share? And if it's shared code (I hope so), where is it?