@@ -443,6 +443,56 @@ class LateExpansion {
443
443
""" )
444
444
}
445
445
446
+ @ Test def testByNameOwner (): Unit = {
447
+ val result = run(
448
+ """
449
+ import scala.async.run.late.{autoawait,lateasync}
450
+ object Bleh {
451
+ @autoawait @lateasync def asyncCall(): Int = 0
452
+ def byName[T](fn: => T): T = fn
453
+ }
454
+ object Boffo {
455
+ @autoawait @lateasync def jerk(): Unit = {
456
+ val pointlessSymbolOwner = 1 match {
457
+ case _ =>
458
+ Bleh.asyncCall()
459
+ Bleh.byName {
460
+ val whyDoHateMe = 1
461
+ whyDoHateMe
462
+ }
463
+ }
464
+ }
465
+ }
466
+ object Test {
467
+ @lateasync def test() = Boffo.jerk()
468
+ }
469
+ """ )
470
+ }
471
+
472
+ @ Test def testByNameOwner2 (): Unit = {
473
+ val result = run(
474
+ """
475
+ import scala.async.run.late.{autoawait,lateasync}
476
+ object Bleh {
477
+ @autoawait @lateasync def bleh = Bleh
478
+ def byName[T](fn: => T): T = fn
479
+ }
480
+ object Boffo {
481
+ @autoawait @lateasync def slob(): Unit = {
482
+ val pointlessSymbolOwner = {
483
+ Bleh.bleh.byName {
484
+ val whyDoHateMeToo = 1
485
+ whyDoHateMeToo
486
+ }
487
+ }
488
+ }
489
+ }
490
+ object Test {
491
+ @lateasync def test() = Boffo.slob()
492
+ }
493
+ """ )
494
+ }
495
+
446
496
private def createTempDir (): File = {
447
497
val f = File .createTempFile(" output" , " " )
448
498
f.delete()
@@ -455,9 +505,9 @@ class LateExpansion {
455
505
try {
456
506
val reporter = new StoreReporter
457
507
val settings = new Settings (println(_))
458
- // settings.processArgumentString("-Xprint:refchecks,patmat,postpatmat,jvm -nowarn")
459
508
settings.outdir.value = out.getAbsolutePath
460
509
settings.embeddedDefaults(getClass.getClassLoader)
510
+ // settings.processArgumentString("-Xprint:patmat,postpatmat,jvm -nowarn")
461
511
val isInSBT = ! settings.classpath.isSetByUser
462
512
if (isInSBT) settings.usejavacp.value = true
463
513
val global = new Global (settings, reporter) {
0 commit comments