Skip to content

Missing type upper bound for Tuple.Fold #13813

Open
@nicolasstucki

Description

@nicolasstucki

Compiler version

3.1.0

Code

The current definition for Tuple.Fold is

  type Fold[Tup <: Tuple, Z, F[_, _]] = ...

It should know that the result will be a subtype of Z or F. It looks like we should be able to add this bound but it does not work.

  type Fold[Tup <: Tuple, Z, F[_, _]] <: (Z | F[_, _]) = ...

Failing example

type Reverse[X <: Tuple] <: Tuple = Fold[X, EmptyTuple, [A <: Tuple, Y] =>> Y *: A]
// [error]                        ^
// [error]                        cannot combine bound and alias

Expectation

Should be able to add these kinds of bounds

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions