Skip to content

Indirectly extending a trait with parameters works (unexpectedly) #11214

Closed
@alvinj

Description

@alvinj

Compiler version

Scala 3.0-M3

Minimized code

In a Gitter discussion that starts here, I noted that in following this documentation page I created this example, which works as desired:

trait Pet(val name: String)
trait FeatheredPet extends Pet

// the docs say to do this
class Bird(override val name: String) extends Pet(name), FeatheredPet:
   override def toString = s"bird name: $name"

Then out of curiosity I also tried this, and saw that it works as well:

// this also works
class Bird(override val name: String) extends FeatheredPet:
   override def toString = s"bird name: $name"

On Gitter, @smarter noted that this second behavior might be an issue, so I’m reporting it here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions