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

Formatter just weird in match case with many alternatives #940

Open
JonasWanke opened this issue Feb 8, 2024 · 0 comments
Open

Formatter just weird in match case with many alternatives #940

JonasWanke opened this issue Feb 8, 2024 · 0 comments
Labels
P: Compiler: Formatter Package: Candy's formatter T: Fix Type: Bug Fixes

Comments

@JonasWanke
Copy link
Member

Input

is color := color %
  Black |
  Red |
  Green |
  Yellow |
  Blue |
  Magenta |
  Cyan |
  White |
  BrightBlack |
  BrightRed |
  BrightGreen |
  BrightYellow |
  BrightBlue |
  BrightMagenta |
  BrightCyan |
  BrightWhite -> True
  TrueColor [red, green, blue] -> int.isUnsignedByte red | bool.lazyAnd {int.isUnsignedByte green} | bool.lazyAnd {int.isUnsignedByte blue}
  _ -> False

Actual Output

is color := color %
  Black |   Red | 
  Green |   Yellow | 
  Blue |   Magenta | 
  Cyan |   White | 
  BrightBlack |   BrightRed | 
  BrightGreen |   BrightYellow | 
  BrightBlue |   BrightMagenta | 
  BrightCyan |  
    BrightWhite
    ->
    True
  TrueColor [red, green, blue] ->
    int.isUnsignedByte red | bool.lazyAnd { int.isUnsignedByte green }
    | bool.lazyAnd { int.isUnsignedByte blue }
  _ -> False

# Then:

is color := color %
  Black | Red |   Green | Yellow | 
  Blue | Magenta |   Cyan | White | 
  BrightBlack | BrightRed |   BrightGreen | BrightYellow | 
  BrightBlue | BrightMagenta |  
    BrightCyan | 
    BrightWhite
    ->
    True
  TrueColor [red, green, blue] ->
    int.isUnsignedByte red | bool.lazyAnd { int.isUnsignedByte green }
    | bool.lazyAnd { int.isUnsignedByte blue }
  _ -> False

# Then:

is color := color %
  Black | Red | Green | Yellow |   Blue | Magenta | Cyan | White | 
  BrightBlack | BrightRed | BrightGreen | BrightYellow |  
    BrightBlue | BrightMagenta | 
    BrightCyan | 
    BrightWhite
    ->
    True
  TrueColor [red, green, blue] ->
    int.isUnsignedByte red | bool.lazyAnd { int.isUnsignedByte green }
    | bool.lazyAnd { int.isUnsignedByte blue }
  _ -> False

# Then:

is color := color %
  Black | Red | Green | Yellow | Blue | Magenta | Cyan | White |  
    BrightBlack | BrightRed | BrightGreen | BrightYellow | 
    BrightBlue | BrightMagenta | 
    BrightCyan | 
    BrightWhite
    ->
    True
  TrueColor [red, green, blue] ->
    int.isUnsignedByte red | bool.lazyAnd { int.isUnsignedByte green }
    | bool.lazyAnd { int.isUnsignedByte blue }
  _ -> False

# Then:

is color := color %
  (
    Black | Red | Green | Yellow | Blue | Magenta | Cyan | White | BrightBlack | BrightRed
  | BrightGreen
  | BrightYellow
  | BrightBlue
  | BrightMagenta
  | BrightCyan
  | BrightWhite
  )
    ->
    True 
    TrueColor [red, green, blue]
    ->
    int.isUnsignedByte red | bool.lazyAnd { int.isUnsignedByte green }
    | bool.lazyAnd { int.isUnsignedByte blue }
  _ -> False

# Then:

is color := color %
  Black | Red | Green | Yellow | Blue | Magenta | Cyan | White | BrightBlack | BrightRed
  | BrightGreen
  | BrightYellow
  | BrightBlue
  | BrightMagenta
  | BrightCyan
  | BrightWhite 
    )
    ->
    True
    TrueColor [red, green, blue]
    ->
    int.isUnsignedByte red | bool.lazyAnd { int.isUnsignedByte green }
    | bool.lazyAnd { int.isUnsignedByte blue }
  _ -> False

# Then:

is color := color %
  Black | Red | Green | Yellow | Blue | Magenta | Cyan | White | BrightBlack | BrightRed
  | BrightGreen
  | BrightYellow
  | BrightBlue
  | BrightMagenta
  | BrightCyan
  | BrightWhite
    )
    ->
    True
    TrueColor [red, green, blue]
    ->
    int.isUnsignedByte red | bool.lazyAnd { int.isUnsignedByte green }
    | bool.lazyAnd { int.isUnsignedByte blue } 
    _
    ->
    False

# Then:

is color := color %
  Black | Red | Green | Yellow | Blue | Magenta | Cyan | White | BrightBlack | BrightRed
  | BrightGreen
  | BrightYellow
  | BrightBlue
  | BrightMagenta
  | BrightCyan
  | BrightWhite
    )
    ->
    True
    TrueColor [red, green, blue]
    ->
    int.isUnsignedByte red | bool.lazyAnd { int.isUnsignedByte green }
    | bool.lazyAnd { int.isUnsignedByte blue }
    _
    ->
    False

Desired Output

is color := color %
  Black
  | Red
  | Green
  | Yellow
  | Blue
  | Magenta
  | Cyan
  | White
  | BrightBlack
  | BrightRed
  | BrightGreen
  | BrightYellow
  | BrightBlue
  | BrightMagenta
  | BrightCyan
  | BrightWhite -> True
  TrueColor [red, green, blue] ->
    int.isUnsignedByte red | bool.lazyAnd {int.isUnsignedByte green}
    | bool.lazyAnd {int.isUnsignedByte blue}
  _ -> False

Relevant Logs

No response

Additional Information

No response

@JonasWanke JonasWanke added T: Fix Type: Bug Fixes P: Compiler: Formatter Package: Candy's formatter labels Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P: Compiler: Formatter Package: Candy's formatter T: Fix Type: Bug Fixes
Projects
Status: No status
Development

No branches or pull requests

1 participant