Skip to content

Commit

Permalink
Merge pull request #9742 from joroKr21/t8493
Browse files Browse the repository at this point in the history
Fix scala/bug#8493 - add regression test
  • Loading branch information
NthPortal committed Aug 28, 2021
2 parents 072e68e + 98cdb38 commit 351482a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/files/pos/t8493.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
object Test {
trait Foo {
def foo: this.type
}

case class Impl() extends Foo {
def foo = ???
def bar: Unit = ()
}

object Foo {
def foo(f: Foo): f.type = f.foo
}

def work(f: Impl): Unit =
Foo.foo(f).bar

def bug(f: Int => Impl): Unit =
Foo.foo(f(1)).bar

def workaround(f: Int => Impl): Unit = {
val tmp = f(1)
Foo.foo(tmp).bar
}
}

0 comments on commit 351482a

Please sign in to comment.