scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
230 stars 21 forks source link

`-quickfix` puts annotation before method parameter list #12864

Closed mrdziuban closed 9 months ago

mrdziuban commented 9 months ago

Reproduction steps

Scala version: 2.13.12

With -Xsource:3 and -quickfix:any, this code is rewritten:

sealed trait Foo

trait HasFoo[A] {
  def getFoo(a: A): Foo
}

object HasFoo {
  implicit def fromFoo[F <: Foo]: HasFoo[F] =
    new HasFoo[F] {
      def getFoo(f: F) = f
    }
}

to this:

sealed trait Foo

trait HasFoo[A] {
  def getFoo(a: A): Foo
}

object HasFoo {
  implicit def fromFoo[F <: Foo]: HasFoo[F] =
    new HasFoo[F] {
      def getFoo: F(f: F) = f
    }
}

Problem

Note that def getFoo in the fromFoo instance has its return type annotated before its parameter list

mrdziuban commented 9 months ago

Whoops, just noticed this is a duplicate of #12860, closing in favor of that