Skip to content

New warning with 2.13.17: a type was inferred to be kind-polymorphic Nothing to conform to F[_] #13128

@durban

Description

@durban

Reproduction steps

Scala version: 2.13.17

package com.example

trait Thing[F[_]]

object Repro {
  def foo[F[_]](i: Int)(implicit F: Thing[F]): F[Unit] = ???
  def bar[F[_] : Thing](i: Int): F[Unit] = foo(i) // <- warning here
}
[warn] .../Repro.scala:...:44: a type was inferred to be kind-polymorphic `Nothing` to conform to `F[_]`
[warn] Applicable -Wconf / @nowarn filters for this warning: msg=<part of the message>, cat=lint-infer-any, site=com.example.Repro.bar
[warn]   def bar[F[_] : Thing](i: Int): F[Unit] = foo(i)
[warn]                                            ^

Problem

I don't see a reason for this warning, but in case there is a good reason, I would definitely like to understand it.

Note: if I do foo[F](i) instead of foo(i), the warning disappears.

Note, that this is probably the same warning as reported here: https://contributors.scala-lang.org/t/scala-2-13-17-release-planning/6994/20

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions