Skip to content

Overriding a method with a inline method is inconstant #4892

Closed
@nicolasstucki

Description

@nicolasstucki
class Foo extends Bar {
  inline override def bar: Int = 2
}

class Bar {
  def bar: Int = 1
}

object Test {
  def main(args: Array[String]): Unit = {
    val a: Foo = new Foo
    val b: Bar = new Foo
    println(a.bar) // prints 2
    println(b.bar) // prints 1 but should print 2
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions