uli
09/04/2019, 1:28 PMval x : (()->Unit)? = null
fun main() {
if (x != null) {
x.invoke()
}
}
while with this one the compiler complains about the reference having a nullable type:
val x : (()->Unit)? = null
fun main() {
if (x != null) {
x()
}
}
Compiler and Android Studio even agree on complaining about the second snippet.
Am I missing something?Shannon Yang
09/10/2019, 7:56 PMIrGenerationExtension
, and am trying to add a function to annotated classes that just prints "Hello World". I got stuck figuring out how to find the println
descriptor or symbol to build the function call through IrCallImpl
. Does anyone know where I could find an example, or another way I could go about this? Thanks!Stumpos
09/11/2019, 10:22 PMStumpos
09/12/2019, 7:21 PMFoso
09/13/2019, 3:51 PMspierce7
09/16/2019, 4:06 PMjosephivie
09/18/2019, 12:40 AMraulraja
09/21/2019, 4:21 PMStumpos
09/25/2019, 4:49 PMZac Sweers
09/26/2019, 9:15 AM.class
files directly via Kapt, but I’m wondering actually if this is a bug in the compiler itself by virtue of not putting .class
source roots on the compile classpath (so other code can link against it). I’ve been looking at how gradle handles this, and while it supports generating class files directly via annotation processing, its annotation processing machinery doesn’t actually appear to do anything special to ensure the class file is on the compile classpath. It just hands it over to the compiler.
Issue for ref: https://youtrack.jetbrains.com/issue/KT-33847
I’m wondering if this should be reassigned as a kotlinc bug basically.Timmy
09/27/2019, 2:41 PMFoo<Nothing?>
(and Foo<Nothing>
) compile to a raw type. While that is fine for the runtime it means losing generic information where it would be normally available (such as in method signatures).
I have found this (https://github.com/JetBrains/kotlin/commit/9acf3e40de2d22318f9d3eda15e5da47117edbc4#diff-efccdee550f101125771902fc631175a) commit that implemented the Nothing -> raw type conversion. I could not find an explanation. Does someone know the reason behind this decision? How could I recover the Nothing generic argument? Is this the only case that compiles to a raw type?Akram
10/01/2019, 7:57 PMthanh
10/02/2019, 6:44 AMtype newType = typeA | typeB
?turansky
10/02/2019, 6:54 AMprototype
via compiler plugin?
// Kotlin
class A: B
// compiled JS
A.prototype = Object.create(B)
// compiled JS + enrich
A.prototype = Object.create(enrichMethod(B))
Can it be realized using JsSyntheticTranslateExtension
?jdemeulenaere
10/03/2019, 12:10 PMdoSomething(s: String)
we know that when calling this function the expected value inside the ()
should be a string. Is there anything in kotlin-compiler
that already does all of this kind of logic and returns a KotlinType
?raulraja
10/04/2019, 6:45 PMe: java.lang.IllegalStateException: The provided plugin arrow.meta.MetaPlugin is not compatible with this version of compiler
My current config for the shadow plugin looks like:
shadowJar {
configurations = [project.configurations.compile]
relocate 'org.jetbrains.kotlin.com.intellij', 'com.intellij'
dependencies {
exclude(dependency {
it.moduleGroup.startsWith('org.jetbrains') || it.moduleGroup.startsWith('org.intellij')
})
}
//relocate 'org.jetbrains.kotlin.load', 'kotlin.reflect.jvm.internal.impl.load'
}
Same behavior regardless if I include the embedded Kotlin deps or not. Whenever I shadow a compiler plugin I get that error. does anyone know if there is a special setting or something I am missing?. The only difference between the jars I’ve noticed is that due to the package relocation the shadowed version may have different size .class files. Any help is much appreciated. Thanks.ventura
10/06/2019, 11:57 AMtschuchort
10/06/2019, 5:07 PMAkram
10/08/2019, 7:26 PMAkram
10/09/2019, 1:54 PMAkram
10/09/2019, 5:56 PMaurimas
10/11/2019, 4:00 PMreified
types. For example:
package test.pkg
inline fun <reified T> Context.systemService1() = getSystemService(T::class.java)
inline fun Context.systemService2() = getSystemService(String::class.java)
For this PsiClassItem
call to methods
only returns 1 method (the one without reified
). Removing reified
brings it back, going back to older version of UAST also brings it back. I was wondering if this sounds familiar to anyone?Henry
10/14/2019, 1:18 PMDaniel Rampelt
10/14/2019, 3:46 PMkotlin-compiler-embeddable
(which has been working great for JVM) but it seems to have a bunch of dependencies remapped under org.jetbrains.kotlin
. The problem is konanc
, even when run from gradle just like I'm doing for JVM, doesn't seem to have those packages remapped so my plugin doesn't load since it's referencing the wrong classes. Is it possible to write a plugin that works for both JVM/native at the moment?Akram
10/17/2019, 3:21 PMImran/Malic
10/18/2019, 11:19 AMImran/Malic
10/21/2019, 10:03 AMlouiscad
10/22/2019, 9:29 AMjdemeulenaere
10/23/2019, 9:10 AMval context: BindingContext = ...
val callExpression: KtCallExpression = ...
val call = callExpression.getCall(context)
val resolvedDescriptor = call?.getResolvedCall(context)?.candidateDescriptor
if (resolvedDescriptor == null) {
// TODO: Find a list of candidate descriptors.
}
For example, the following code:
fun hello(s: String) { ... }
fun helloWithOverload(s: String) { ... }
fun helloWithOverload(i: Int) { ... }
fun main() {
hello("foo") // will be correctly resolved
hello() // will be correctly resolved as there is only one possible call
helloWithOverload("foo") // will be correctly resolved as the call is complete
helloWithOverload() // won't be resolved as the call is incomplete and there are multiple candidates
}
My question: what methods can I use to find those candidates ?
Thanks a lot 🙂Andrey Tarasevich
10/24/2019, 9:50 AM--add-modules <http://java.se|java.se> --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED --add-opens jdk.management/com.ibm.lang.management.internal=ALL-UNNAMED
Does anyone know, how to do something similar for Kotlin compiler? Is it possible at all? Maybe I'm missing somethingAndrey Tarasevich
10/24/2019, 9:50 AM--add-modules <http://java.se|java.se> --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED --add-opens jdk.management/com.ibm.lang.management.internal=ALL-UNNAMED
Does anyone know, how to do something similar for Kotlin compiler? Is it possible at all? Maybe I'm missing somethinggildor
10/24/2019, 9:52 AMAndrey Tarasevich
10/24/2019, 10:22 AM