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

Metals doesn't recognize all the new syntax under the experimental:modularity flag #6800

Open
felher opened this issue Sep 26, 2024 · 4 comments
Labels
bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3

Comments

@felher
Copy link

felher commented Sep 26, 2024

Describe the bug

Given the following small file:

trait TypeClass:
  type Self

given Int is TypeClass

def foo[T: {Ordering, TypeClass}]: Unit = ()

Metals reports

abstract givens cannot be anonymous

for the given Int is TypeClass line and reports

illegal start of declaration

for the def foo line, even though

    scalacOptions ++= Seq(
      "-source:future",
      "-language:experimental.modularity",
    )

are set in build.sbt. It compiles and runs fine in SBT.

Expected behavior

It should not show any errors

Operating system

Linux

Editor/Extension

Nvim (nvim-metals)

Version of Metals

v1.3.5

Extra context or search terms

No response

@tgodzik
Copy link
Contributor

tgodzik commented Sep 26, 2024

Thanks for reporting! I looked at https://dotty.epfl.ch/docs/reference/experimental/modularity.html and it seems that it only adds the tracked modifier. Do you have link to the syntax that results in given Int is TypeClass ?

@antonsviridov-src
Copy link

@tgodzik I think modularity + source:future give you https://dotty.epfl.ch/docs/reference/experimental/typeclasses.html

@felher
Copy link
Author

felher commented Sep 27, 2024

Yeah, that's right. Both the modularity and the typeclass features are hidden behind the modularity flag. Sorry for the confusion. As @antonsviridov-src said, it is specified in the "Better Support for Type Classes" document he linked

@tgodzik
Copy link
Contributor

tgodzik commented Sep 27, 2024

Ach, thanks! I will take a look once I am back from holidays circa 07.10

@tgodzik tgodzik added bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3 labels Sep 27, 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 Scala 3 Generic ticket relating to Scala 3
Projects
Status: Triage
Development

No branches or pull requests

3 participants