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

Too many occurences for symbol which extends class and pass constructor arguments #2882

Open
kpodsiad opened this issue Sep 22, 2022 · 2 comments

Comments

@kpodsiad
Copy link
Member

related to the scalameta/metals#4423

//> using scala "2.13.8"

object Main extends App {
  case class FooFailure(msg: String) 
    extends Exception(s"Error: $msg")
}

Using Metals: show semanticDB detailed one can see that there are two occurrences which match FooFailure:
[3:13..3:23) <= empty/Main.FooFailure#
[4:32..4:35) => empty/Main.FooFailure# - this matches exactly msg in s"Error: $msg"

It seems like it's an issue with class that extends java one(?). I've tried extending abstract class and everything was working.

@kpodsiad
Copy link
Member Author

Now I've spotted <= and => but I have no idea what does it mean.

@tgodzik
Copy link
Collaborator

tgodzik commented Sep 23, 2022

Actually, one is a reference and the other a definition. Looks like somehow this only happens in a string interpolation. Looks like msg should be a reference to the constructor param in FooFailure, but is instead the object.

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

No branches or pull requests

2 participants