Skip to content

Commit f77206f

Browse files
committed
1 parent f316260 commit f77206f

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

test/junit/scala/tools/nsc/async/AnnotationDrivenAsync.scala

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,57 @@ class AnnotationDrivenAsync {
486486
}
487487
}
488488

489+
@Test def testByNameOwner(): Unit = {
490+
val result = run(
491+
"""
492+
import scala.tools.nsc.async.{autoawait, customAsync}
493+
494+
object Bleh {
495+
@autoawait def asyncCall(): Int = 0
496+
def byName[T](fn: => T): T = fn
497+
}
498+
object Boffo {
499+
@autoawait @customAsync def jerk(): Unit = {
500+
val pointlessSymbolOwner = 1 match {
501+
case _ =>
502+
Bleh.asyncCall()
503+
Bleh.byName {
504+
val whyDoHateMe = 1
505+
whyDoHateMe
506+
}
507+
}
508+
}
509+
}
510+
object Test {
511+
@customAsync def test() = Boffo.jerk()
512+
}
513+
""")
514+
}
515+
516+
@Test def testByNameOwner2(): Unit = {
517+
val result = run(
518+
"""
519+
import scala.tools.nsc.async.{autoawait, customAsync}
520+
object Bleh {
521+
@autoawait def bleh = Bleh
522+
def byName[T](fn: => T): T = fn
523+
}
524+
object Boffo {
525+
@autoawait @customAsync def slob(): Unit = {
526+
val pointlessSymbolOwner = {
527+
Bleh.bleh.byName {
528+
val whyDoHateMeToo = 1
529+
whyDoHateMeToo
530+
}
531+
}
532+
}
533+
}
534+
object Test {
535+
@customAsync def test() = Boffo.slob()
536+
}
537+
""")
538+
}
539+
489540
// Handy to debug the compiler or to collect code coverage statistics in IntelliJ.
490541
@Test
491542
@Ignore

0 commit comments

Comments
 (0)