Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore:fix scalafmt HeadersSpec error because illegal unicode #297

Merged
merged 1 commit into from
Apr 14, 2024

Conversation

laglangyue
Copy link
Contributor

motivation

can't execute sbt scalafmtAll

invalid unicode surrogate pair
[error]         ("my favorite character is \ud801", "my favorite character is ?")

according to test in grpc-java, we should use 0xD801.toChar
https://github.com/grpc/grpc-java/blob/79e75bace40cea7e4be72e7dcd1f41c3ad6ee857/api/src/test/java/io/grpc/StatusTest.java#L82-L92

Copy link
Member

@He-Pin He-Pin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm thanks

@He-Pin He-Pin changed the title fix scalafmt HeadersSpec error because illegal unicode chore:fix scalafmt HeadersSpec error because illegal unicode Apr 14, 2024
@He-Pin He-Pin merged commit 37d45c2 into apache:main Apr 14, 2024
20 checks passed
@laglangyue laglangyue deleted the fix-scalafmtAll-error-HeaderSpec branch April 18, 2024 07:35
@raboof
Copy link
Member

raboof commented Apr 25, 2024

huh, I could've sworn this syntax was allowed in Scala, but indeed I don't see it in https://scala-lang.org/files/archive/spec/2.13/01-lexical-syntax.html#string-literals

@laglangyue
Copy link
Contributor Author

@raboof
Here is a timeline:
I started to discover the problem, and I thought it was a problem with scalafmt, but members of scalafmt thought it was an abandoned unicode, which is actually very rare. This symbol has a universal unicode
Then I submitted a PR.
Finally, I argued with scalafmt that they are compatible with this Unicode form and will not throw exceptions

@laglangyue
Copy link
Contributor Author

Both writing methods are okay in Scala, and grpc-java uses (char) "xxx". This pr will not affect the our test.
here is issue
scalameta/scalameta#3690
Because this issue occurs after this PR, So I didn't give any feedback on what happened afterwards to the Pekko community

@raboof
Copy link
Member

raboof commented Apr 26, 2024

both writing methods are okay in Scala

I agree the compiler currently appears to supports it, but I don't see anything in the language specification that says it must - so perhaps it would be best not to make assumptions? Or did I miss the part of the specification that covers this case?

scalameta/scalameta#3690

Thanks for bringing the issue up there and adding the reference here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants