Skip to content

Polymorphic function type subtyping is restricted to quantifiers with equal bounds #21311

Open
@EugeneFlesselle

Description

@EugeneFlesselle

Compiler version

3.6.0-RC1

Minimized example

val f: [A <: Int] => A => Int =
  [A <: Any] => (a: A) => 0

Output

-- [E007] Type Mismatch Error: tests/playground/example.scala:3:2 --------------
3 |  [A <: Any] => (a: A) => 0
  |  ^^^^^^^^^^^^^^^^^^^^^^^^^
  |  Found:    [A] => (a: A) => Int
  |  Required: [A <: Int] => (x$1: A) => Int

Expectation

Screenshot 2024-08-01 at 13 35 30

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions