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

Incorrect inferred method type argument in Scala 3 #4338

Open
kpodsiad opened this issue Sep 3, 2022 · 11 comments
Open

Incorrect inferred method type argument in Scala 3 #4338

kpodsiad opened this issue Sep 3, 2022 · 11 comments
Assignees
Labels
Scala 3 Generic ticket relating to Scala 3 semanticdb Related to semanticdb usage in Metals upstream-fix-needed Waiting on a fix upstream

Comments

@kpodsiad
Copy link
Member

kpodsiad commented Sep 3, 2022

Describe the bug

//> using scala "3.2.0"

//> using lib "org.typelevel::cats-core:2.8.0"

import cats.data.StateT
import cats.syntax.all._
import cats.implicits._
import cats.Id

object Cats extends App {
  type IdState[A] = StateT[Id, Int, A]

  val test: IdState[Unit] =
    StateT.modify(old => old)

  test.runS(1)

}

Screenshot 2022-09-03 at 07 43 01

Expected behavior

StateT.modify has correct inferred type [Id, Int]

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

0.11.8+72-6567f1a3-SNAPSHOT

Extra context or search terms

No response

@tgodzik
Copy link
Contributor

tgodzik commented Sep 3, 2022

Thanks for reporting, it seems in semanticdb we get:
[13:4..13:17) => *[<?>, Int]

Which means we need to fix it in the compiler.

@tgodzik tgodzik added Scala 3 Generic ticket relating to Scala 3 semanticdb Related to semanticdb usage in Metals upstream-fix-needed Waiting on a fix upstream labels Sep 3, 2022
@tanishiking
Copy link
Member

Probably related to #3935
I'll take a look 👀

@tanishiking
Copy link
Member

Looks like this is caused by the lack of HKTypeLambda support in SemanticDB for Scala3, maybe it's time to working on it 👍

@tanishiking
Copy link
Member

Realized synthetics for inferred type parameters have disappeared in 3.2.0 😢
scala/scala3#15877

@kpodsiad
Copy link
Member Author

What does that mean @tanishiking ?

@tanishiking
Copy link
Member

inferred type decoration for StateT.modify won't be available with the latest version of Scala.
(same applies to all the type apply like List(1.2.3) -> List[Int](1.2.3)).

Screen Shot 2022-09-13 at 15 46 10

It's regression, I'll take a look before working on lambda type support.

@kpodsiad
Copy link
Member Author

It was a big PR, no one can review 8k lines of code 😞 Thanks @tanishiking

@tgodzik
Copy link
Contributor

tgodzik commented Sep 13, 2022

Thanks for finding this @tanishiking ! I asked Martin about it in https://github.com/lampepfl/dotty/pull/15877/files#r969241924 It's not cool that it contained so visible regressions and yet it was just merged.

@tanishiking
Copy link
Member

Thanks, @tgodzik! Yeah, it (ignoring the regression test) shouldn't happen, but for this case, it might be easier to fix on top of the change made by Martin compared to revert it.

@tgodzik
Copy link
Contributor

tgodzik commented Sep 13, 2022

Thanks, @tgodzik! Yeah, it (ignoring the regression test) shouldn't happen, but for this case, it might be easier to fix on top of the change made by Martin compared to revert it.

Sure, I get that, but I think next time they should have us sign off on such changes.

@tanishiking
Copy link
Member

Submit a PR scala/scala3#16031 to fix the regression

@tanishiking tanishiking self-assigned this Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scala 3 Generic ticket relating to Scala 3 semanticdb Related to semanticdb usage in Metals upstream-fix-needed Waiting on a fix upstream
Projects
None yet
Development

No branches or pull requests

3 participants