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

Type in classOf[T] is not added to occurrences in semanticDB #1909

Open
tgodzik opened this issue Nov 12, 2019 · 3 comments · Fixed by #2457
Open

Type in classOf[T] is not added to occurrences in semanticDB #1909

tgodzik opened this issue Nov 12, 2019 · 3 comments · Fixed by #2457

Comments

@tgodzik
Copy link
Collaborator

tgodzik commented Nov 12, 2019

object Main{
  val a = classOf[Int]
}

In the example Int symbol will not be added to occurrences. @sswistun-vl is taking a look at it.

@tgodzik tgodzik self-assigned this Nov 12, 2019
@tgodzik
Copy link
Collaborator Author

tgodzik commented Nov 12, 2019

Should we also add the occurence for classOf ? @olafurpg what do you think?

@tgodzik tgodzik changed the title Type in classOf[T] is not added to accurences Type in classOf[T] is not added to occurrences Nov 12, 2019
@tgodzik tgodzik changed the title Type in classOf[T] is not added to occurrences Type in classOf[T] is not added to occurrences in semanticDB Nov 12, 2019
@olafurpg
Copy link
Member

I think we should add occurrences to classOf

@tanishiking
Copy link
Member

I looked into this a bit, and I found that we have the following trees for classOf[...].

classOf[Int]

Literal(
  value = Constant(
    value = TypeRef(pre = ThisType(sym = package scala), sym = class Int, args = List())
  )
)
classOf[List[Int]]

Literal(
  value = Constant(
    value = TypeRef(
      pre = SingleType(
        pre = SingleType(pre = ThisType(sym = package <root>), sym = package scala),
        sym = package object scala
      ),
      sym = type List,
      args = List(TypeRef(pre = ThisType(sym = package scala), sym = class Int, args = List()))
    )
  )
)

This is because

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

Successfully merging a pull request may close this issue.

3 participants