Skip to content

Renaming a type in the base trait does not rename it in the child traits #7251

@tmiseikis

Description

@tmiseikis

Describe the bug

Given the following Scala code:

sealed trait TA:
    type SomeType

trait TB extends TA:
    override type SomeType = Nothing

trait TC extends TA:
    override type SomeType = String

If I try to rename the SomeType in the base trait TA to AnotherType I get the following:

sealed trait TA:
    type AnotherType

trait TB extends TA:
    override type SomeType = Nothing

trait TC extends TA:
    override type SomeType = String

Note that the types in TB and TC are not renamed.

Funnily enough, if I rename that type in the TB trait then the type in the base trait is also renamed (but not in the TC trait):

sealed trait TA:
    type AnotherType

trait TB extends TA:
    override type AnotherType = Nothing

trait TC extends TA:
    override type SomeType = String

Expected behavior

I would expected to get the following if I rename the SomeType in the base trait TA to AnotherType:

sealed trait TA:
    type AnotherType

trait TB extends TA:
    override type AnotherType = Nothing

trait TC extends TA:
    override type AnotherType = String

Operating system

macOS

Editor/Extension

Nvim (nvim-metals)

Version of Metals

v1.5.1

Extra context or search terms

No response

Metadata

Metadata

Assignees

Labels

bugSomething that is making a piece of functionality unusable

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions