-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Test.scala:
def Test =
summon[deriving.Mirror.SumOf[Foo]]
Wrapper.scala:
sealed trait Foo
case class Bar(x: Int) extends Foo
Compile together while specifying Test.scala
first in the compiler command: dotty-bootstrapped/dotc -d out Test.scala Wrapper.scala
.
Output:
-- Error: /Users/kmetiuk/Projects/scala3/playground/upickle-pg/Test.scala:2:36 -
2 | summon[deriving.Mirror.SumOf[Foo]]
| ^
|no implicit argument of type deriving.Mirror.SumOf[Foo] was found for parameter x of method summon in object DottyPredef
-- Error: /Users/kmetiuk/Projects/scala3/playground/upickle-pg/Wrapper.scala:2:11
2 |case class Bar(x: Int) extends Foo
| ^
|children of trait Foo were already queried before class Bar was discovered.
|As a remedy, you could move class Bar on the same nesting level as trait Foo.
2 errors found
If you flip the order of the files in the command (dotty-bootstrapped/dotc -d out Wrapper.scala Test.scala
) or compile them as a single file:
sealed trait Foo
case class Bar(x: Int) extends Foo
def Test =
summon[deriving.Mirror.SumOf[Foo]]
The compilation succeeds.
You can reproduce the issue with Dotty Issues Workspace using the following launch.iss
script:
launch.iss
$ (rm -rv out || true) && mkdir out # Cleanup
dotty-bootstrapped/dotc -d out
$here/Test.scala $here/Wrapper.scala
/cc @milessabin