Skip to content

Incorrect documentation on general type projections #2591

@smarter

Description

@smarter

https://github.com/lampepfl/dotty/blob/master/docs/docs/reference/dropped/type-projection.md says:

Dotty allows this only if T is a class type.

Which is incorrect, T can be a type alias too, it just cannot be an abstract type. It then says:

It also rules out the previous encodings of type lambdas using structural types with projection as application

But the type lambda encoding is fine as long as you use type aliases, not abstract types, this works in dotty:

scala> class Foo[M[_]] 
defined class Foo
scala> val x: Foo[({type L[X] = List[X]})#L] = null 
val x: Foo[[X] => scala.collection.immutable.List[X]] = null

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions