https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
arrow-meta
  • r

    raulraja

    03/30/2020, 1:58 PM
    @Imran/Malic @danieeh @aballano @Joachim Ansorg The deadlock is resolved when I move initializations of proofs outside to each place where a new resolution facade is created: No need to worry about that now. https://github.com/arrow-kt/arrow-meta/blob/591a5eedfb8594d89b3a9048a8627084b78f23e3/idea-plugin/src/main/kotlin/arrow/meta/ide/plugins/proofs/resolve/ProofsKotlinCacheService.kt#L27
    🙌 5
    d
    • 2
    • 1
  • a

    Ahmed Mourad

    04/02/2020, 7:15 AM
    Hey! Is there a MetaExtension that would allow me to apply transformations to compiler generated methods?
    r
    • 2
    • 8
  • b

    Burkhard

    04/02/2020, 9:32 AM
    Anyone else having problems debugging projects that use the arrow meta? Specifically the line number information gets changed which makes it impossible to properly set breakpoints. This can easily be seen in https://github.com/arrow-kt/arrow-meta-examples/tree/master/hello-world. After building you can inspect the bytecode using
    javap -c -l use-plugin/build/classes/../HelloWorldKt.class
    Looking at the line information you see that it no longer matches the source file.
    r
    • 2
    • 15
  • b

    Burkhard

    04/02/2020, 9:33 AM
    Also I keep getting this warning when building and I can’t seem to figure out how to get rid of it
    > Task :use-plugin:compileKotlin
    w: Some JAR files in the classpath have the Kotlin Runtime library bundled into them. This may cause difficult to debug problems if there’s a different version of the Kotlin Runtime library in the classpath. Consider removing these libraries from the classpath
    w: /Users/burkhard/Projects/Kotlin/arrow-meta-examples/hello-world/create-plugin/build/libs/create-plugin-all.jar: Library has Kotlin runtime bundled into it
    r
    • 2
    • 3
  • j

    johnaqel

    04/09/2020, 2:08 PM
    Is it possible to replace all annotation processing done in kapt, with arrow-meta?
    s
    r
    +4
    • 7
    • 22
  • s

    Sam Garfinkel

    04/11/2020, 9:57 PM
    Are there stable releases available somewhere or am I meant to use the snapshots? Also where is the gradle plugin referenced in the Quick Start hosted? None of the plugins seem to be available from the gradle plugins portal. Do I need the gradle plugin or can I just use the arrow-meta library hosted at Maven Central?
    r
    r
    • 3
    • 11
  • m

    Massimo Carli

    04/19/2020, 12:05 AM
    Hi, I’m trying to define a plugin for IntelliJ but I cannot find the dependency for the
    arrow.meta.plugin.idea
    package so I cannot find the definition for
    IdeMetaPlugin
    . Thanks
    r
    r
    • 3
    • 8
  • r

    russhwolf

    04/23/2020, 1:40 PM
    Is there a good multiplatform meta sample anywhere? Having trouble understanding how to wire things together on my own based on the hello world sample.
    i
    r
    s
    • 4
    • 22
  • c

    curioustechizen

    04/28/2020, 6:45 AM
    Hello everyone. Since mocking is next to impossible in Kotlin native, the next best option is to write mocks by hand. I'm looking to lean on compiler Plugin to automate this. The idea is to generate code only for the
    commonTest
    dependency. I'm aware there will be limitations with this compared to mocking frameworks. I'm a complete newbie when it comes to compiler plugins and arrow meta. I've watched a few conference talks on the topic but that's about it. My question is: Is everything required for such a plugin already available? Or is it better to wait until 1.4? For example, I think IR might not be needed in this case because it looks like I want my plugin to generate Kotlin code. Also, how about an IDE plugin? Would that be required for this scenario?
    r
    • 2
    • 5
  • m

    melatonina

    04/30/2020, 8:31 AM
    Good morning. Is the syntax <STRING> <BLOCK>
    "name" { /* ... */ }
    like in https://github.com/arrow-kt/arrow-meta-examples/blob/master/hello-world/create-plugin/src/main/kotlin/io/arrowkt/example/HelloWorldPlugin.kt#L11 a standard Kotlin syntax or something that is added by ΛRROW Meta?
    a
    • 2
    • 4
  • m

    melatonina

    04/30/2020, 6:41 PM
    Is there a directory of compiler plug-ins written with ΛRROW Meta, besides the "hello world" example?
    m
    r
    • 3
    • 4
  • m

    melatonina

    05/03/2020, 7:05 AM
    Is code generation only text-based, as opposed to AST-based, currently? Or is it just the most common method in use?
    r
    • 2
    • 2
  • b

    Ben Woodworth

    05/03/2020, 4:42 PM
    I'm interested in making a simple KEEP-87 inspired implicit dependency injection plugin, but I'm not sure where to start Basically, if a primary constructor is called with missing parameters, any parameters marked with @Dependency will be filled in with variables in the environment of the same type, that are also marked with @Dependency. (Example attached) I tried playing around with irConstructorCall, but couldn't get that to be called (will I have to wait for Kotlin 1.4 for IR?). And from there, I'm not sure how to transform the constructor call to find missing arguments, or how to find variables I can use
    Untitled
    r
    • 2
    • 4
  • m

    melatonina

    05/04/2020, 9:30 AM
    Is it possible to use some code generated with ΛRROW Meta (with
    Transform.newSources
    ) in the same module upon which ΛRROW Meta was applied to generate it? As an example, I'm generating a wrapper class with this transformation
    classDeclaration(isAnnotatedWith<Cool>()) { c ->
        Transform.newSources(
            """|package ${c.packageName}.cool
               |                       
               |class Cool${c.name}(val value : ${c.fullyQualifiedName})
               |""".trimMargin().file("cool.kt")
        )
    }
    Can I configure gradle and IDEA to use this class definition in the module where I apply my plugin? The problem that I see is that the content of the kapt folder is made of both new source files and modified source files.
    r
    • 2
    • 1
  • m

    melatonina

    05/04/2020, 10:20 AM
    When inspecting the
    valueParameters
    of the
    primaryConstructor
    ot a
    KtClass
    in a ΛRROW Meta transformation, is it normal to find the
    typeReference.name
    to be
    null
    and to have to use
    text
    , instead, to find the type of the parameter (
    Int
    , in my case)?
    r
    • 2
    • 2
  • m

    melatonina

    05/04/2020, 3:15 PM
    Hello, again. I'm trying to make my first useful plugin. It implements inline serialization for data classes with only one
    val
    parameter. The code can be found here: https://github.com/mel4tonin4/inline-serialization-plugin/tree/master The plugin operates on classes marked with a custom
    @InlineSerializable
    annotation. Currently, the serializer classes are generated and the original classes seems to be annotated with a
    Serializable(with=)
    decoration pointing to the serializer class... but not quite. If I enable
    metadebug
    I get a source file with the annotated class, but in the same kapt directory there is a file with a non-annotated class and if I try to use the class in another library, there is no
    serializer()
    method. Here is the content of the kapt directory: https://gist.github.com/mel4tonin4/1605d28e9bd2471c5bfb013b2d31f0ef I enabled
    metadebug
    only on one of the classes. Why are ChannelCount.kt.meta and ChannelCount.kt not the same?
    r
    • 2
    • 2
  • m

    melatonina

    05/04/2020, 10:28 PM
    And if I can't use Meta in my application, at the moment, it makes no sense for me to invest time in learning it now, obviously.
    r
    • 2
    • 4
  • m

    melatonina

    05/05/2020, 5:31 AM
    Can we infer that a branched expression with two different types
    A
    and
    B
    has a type
    Either<A, B>
    and compile it accordingly, by inserting the calls to
    left()
    and
    right(),
    with an ΛRROW Meta plug-in? Would that cause any problems?
    r
    • 2
    • 1
  • m

    melatonina

    05/05/2020, 8:14 AM
    I looked into the ΛRROW Meta issue tracker and it seems that ΛRROW Meta does not work at all with Kotlin 1.3.70+: https://github.com/arrow-kt/arrow-meta/issues/554 Notes for other people approaching ΛRROW Meta naively, like me: •
    arrow-meta-compiler-plugin
    version
    1.3.70-SNAPSHOT
    does not exist, so don't waste time looking for it based on the discussions on Slack. • For updated information on the status of ΛRROW Meta, better check the issue tracker.
    r
    • 2
    • 10
  • m

    melatonina

    05/06/2020, 7:09 PM
    How can I manipulate the code after type checking? Can you point an example of a plug-in working at that stage?
    r
    • 2
    • 3
  • r

    russhwolf

    05/06/2020, 8:03 PM
    How can I resolve the type of a KtProperty inside a meta plugin? I'm trying to do something like this but I don't know if I'm even calling the right API
    val Meta.demoPlugin: CliPlugin get() = "Demo" {
        meta(
            property({ true }) { ktProperty ->
                val type = ktProperty.typeReference?.name // name is null
                Transform.empty
            }
        )
    }
    m
    r
    +4
    • 7
    • 132
  • a

    Ahmed Mourad

    05/09/2020, 7:42 PM
    Hey! I'm trying to check the type of a property from within a
    namedFunction
    block, however,
    kotlinType
    requires a
    BindingContext
    , where can I get its instance from?
    namedFunction({ ... }) { c ->
        c!!containingClass().getProperties()[0].kotlinType()
    }
    b
    r
    • 3
    • 10
  • r

    redrield

    05/09/2020, 8:22 PM
    specifically knowing the name of the class and the names of its type arguments
    b
    s
    +2
    • 5
    • 16
  • m

    marc0der

    05/15/2020, 7:11 AM
    Hi meta folks 👋, Ive been working hard on the later chapters of the FP in Kotlin book and am deep into higher kinded type territory 😁 I've written all the code samples using the
    Kind
    interface, surrogate types, boilerplate etc. Is there an easier way to express HKTs with Arrow Meta yet? I remember there being some talk about making them easier to use with Arrow Meta in the past, but just not sure if this has progressed at all.
    r
    • 2
    • 21
  • r

    raulraja

    05/15/2020, 8:04 PM
    https://kotlinlang.slack.com/archives/C0B9K7EP2/p1589572019120700?thread_ts=1589398414.110200&amp;cid=C0B9K7EP2
    :arrow: 13
    🤸‍♂️ 1
    m
    f
    i
    • 4
    • 8
  • m

    mattmoore

    05/22/2020, 8:48 PM
    Curious if I'm missing something: When trying to build meta via the readme instructions gradle appears to hang?
    ./gradlew buildMeta -Dorg.gradle.debug=true
    Starting a Gradle Daemon (subsequent builds will be faster)
    
    > Starting Daemon
    After 20 minutes it doesn't appear to proceed any further. Perhaps I'm missing something?
    s
    r
    • 3
    • 4
  • n

    Nico

    05/23/2020, 6:45 PM
    I am fiddling a bit going through predicates to determine whether a certain PsiElement meets some conditions. Is there any way to write some small tests where I can play with instantiated PsiElements in order to inspect them and test my predicates?
    s
    r
    r
    • 4
    • 4
  • m

    mattmoore

    05/24/2020, 9:04 PM
    I'm tinkering with tests in Meta. It looks like
    data class
    is not supported for source code? If I have a test like this:
    @Test
      fun `destructuring example`() {
        assertThis(CompilerTest(
          config = {
            metaDependencies
          },
          code = {
            """|data class Person(val firstName: String, val lastName: String, val age: Int)
               |
               |val person = Person("Matt", "Moore", 100)
               |val (firstName, lastName, age) = person
               |""".source
          },
          assert = {
            allOf(
              "firstName".source.evalsTo("Matt"),
              "lastName".source.evalsTo("Moore"),
              "age".source.evalsTo(100)
            )
          }
        ))
      }
    The code snippet fails to compile. Removing the
    data
    keyword succeeds, but then there are no
    componentN
    functions generated for destructuring.
    r
    • 2
    • 8
  • m

    mattmoore

    05/27/2020, 12:29 AM
    Curious, there doesn't appear to be a meta expression for matching a
    KtCallExpression
    node. Is
    KtCallExpression
    is related in any way to
    KtCallableReferenceExpression
    ? I quickly put together a branch to add a meta matcher for
    String.callExpression
    but noticed when I got to the
    KtPsiFactory
    that there is no method there for creating a
    KtCallExpression
    . Which leads me to believe this is not possible at the moment since PSI might not support it? Example of what I'm talking about: https://github.com/arrow-kt/arrow-meta/compare/master...mattmoore:call-expressions?diff=unified#diff-2ab9610fb1adf0fd2d58e144d4097e56R122 Perhaps there's another way to hook into
    KtCallExpression
    that I'm overlooking...
    i
    • 2
    • 7
  • j

    Joachim Ansorg

    05/27/2020, 6:53 AM
    Is it possible to get a clean, working IntelliJ project setup for arrow-meta? I'm using 2020.1.2 rc. I've cloned current master of arrow-meta, imported it as a Gradle project, but still get unresolved references. E.g.
    ExtensionPhase
    in
    valueArgumentCoercion.kt
    and many other files in the
    idea-plugin
    module. I'd be glad to any help here.
    r
    i
    • 3
    • 22
Powered by Linen
Title
j

Joachim Ansorg

05/27/2020, 6:53 AM
Is it possible to get a clean, working IntelliJ project setup for arrow-meta? I'm using 2020.1.2 rc. I've cloned current master of arrow-meta, imported it as a Gradle project, but still get unresolved references. E.g.
ExtensionPhase
in
valueArgumentCoercion.kt
and many other files in the
idea-plugin
module. I'd be glad to any help here.
r

Rachel

05/27/2020, 8:08 AM
Hi @Joachim Ansorg,
master
branch is a stable branch. Commits merged on
master
branch need to pass the build check and tests.
ExtensionPhase
comes from
compiler-plugin
. Do errors raise when building the
idea-plugin
module?
j

Joachim Ansorg

05/27/2020, 8:09 AM
gradle is building fine, IntelliJ fails to resolve the class in the editor. I was wondering if anyone knows how to force IntelliJ to do the right thing here
r

Rachel

05/27/2020, 8:13 AM
Invalidate caches and restart works for me in those cases
j

Joachim Ansorg

05/27/2020, 8:22 AM
I just tried that, it didn't work. But I also tried to go back to 2019.3 and this seems to work. This means that 2020.1 seems to be broken with the Gradle setup of arrow-meta, at least for me 😞 I can work with 2019.3 for now, that's good enough
r

Rachel

05/27/2020, 8:28 AM
Oh no... I'm going to try 2020.1
@Joachim Ansorg, it doesn't work for me. I realized that Intellij doesn't ask things when opening (importing settings) neither when importing a project, it's opened without asking configuration things. I tried latest release:
2020.1.1
(not rc)
@Joachim Ansorg, I tried other Gradle projects and they worked properly
So I came back to Arrow Meta and I realized that the problem is just with
idea-plugin
and dependencies with
compiler-plugin
However, dependencies between
compiler-plugin
and
meta-test
work
So it seems the problem is the shadowed jar
It seems the new Intellij doesn't know how to manage the dependency of a shadowed jar
j

Joachim Ansorg

05/27/2020, 9:22 AM
thanks for your thorough analysis of this issue! I agree that this seems like an issue with the shadowed jar. But unfortunately I don't know how to fix this. YouTrack might have some clues, but I doubt it
r

Rachel

05/27/2020, 9:26 AM
I remember now that I got a similar issue when creating an example, however I was using
2019.3
and I didn't understand the reason why I didn't get that issue with Arrow Meta workspace: https://github.com/johnrengelman/shadow/issues/264
@Joachim Ansorg while we're investigating another way to solve it, you could add this dependency to idea-plugin:
compileOnly project(':compiler-plugin')
because it doesn't impact on the plugin or library (POM, jar and ZIP from idea-plugin remain the same as before)
j

Joachim Ansorg

05/28/2020, 10:26 AM
thank you @Rachel, I'll try that
🙌 1
@Rachel I've tried it. The IDE is working again with this change. But the idea-plugin module doesn't compile anymore due to compilation errors in a few files
r

Rachel

05/28/2020, 12:06 PM
Thanks @Joachim Ansorg, I didn't get those errors... please, could you share one of them?
j

Joachim Ansorg

05/28/2020, 12:20 PM
@Rachel With
gradle clean publishAndRunIde
I'm seeing this and bunch of similar errors:
Task :idea-plugin:compileKotlin FAILED
e: /IslandWork/source/arrow-meta/idea-plugin/src/main/kotlin/arrow/meta/ide/IdeMetaPlugin.kt: (15, 6): Class 'IdeMetaPlugin' is not abstract and does not implement abstract base class member public abstract fun registerProjectComponents(project: MockProject, configuration: CompilerConfiguration): Unit defined in arrow.meta.MetaPlugin
👍 1
r

Rachel

05/28/2020, 2:19 PM
Thanks @Joachim Ansorg, maybe it's caused by the transitive dependencies. I'll review it 👍
i

Imran/Malic

06/02/2020, 7:48 AM
Hi @Joachim Ansorg I am working on a few missing peaces to allow feature derivation through 3rd party plugins using Arrow Meta. Depending, on some on going work in Meta. I hope to address it this weekend. Means, currently the features build with Meta, are not picked up by IntelliJ.
It’s not a big concern, but I am drafting an encoding, which allows coherent overrides at the right lifecycle phase.
Instead of going for a monoidal construction, which forces Meta features in 3rd party plugins.
View count: 1