@@ -537,6 +537,77 @@ class AnnotationDrivenAsync {
537537 """ )
538538 }
539539
540+ @ Test def testRewrittenApply (): Unit = {
541+ val result = run(
542+ """
543+ |import scala.tools.nsc.async.{autoawait, customAsync}
544+ |object O {
545+ | case class Foo(a: Any)
546+ |}
547+ |object Test {
548+ | @autoawait def id(a: String) = a
549+ | @customAsync
550+ | def test = {
551+ | O.Foo
552+ | id("foo") + id("bar")
553+ | O.Foo(1)
554+ | }
555+ |}
556+ | """ .stripMargin)
557+ assertEquals(" Foo(1)" , result.toString)
558+ }
559+
560+ @ Test def testIsInstanceOfType (): Unit = {
561+ val result = run(
562+ """ import scala.tools.nsc.async.{autoawait, customAsync}
563+ |
564+ | class Outer
565+ | object Test {
566+ | @autoawait def id(a: String) = a
567+ | @customAsync def test = {
568+ | val o = new Outer
569+ | id("foo") + id("bar")
570+ | ("": Object).isInstanceOf[o.type]
571+ | }
572+ | }
573+ | """ .stripMargin)
574+ assertEquals(false , result)
575+ }
576+
577+ @ Test def testIsInstanceOfTerm (): Unit = {
578+ val result = run(
579+ """ import scala.tools.nsc.async.{autoawait, customAsync}
580+ |
581+ | class Outer
582+ | object Test {
583+ | @autoawait def id(a: String) = a
584+ | @customAsync def test = {
585+ | val o = new Outer
586+ | id("foo") + id("bar")
587+ | o.isInstanceOf[Outer]
588+ | }
589+ | }
590+ | """ .stripMargin)
591+ assertEquals(true , result)
592+ }
593+
594+ @ Test def testArrayLocalModule (): Unit = {
595+ val result = run(
596+ """ import scala.tools.nsc.async.{autoawait, customAsync}
597+ |
598+ | class Outer
599+ | object Test {
600+ | @autoawait def id(a: String) = a
601+ | @customAsync def test = {
602+ | val O = ""
603+ | id("foo") + id("bar")
604+ | new Array[O.type](0)
605+ | }
606+ | }
607+ | """ .stripMargin)
608+ assertEquals(classOf [Array [String ]], result.getClass)
609+ }
610+
540611 // Handy to debug the compiler or to collect code coverage statistics in IntelliJ.
541612 @ Test
542613 @ Ignore
0 commit comments