We treated enum case parameters the same way as function parameters and weren’t considering that they can be unlabeled. That caused us to insert eg. `_ ` in front of the case’s type, producing `case myCase(_ String)`, which is invalid. When we are inside an enum case parameter and the parameter label is empty, treat it the same as a function call, which will leave the label untouched if it isn’t modified and insert a label including a colon if a new label is introduced.
https://github.com/apple/sourcekit-lsp/issues/1228
When built as part of the compiler toolchain SwiftSyntax is built with library
evolution enabled. This means that switches over enums from SwiftSyntax must
include a default case to be considered exhaustive, or a warning will be
emitted. This change suppresses those warnings by adding `@unknown default`
cases wherever they are expected. As a compromise, these `@unknown default`
cases are wrapped with a `#if` to ensure they are only included in the CMake
build of ASTGen, but continue to be omitted from the SPM build which compiler
engineers use to iterate on ASTGen's implementation. This is needed to avoid
generating the opposite warning during the SPM build, since the compiler thinks
the `@unknown default` case is superfluous when SwiftSyntax is built
non-resiliently. As an aside, this catch-22 is a bummer and I think we should
change the compiler to suppress the unreachable default warning when the
default is annotated `@unknown`.
Refactor `addSyntacticRenameRanges`, adding comments to make it easier to follow and remove its dependency on the `IsFunctionLike` parameter in `RenameLoc`.
This was causing build issues on Linux with Swift 5.8. Instead, wrap the `std::vector` in a `BridgedResolvedLocVector` that has a pointer to a heap-allocated `std::vector`