Skip to content

PPrint derivation fails with nested class definitions #47

@alexarchambault

Description

@alexarchambault

REPL session with Ammonite 0.2.7:

@ object ODef { case class Foo(i: Int, s: String) }
defined object ODef
@ ODef.Foo(2, "ba") // Nested in object, succeeds
res1: cmd0.ODef.Foo = Foo(2, "ba")

@ class CDef { case class Foo(i: Int, s: String) }
defined class CDef
@ object CDef extends CDef
defined object CDef
@ CDef.Foo(2, "ba") // Nested in class implemented by object, fails
Compilation Failed
Main.scala:26: could not find implicit value for evidence parameter of type ammonite.pprint.PPrint[cmd3.CDef.Foo]
          def $main() = {Iterator(ReplBridge.shell.shellPPrint(res4, "res4")) ++ Iterator(" = ") ++ ammonite.pprint.PPrint(res4)}
                                                                                                                          ^

This can be reproduced out of the Ammonite REPL, see https://gist.github.com/alexarchambault/90f79a160eca9a9e6932.

Note that contrary to Ammonite macros, shapeless Generic succeeds in these two cases (in the gist too).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions