Skip to content

LinearSeq#head and LinearSeq#tail aren't abstract #11697

@argv-minus-one

Description

@argv-minus-one

The LinearSeq#isEmpty, LinearSeq#head, and LinearSeq#tail methods should be abstract, so that it is obvious (and verified at compile time) that these methods must be implemented in order to have a working LinearSeq. Currently, they are not, and new LinearSeq[SomeType] {} is permitted at compile time but causes a stack overflow at run time.

Also, the LinearSeq documentation no longer says that these methods must be implemented. In 2.12 and earlier, this was in the documentation for LinearSeqOptimized, but it doesn't seem to have been brought over.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions