Skip to content

Investigate use of super-accessors in traits in the standard library #11420

Closed
@smarter

Description

@smarter

A super.foo call in a trait will require a super-accessor in every class that implements the trait since the super will be resolved based on the linearization order of the class. In most cases this is probably not what you want, e.g. in https://github.com/scala/scala/blob/d6455592055ce1729ab7ac11d69da3a5a5f3d9dc/src/library/scala/collection/Seq.scala#L187
I suspect what you really meant was:

super[IterableOps].concat(suffix)

Besides possible unwanted semantics and performance impact, super-accessors are also problematic because they cannot always be implemented (this is now detected as of scala/scala3#5604 / scala/scala3#5604), so I think it's worht reviewing their use before RC1 ships since adding or removing super-accesors is binary-incompatible.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions