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

Fix textual printing of byte slices #266

Merged
merged 1 commit into from Jul 19, 2021
Merged

Fix textual printing of byte slices #266

merged 1 commit into from Jul 19, 2021

Commits on Jul 19, 2021

  1. Fix textual printing of byte slices

    There are two bugs being fixed:
    
    1.  The hueristic for whether a slice of byte looks like text
        should check whether a rune IsPrint OR IsSpace, and not both.
        Only a single rune (i.e., U+0020) ever satisfies both conditions.
    
        Previously, it would print as:
            MyBytes{0x68, 0x65, 0x6c, 0x6c, 0x6f}
        and now it would now print as:
            MyBytes(MyBytes("hello"))
    
    2.  If we're printing as string, then we should set skipType=true
        since we already explicitly format the value with the type.
    
        Previously, it would print as:
            MyBytes(MyBytes("hello"))
        and now it would now print as:
            MyBytes("hello")
    dsnet committed Jul 19, 2021
    Copy the full SHA
    d5fcb38 View commit details
    Browse the repository at this point in the history