Build failed on s390x with latest changes in Lexer.cpp

Our nightly master branch build on s390x failed with the following error:

09:09:39 /home/swiftbuild/workspace/Swift/CONFIG/FIVE/GIT_BRANCH/master/label/csz25097/swift/lib/Parse/Lexer.cpp:2460:17: error: overflow converting case value to switch condition type (-2 to 254) [-Werror,-Wswitch]
09:09:39   case -1: case -2:
09:09:39                 ^
09:09:39 /home/swiftbuild/workspace/Swift/CONFIG/FIVE/GIT_BRANCH/master/label/csz25097/swift/lib/Parse/Lexer.cpp:2460:8: error: overflow converting case value to switch condition type (-1 to 255) [-Werror,-Wswitch]
09:09:39   case -1: case -2:
09:09:39        ^
09:09:39 2 errors generated.

Looks like this commit introduced the new code in question:

Any suggestions on how to fix this?

Thanks.

I think the usual thing would be to comment on @omochimetaru’s PR (but tagging them here since there is a thread now). It seems like a simple enough thing to fix (case (uint8_t)-1).

EDIT: Ah, it’s probably that char is signed on Mac and x86_64 Linux platforms but unsigned on s390x. So casting to char would be the fix, not to uint8_t.

Ah, you can use the same treatment in lexImpl()

Sorry for inconvenience.
I will submit a patch.

Merged https://github.com/apple/swift/pull/15068

Thanks for the patch!