Skip to content

Under CC, subtyping between a type variable and its impure upper bound is rejected #19076

Open
@Linyxus

Description

@Linyxus

Compiler version

main

Minimized code

import language.experimental.captureChecking
trait IO

def foo[X <: IO^](x: X): IO^ = x

Output

-- [E007] Type Mismatch Error: issues/cc-typeapp.scala:4:31 ------------------------------------------------------------------------------------------------------------------------------------------------------------
4 |def foo[X <: IO^](x: X): IO^ = x
  |                               ^
  |                               Found:    (x : X)
  |                               Required: IO^
  |
  | longer explanation available when compiling with `-explain`

Expectation

It should work.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions