Imran/Malic
05/08/2019, 2:45 PMdsavvinov
06/20/2019, 10:15 AMsimon.vergauwen
06/21/2019, 3:57 PMraulraja
06/21/2019, 6:05 PMraulraja
06/22/2019, 8:38 PMraulraja
06/23/2019, 11:59 PMCaused by: java.util.MissingResourceException: Can't find bundle for base name messages.PsiBundle, locale en_GB
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1581)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1396)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:782)
at org.jetbrains.kotlin.com.intellij.psi.PsiBundle.getBundle(PsiBundle.java:45)
at org.jetbrains.kotlin.com.intellij.psi.PsiBundle.message(PsiBundle.java:33)
at org.jetbrains.kotlin.com.intellij.psi.impl.CheckUtil.checkWritable(CheckUtil.java:47)
at org.jetbrains.kotlin.com.intellij.extapi.psi.ASTDelegatePsiElement.replace(ASTDelegatePsiElement.java:371)
raulraja
06/24/2019, 12:01 AMreplace
or astReplace
in any psi element fails with similar errors. Is there a way with compiler plugins to modify the PsiElements to make adjustments and replacements before it goes into type checking and generation?raulraja
06/25/2019, 11:59 PM@with
to enhance the scope resolution of that function so it takes in account the Semigroup<A>
type to resolve combine
without the need to wrap the body in with (S) { a.combine(b) }
.
What part of the compiler do I need to look into to avoid the unresolved reference: combine
?
In the actual Keep impl this happens in the BodyResolver
but not sure how to get to that point in a compiler plugin. Any help or pointers in the right direction is appreciated.raulraja
06/26/2019, 12:03 PMNoValueForParameter
similar to how it was done in the KEEP https://github.com/arrow-kt/kotlin/pull/6/files#diff-792252e1fcae31609d7348297b7c45f4R46 ?raulraja
06/28/2019, 7:03 PMImran/Malic
06/29/2019, 12:06 PMImran/Malic
06/29/2019, 12:07 PMcompile "org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlin_version"
we do:
api "org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlin_version"
raulraja
07/06/2019, 9:59 AMsyntheticResolver
.
Where users do something like:
func({
"fun <$typeArgs> $name($params): $returnType = $body" //find
}) { fn ->
"fun <$typeArgs> $name($params): $returnType = $body" //transform
}
In this case that would be the identity element for the ValueParameter
declaration quote. This is in a similar way the quasiquote style syntax that scala-meta uses and much easier for most use cases to develop compiler plugins in comparison with the compiler internals, descriptor and phases we have to deal today.
Say you had a use case to add logging to all functions named foo
that return Unit
. This will be the expression that satisfies that use case in a compiler plugin:
func({
"fun <$typeArgs> foo($params): Unit = $body" //find
}) { fn ->
"fun <$typeArgs> $name($params): $returnType {
println("inside foo: Unit")
return $body"
}
}
raulraja
07/17/2019, 12:30 AMraulraja
07/27/2019, 4:45 AMinternal
shikasd
07/31/2019, 1:16 AMshikasd
08/08/2019, 1:01 AMbuild
folder (and mark them in gradle) instead of appending to already existing ones, debug seems to work out of the box
I have implemented POC to entertain the idea - https://github.com/ShikaSD/kotlin-compiler-di/commit/b7c7f77f5b0b1436e7107421f21fcb6f1910cf88Imran/Malic
08/23/2019, 8:22 AMautofold
, which will give you an automatic fold function over valid GADT/ ADT in vanilla Kotlin at compile time.
sealed class A
data class B(val x: Int) : A()
data class C(val x: Int) : A()
object D : A()
sealed class Expr<out A, B>
data class Const(val number: Double) : Expr<Nothing, Double>()
data class Sum<C>(val e1: Expr<Int, C>, val e2: Expr<Int, C>) : Expr<Int, C>()
object NotANumber : Expr<Nothing, Nothing>()
fun syntheticExprFold(): Int =
Sum(
e1 = Const(3.0),
e2 = Const(2.1)
).fold(
{ c: Const -> c.number.toInt() },
{ _: Sum<Double> -> 0 },
{ 94 }
)
fun syntheticAFold(): Int =
B(44).fold(
{ b: B -> b.x * b.x },
{ c: C -> c.x - c.x },
{ 0 }
)
Here is the code: https://github.com/47deg/arrow-meta-prototype/blob/master/compiler-plugin/src/main/kotlin/arrow/meta/autofold/AutoFoldPlugin.kt
arrowsimon.vergauwen
09/05/2019, 1:11 PMshikasd
09/11/2019, 3:31 PMraulraja
09/15/2019, 8:39 PMthanh
09/16/2019, 10:25 AMthanh
09/19/2019, 6:17 AMraulraja
09/19/2019, 9:51 AMraulraja
09/30/2019, 12:14 AMfun <B> bindingFilter(c: suspend MonadFilterSyntax<F>.() -> B): Kind<F, B> {
val continuation = MonadFilterContinuation<F, B>(this)
val wrapReturn: suspend MonadFilterSyntax<F>.() -> Kind<F, B> = { just(c()) }
wrapReturn.startCoroutine(continuation, continuation)
return continuation.returnedMonad()
}
In this function IR codegen freaks out with : { just(c()) }
getting into this error: https://github.com/JetBrains/kotlin/blob/9c9d2b5ad4ac27a0792d3cf4c62599fb3e09ebbb/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt#L420
Seems like IR is unable to deal with suspended lambdas like this one. While I still have work in the comprehension plugin which will get rid of this problem all together I wonder if there is a way to rewrite that so that is not a suspended lambda.raulraja
10/08/2019, 4:28 PMJoachim Ansorg
10/15/2019, 1:32 PMkitttn
10/16/2019, 4:15 PMImran/Malic
10/21/2019, 3:06 PM