Skip to content

Quickfixes don't create path dependent types correctly #12943

Open
@coreywoodfield

Description

@coreywoodfield

Reproduction steps

Scala version: 2.13.12

In Test.scala

trait Trait
object Object {
  object Implementation extends Trait
}
trait Trait2 {
  def foo: Trait
}
class Test {
  object InsideClass extends Trait2 {
    val obj = Object
    override def foo = obj.Implementation
  }
}

Compile with scalac -quickfix:any -Xsource:3 Test.scala and it updates the file to

trait Trait
object Object {
  object Implementation extends Trait
}
trait Trait2 {
  def foo: Trait
}
class Test {
  object InsideClass extends Trait2 {
    val obj = Object
    override def foo: Test.InsideClass.obj.Implementation.type = obj.Implementation
  }
}

which isn't valid, since Test is a class.

Problem

Quickfix uses non-stable identifiers as stable identifiers

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions