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

Fix printed inferred type for complex types #2449

Merged
merged 1 commit into from Feb 2, 2021

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Jan 29, 2021

While browsing Metals with the new feature I came upon some issues in non-obvious cases. I try to fix them all here:

  • existential types are not that useful to show in the type decorations, so I changed to show the base type only. It happens in a situation like:
   val job = ec.submit(new Runnable {
      override def run(): Unit = {
        launcher.runLauncher(
          bloopVersion,
          skipBspConnection = false,
          Nil
        )
        finished.success(())
      }
    })

aside from existential type in the above example we also had an issue with a locally defined type. Instead of local123 we now just print _, which is also returned by normal hover.

  • structural types now show with ... only if there is something contained in them
  • with types like new A with B {} no longer show AnyRef as first type

Copy link
Member

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the small comment (which is up to you) LGTM!

While browsing Metals with the new feature I came upon some issues in non-obvious cases. I try to fix them all here:

- existential types are not that useful to show in the type decorations, so I changed to show the base type only. It happens in a situation like:
```scala
   val job = ec.submit(new Runnable {
      override def run(): Unit = {
        launcher.runLauncher(
          bloopVersion,
          skipBspConnection = false,
          Nil
        )
        finished.success(())
      }
    })
```
aside from existential type in the above example we also had an issue with a locally defined type. Instead of `local123` we now just print `_`, which is also returned by normal hover.

- structural types now show with `...` only if there is something contained in them
- with types like `new A with B {}` no longer show `AnyRef` as first type
@tgodzik tgodzik merged commit bcf1723 into scalameta:main Feb 2, 2021
@tgodzik tgodzik deleted the fixe-types branch February 2, 2021 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants