https://kotlinlang.org logo
a

amanda.hinchman-dominguez

10/30/2019, 6:58 PM
Now, I did remember to include the imports for the test, and I included the annotations and core data dependencies within the configs!
r

Rachel

10/30/2019, 7:09 PM
Hi Amanda, the reason of the first error `.../sources/Example.kt: (2, 19): Unresolved reference: extensions`:
arrow.core.extensions
are provided by arrow-meta artifact which is not being included in the configuration
a

amanda.hinchman-dominguez

10/30/2019, 7:10 PM
the arrow-meta artifact?
r

Rachel

10/30/2019, 7:11 PM
this directory comes from arrow repository:
./modules/meta/arrow-meta/src/main/java/arrow/core/extensions/
a

amanda.hinchman-dominguez

10/30/2019, 7:16 PM
how would I include that module as an artifact?
r

Rachel

10/31/2019, 12:25 AM
I think it's not necessary for the example, just importing arrow.extension
Please, @amanda.hinchman-dominguez, upload your branch to check this code and help you, thanks!!
a

amanda.hinchman-dominguez

10/31/2019, 12:27 AM
Hi @Rachel - it's up in the arrow-meta project as a WIP branch. Feel free to take a look!
r

Rachel

10/31/2019, 12:29 AM
Thanks Amanda! I think it's not the same example:
Copy code
@Test
  fun `simple_case_function`() {
    assertThis(CompilerTest(
      config = {
        listOf(addCompilerPlugins(ComprehensionsTest.compilerPlugin))
      },
      code = {
        """
        | object Id
        | 
        | @extension
        | fun IdEq() : Eq<Id> = Id.eq().run {
        |   Id.eqv(Id)
        | }
        | val x = Id == Id
        | 
        """.source
      },
      assert = {
        compiles
      }
    ))
    assert(true)
  }
a

amanda.hinchman-dominguez

10/31/2019, 12:29 AM
Oh! Maybe I forgot to update
r

Rachel

10/31/2019, 12:29 AM
Maybe I'm not looking at the right place
a

amanda.hinchman-dominguez

10/31/2019, 12:29 AM
I'm almost home, I will check in a little bit
No I think you are! It's me haha
Did you see the code I pasted at least?
r

Rachel

10/31/2019, 12:30 AM
haha no hurry, when you have time!
a

amanda.hinchman-dominguez

10/31/2019, 1:36 AM
@Rachel I got the update up! I just forgot to commit and push 😅
👍 1
r

Rachel

10/31/2019, 12:47 PM
Amanda, hi! I have some things for you:
1. The example would have this content:
Copy code
val compilerPlugin = CompilerPlugin("Arrow Meta", listOf(Dependency("compiler-plugin")))
    val arrowAnnotations = Dependency("arrow-annotations:0.10.3-SNAPSHOT")

    assertThis(CompilerTest(
      config = {
        addCompilerPlugins(compilerPlugin) + addDependencies(arrowAnnotations)
      },
      code = {
        """
        | import arrow.extension
        | 
        | object Id
        |
        | @extension
        | fun IdEq() : Eq<Id> = Id.eq().run {
        |   Id.eqv(Id)
        | }
        | val x = Id == Id
        | 
        """.source
      },
      assert = {
        compiles
      }
    ))
2. I think it would be necessary to take a look at one existing test previous your changes, because it's failing now: the test for TypeClassesPlugin
3. We're going to fix arrow-annotations in order not to get the error with extension annotation
Oh, and if your branch is rebased with
master
, you'll get a way to avoid "0.10.3-SNAPSHOT" or any other specific version
a

amanda.hinchman-dominguez

10/31/2019, 2:27 PM
I'll be sure to update, thank you @Rachel!
I'll take a look at the first comments a little closer haha
How do we know which snapshots we should be using?
r

Rachel

10/31/2019, 3:50 PM
The one which is in the main
gradle.properties
💯 1
a

amanda.hinchman-dominguez

10/31/2019, 3:50 PM
Thanks!
did the updates to the master make your builds feel a lot slower?
I'm still waiting on my tests
r

Rachel

10/31/2019, 3:56 PM
Maybe, it's growing a lot in the last few days
a

amanda.hinchman-dominguez

10/31/2019, 4:00 PM
interesting, yeah it got really noticable for me today!
It's not a big deal yet
@Rachel kind of going off what I've learned so far, does it made sense to import
arrow
as a dependency so that my tests may recognize
Eq
and so on?
r

Rachel

10/31/2019, 4:15 PM
I'm going to explain what I was doing to answer your question
I think it will be useful for you
Now you're looking for
Eq
So I was looking for
Eq
in Arrow
I found:
./modules/core/arrow-core-data/src/main/kotlin/arrow/typeclasses/Eq.kt
So the dependency will be
arrow-core-data
and the import
arrow.typeclasses.Eq
a

amanda.hinchman-dominguez

10/31/2019, 6:21 PM
oh weird, I had that in there. So I had the import wrong then?
Thank you for providing clarification!
r

Rachel

10/31/2019, 6:36 PM
Oh, right, you had
arrow-core-data
before, sorry. The problem was the import:
import arrow.core.extensions.*
I think it could be a good idea to solve every error step by step
a

amanda.hinchman-dominguez

10/31/2019, 6:39 PM
Oh my gosh thank you so much. All this has been so helpful. I'm still waiting on the build but pushed up the changes - but I've added documentation from what I've learned - does it all seem correct? https://github.com/arrow-kt/arrow-meta/blob/a15b929cdcdc8c488650555c73aaf017cf805e3a/compiler-plugin/src/test/kotlin/arrow/meta/plugins/eq/EqOperatorTest.kt
r

Rachel

10/31/2019, 6:43 PM
I see that now you're not including `@extension`annotation, so
arrow-annotations
dependency is not necessary
And `0.10.3-SNAPSHOT`could be avoided
Look at ... just a second
a

amanda.hinchman-dominguez

10/31/2019, 6:44 PM
I see. A good point, I can do that.
r

Rachel

10/31/2019, 6:44 PM
arrow-meta/compiler-plugin/src/test/kotlin/arrow/meta/plugins/higherkind/HigherkindTest.kt
a

amanda.hinchman-dominguez

10/31/2019, 6:45 PM
Unfortunately I had to take it out because it turns out we cannot mark independent functions with
@extension
!
We had to add the snapshot version for
arrow-core-data
though, right?
r

Rachel

10/31/2019, 6:46 PM
Not exactly right now, please, look at
arrow-meta/compiler-plugin/src/test/kotlin/arrow/meta/plugins/higherkind/HigherkindTest.kt
and about
@extension
, let me check because the last version of arrow-annotations is published
👀 1
a

amanda.hinchman-dominguez

10/31/2019, 6:47 PM
okay, so that was a change we made. gotcha gotcha gotcha
r

Rachel

10/31/2019, 6:48 PM
and instead of
0.10.3-SNAPSHOT
use
${System.getProperty("CURRENT_VERSION")}
because if we write hardcoded versions it will be difficult to maintain the tests
a

amanda.hinchman-dominguez

10/31/2019, 6:49 PM
oh interesting, so it would be like
val arrowCoreData = Dependency("arrow-core-data: ${System.getProperty("CURRENT_VERSION")}")
?
r

Rachel

10/31/2019, 7:03 PM
without the whitespace
💯 1
val arrowCoreData = Dependency("arrow-core-data:${System.getProperty("CURRENT_VERSION")}")
the format is
artifactId:version