akisaarinen/rillit

Example fails with “value applyDynamic is not a member of rillit.InitializedLenser”

ayosec opened this issue · 6 comments

I tried to compile the example in the repository, but it fails.

Here is the full output:

$ sbt
[info] Loading project definition from /home/ayosec/lensers/rillit/project
[info] Set current project to rillit (in build file:/home/ayosec/lensers/rillit/)
> example/compile
[info] Compiling 1 Scala source to /home/ayosec/lensers/rillit/example/target/scala-2.10/classes...
[error] /home/ayosec/lensers/rillit/example/src/main/scala/example/TestLens.scala:19: value applyDynamic is not a member of rillit.InitializedLenser[example.Main.Person,example.Main.Email]
[error] error after rewriting to lens.<applyDynamic: error>("get")
[error] possible cause: maybe a wrong Dynamic method signature?
[error]     println("  Email: %s".format(lens.get(person))) // 'aki@akisaarinen.fi'
[error]                                  ^
[error] /home/ayosec/lensers/rillit/example/src/main/scala/example/TestLens.scala:26: value applyDynamic is not a member of rillit.InitializedLenser[example.Main.Person,example.Main.Email]
[error] error after rewriting to {
[error]   final class $anon extends AnyRef with rillit.InitializedLenser[example.Main.Person,example.Main.Email] {
[error]     def <init>(): anonymous class $anon = {
[error]       $anon.super.<init>();
[error]       ()
[error]     };
[error]     def apply: rillit.Lens[example.Main.Person,example.Main.Email] = {
[error]   final class $anon extends Object with rillit.Lens[example.Main.Contact,example.Main.Email] {
[error]     def <init>(): anonymous class $anon = {
[error]       $anon.super.<init>();
[error]       ()
[error]     };
[error]     def get(x$: example.Main.Contact): example.Main.Email = x$.email;
[error]     def set(x$: example.Main.Contact, v$: example.Main.Email): example.Main.Contact = x$.copy(v$, x$.copy$default$2)
[error]   };
[error]   new $anon()
[error] }.compose[example.Main.Person]({
[error]   final class $anon extends Object with rillit.InitializedLenser[example.Main.Person,example.Main.Contact] {
[error]     def <init>(): anonymous class $anon = {
[error]       $anon.super.<init>();
[error]       ()
[error]     };
[error]     def apply: rillit.Lens[example.Main.Person,example.Main.Contact] = {
[error]       final class $anon extends Object with rillit.Lens[example.Main.Person,example.Main.Contact] {
[error]         def <init>(): anonymous class $anon = {
[error]           $anon.super.<init>();
[error]           ()
[error]         };
[error]         def get(x$: example.Main.Person): example.Main.Contact = x$.contact;
[error]         def set(x$: example.Main.Person, v$: example.Main.Contact): example.Main.Person = {
[error]           val x$3: example.Main.Contact = v$;
[error]           val x$4: example.Main.Name = x$.copy$default$1;
[error]           x$.copy(x$4, x$3)
[error]         }
[error]       };
[error]       new $anon()
[error]     }
[error]   };
[error]   new $anon()
[error] }.apply())
[error]   };
[error]   new $anon()
[error] }.<applyDynamic: error>("set")
[error] possible cause: maybe a wrong Dynamic method signature?
[error]     val updated = Lenser[Person].contact.email.set(person, Email("foo", "foobar.com"))
[error]                         ^
[error] /home/ayosec/lensers/rillit/example/src/main/scala/example/TestLens.scala:41: value applyDynamic is not a member of rillit.InitializedLenser[example.Main.Person,example.Main.Email]
[error] error after rewriting to email.<applyDynamic: error>("andThen")
[error] possible cause: maybe a wrong Dynamic method signature?
[error]     val lens = email andThen user
[error]                ^
[error] three errors found
[error] (example/compile:compile) Compilation failed
[error] Total time: 3 s, completed 10-dic-2012 19:43:43
> 

Oops, seems I have broken master while doing cleanups. I'll try to fix this asap.

The first commit which can compile the example is eda1c83

Found the issue, it was an old classic... I had forgotten to add the file with implicit def to git tree.

Master should now compile, thank you! Let me know if you still encounter any other issues.

Thanks you! It's working.

I'm testing it with sbt publish-local. I guess that the current package isn't uploaded anywhere.

It's not uploaded, I guess I should setup a maven repository. Thinking of it, maybe I'll just do it now... :-)

@ayosec I published the current version as 0.1.0, if you want, you can use it like this (added to README as well):

resolvers += "rillit-repository" at "http://akisaarinen.github.com/rillit/maven"

libraryDependencies += "fi.akisaarinen" %% "rillit" % "0.1.0"