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

[Semanticdb] Package object occurrence shown for toplevel given #11693

Closed
tgodzik opened this issue Mar 10, 2021 · 0 comments · Fixed by #12541
Closed

[Semanticdb] Package object occurrence shown for toplevel given #11693

tgodzik opened this issue Mar 10, 2021 · 0 comments · Fixed by #12541
Assignees
Milestone

Comments

@tgodzik
Copy link
Contributor

tgodzik commented Mar 10, 2021

Compiler version

3.0.0-RC1

Minimized code

package example

trait Ord[T]:
   def compare(x: T, y: T): Int

given intOrd: Ord[Int] with
   def compare(x: Int, y: Int) =
     if x < y then -1 else if x > y then +1 else 0

Output

package example

trait Ord/*example.Ord#*/[T/*example.Ord#[T]*/]:
   def compare/*example.Ord#compare().*/(x/*example.Ord#compare().(x)*/: T/*example.Ord#[T]*/, y/*example.Ord#compare().(y)*/: T/*example.Ord#[T]*/): Int/*scala.Int#*/

/*example.Ord$package.*/given intOrd/*example.Ord$package.intOrd.*/: Ord/*example.Ord#*/[Int/*scala.Int#*/] with
   def compare/*example.Ord$package.intOrd.compare().*/(x/*example.Ord$package.intOrd.compare().(x)*/: Int/*scala.Int#*/, y/*example.Ord$package.intOrd.compare().(y)*/: Int/*scala.Int#*/) =
     if x/*example.Ord$package.intOrd.compare().(x)*/ </*scala.Int#`<`(+3).*/ y/*example.Ord$package.intOrd.compare().(y)*/ then -1 else if x/*example.Ord$package.intOrd.compare().(x)*/ >/*scala.Int#`>`(+3).*/ y/*example.Ord$package.intOrd.compare().(y)*/ then +1/*scala.Int#`unary_+`().*/ else 0

It seems that example.Ord$package. does not exist in the code but it shown in occurrences nvertheless.

Expectation

package example

trait Ord/*example.Ord#*/[T/*example.Ord#[T]*/]:
   def compare/*example.Ord#compare().*/(x/*example.Ord#compare().(x)*/: T/*example.Ord#[T]*/, y/*example.Ord#compare().(y)*/: T/*example.Ord#[T]*/): Int/*scala.Int#*/

given intOrd/*example.Ord$package.intOrd.*/: Ord/*example.Ord#*/[Int/*scala.Int#*/] with
   def compare/*example.Ord$package.intOrd.compare().*/(x/*example.Ord$package.intOrd.compare().(x)*/: Int/*scala.Int#*/, y/*example.Ord$package.intOrd.compare().(y)*/: Int/*scala.Int#*/) =
     if x/*example.Ord$package.intOrd.compare().(x)*/ </*scala.Int#`<`(+3).*/ y/*example.Ord$package.intOrd.compare().(y)*/ then -1 else if x/*example.Ord$package.intOrd.compare().(x)*/ >/*scala.Int#`>`(+3).*/ y/*example.Ord$package.intOrd.compare().(y)*/ then +1/*scala.Int#`unary_+`().*/ else 0
tanishiking added a commit to tanishiking/scala3 that referenced this issue May 25, 2021
scala#11693
> scala3-compiler-bootstrapped/Test/runMain dotty.tools.dotc.semanticdb.updateExpect
tanishiking added a commit to tanishiking/scala3 that referenced this issue May 25, 2021
scala#11693
> scala3-compiler-bootstrapped/Test/runMain dotty.tools.dotc.semanticdb.updateExpect
@bishabosha bishabosha self-assigned this May 25, 2021
bishabosha added a commit to dotty-staging/dotty that referenced this issue Jun 1, 2021
fixes scala#11693, remove top level definition
wrapper objects appearing as a definition
occurrence in semanticdb, still record
them as a symbol
bishabosha added a commit to dotty-staging/dotty that referenced this issue Jun 1, 2021
set the Synthetic flag on
top level wrapper objects.

fixes scala#11693, top level definition
wrapper objects no longer appear
as a definition occurrence in semanticdb,
but are still recorded as a symbol
@Kordyjan Kordyjan added this to the 3.0.2 milestone Aug 2, 2023
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