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

Bug: Insert Missing Cases For Type Union #6549

Closed
nguyenyou opened this issue Jun 28, 2024 · 2 comments · Fixed by scala/scala3#21120
Closed

Bug: Insert Missing Cases For Type Union #6549

nguyenyou opened this issue Jun 28, 2024 · 2 comments · Fixed by scala/scala3#21120
Assignees
Labels
bug Something that is making a piece of functionality unusable code action Related to LSP code actions fixed-upstream Tag a ticket with this when a fix upstream has been completed and we can now address the ticket Scala 3 Generic ticket relating to Scala 3
Milestone

Comments

@nguyenyou
Copy link
Contributor

nguyenyou commented Jun 28, 2024

Describe the bug

I used pattern matching for a string literal type union and encountered a very interesting bug, the generated code by VSCode after I hit "insert missing cases" is:

type Color = "primary" | "secondary" | "danger" | "warning"

def getColor(color: Color) = color match
  case "primary" => "bg-red-200"
  case �[32m"secondary"�[0m => ???
  case �[32m"danger"�[0m => ???
  case �[32m"warning"�[0m => ???
Screen_Recording_2024-06-27_at_17.16.54.mov

cc @kasiaMarek

Expected behavior

No weird characters are generated along with the actually singleton string.

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

1.3.2+15-8bebd63c-SNAPSHOT

Extra context or search terms

No response

@nguyenyou nguyenyou changed the title Insert Missing Cases For Type Union Bug Bug: Insert Missing Cases For Type Union Jun 28, 2024
@tgodzik
Copy link
Contributor

tgodzik commented Jun 28, 2024

Thanks for reporting! That's actually coming from the compiler, tough I have no idea how this would show up as I think those are color codes? We can strip them in Metals, but we should check if it's actually coming in the actionable diagnostic in the compiler, which was added in https://github.com/scala/scala3/pull/18314/files

@tgodzik tgodzik added bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3 code action Related to LSP code actions labels Jun 28, 2024
@kasiaMarek kasiaMarek moved this from Triage to In progress in Metals Issue Board Jul 8, 2024
@kasiaMarek kasiaMarek self-assigned this Jul 9, 2024
@kasiaMarek kasiaMarek added the fixed-upstream Tag a ticket with this when a fix upstream has been completed and we can now address the ticket label Jul 11, 2024
@kasiaMarek
Copy link
Contributor

fixed upstream in: scala/scala3#21120

@github-project-automation github-project-automation bot moved this from In progress to Done in Metals Issue Board Jul 11, 2024
@kasiaMarek kasiaMarek added this to the Metals v1.3.4 milestone Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable code action Related to LSP code actions fixed-upstream Tag a ticket with this when a fix upstream has been completed and we can now address the ticket Scala 3 Generic ticket relating to Scala 3
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants