twitter / rsc

Experimental Scala compiler focused on compilation speed
Apache License 2.0
1.24k stars 54 forks source link

Don't ascribe type refinements in case of overrides with different modifier #474

Open wiwa opened 5 years ago

wiwa commented 5 years ago

Given:

  trait AC {
    def foo: Int
  }
  def ac = new AC {
    override val foo: Int = 0
  }

Obtained:

  def ac: AC { val foo: Int } = new AC {
    override val foo: Int = 0
  }

Expected:

  def ac: AC = new AC {
    override val foo: Int = 0
  }

This happens when overriding a def with val. Should figure out how this works in the context of lazy vals as well.