PHondogo
07/27/2020, 9:22 PMrnett
07/29/2020, 8:38 AMFirDeclarationGenerationExtension
and the others that didn't make it into the RC
2. Is defining method/class bodies allowed in those methods? I.e. can I define a method body in FirDeclarationGenerationExtension.generateMembers
? The AllOpen examples don't, and generateMembersForGeneratedClass
is a thing instead of just adding members to the class.
3. Will using the Fir extensions replace SyntheticResolveExtension
with regards to having added definitions show up in the IDE (it sure looks like it)?Petter Måhlén
07/30/2020, 7:26 AMClassPreloadingUtils.preloadClasses
in https://github.com/bazelbuild/rules_kotlin/blob/master/src/main/kotlin/io/bazel/kotlin/builder/toolchain/KotlinToolchain.kt#L70, that means that the Reflection
class gets initialised at a point in time when reflection isn't added?
c) or something completely different. There's a lot of ground to cover in all the Kotlin compilation ecosystem as well as the Bazel stuff, and I'm new to both.
Help very much appreciated, if possible!sean
07/31/2020, 11:22 PMManuel Wrage
08/02/2020, 11:42 AMiFrankWang
08/04/2020, 2:24 AMKtNamedFunction
's return type in form like "`xxx.xxx.TestClass`"? I've only managed to get the short class name as "`TestClass`" with code like this:
ktNamedFunction.getTypeReference().getText()
And here's Mapstruct plugin in Github: https://github.com/mapstruct/mapstruct-ideabod
08/04/2020, 3:07 PM> Task :app:compileDebugKotlin
e: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: wrong bytecode generated
?jereksel
08/10/2020, 6:06 PMSyntheticResolveExtension
stopped working and it throws following error:
e: java.lang.IllegalArgumentException: Unbound type parameters are forbidden: [Unbound private symbol org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl@45e9c41b]
at org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator.generateUnboundSymbolsAsDependencies(ExternalDependenciesGenerator.kt:36)
at org.jetbrains.kotlin.psi2ir.generators.ModuleGenerator.generateUnboundSymbolsAsDependencies(ModuleGenerator.kt:62)
I'm creating type parameters with TypeParameterDescriptorImpl.createWithDefaultBound
, so I wasn't expecting any issues with bounds - especially, because it was working before. Is it known issue? I can create sample reproduction project if it's required.Steve
08/10/2020, 10:52 PMgpeal
08/17/2020, 6:58 PMjereksel
08/18/2020, 10:06 AMJacob Applin
08/18/2020, 6:46 PMFalseHonesty
08/18/2020, 9:34 PMlower
function in my Transformer class seems to be called correctly, but my two visitors never seem to be called. I attempted to debug what happens in the lower
function, but execution gets passed to a class called IRDeclarationBase
when visiting the main
function, which is a class I can't find the source for. Nothing seems to be called after that. Does anyone have any ideas as to what I'm doing wrong?FalseHonesty
08/19/2020, 4:16 AMTypeResolutionInterceptorExtension
will become non-internal anytime soon? I'd like to be able to use it in my compiler plugin 🙂huehnerlady
08/19/2020, 8:05 AMI have the following sample function:
fun test(){
val testString: String? = null
testString ?: throw IllegalArgumentException("null")
print(testString.length)
}
I now want to extract the exception throwing to make clear why I do this:
fun test2(){
val testString: String? = null
testString ?: handleUnexpectedNull()
print(testString.length)
}
private fun handleUnexpectedNull() {
throw IllegalArgumentException("null")
}
But here I get a compile error (see screenshot).
Why is this happening and can I extract the exception in a way that still supports smartcast?
I am using the jvm compiling and kotlin 1.3.72Imran/Malic
08/21/2020, 2:45 PMdescriptor
, which would return the resolved call at the call-site. It has been removed ever since in this PR and was wondering if someone knows a way to go from IrCall -> CallableMemberDescriptor in the IrPhase. In my use case I can’t access the psiElement at call-site only the one in the symbol from the original declaration, which is not resolved - regarding type arguments etc.
that is:
{ expression: IrCall -> expression.symbol.owner.descriptor.original.findPsi()
} // returns the PsiElement
but
{ expression: IrCall-> BindingTraceContext.createTraceableBindingTrace().bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, expression.symbol.owner.descriptor.original.findPsi()) } // returns always null
prior to 1.3.71 one would only need to do:
{ expression: IrCall -> expression.descriptor } // returns CallableMemberDescriptor, which is fully resolved
Any help is very welcome 😄Omar Mainegra
08/23/2020, 4:31 PMMarc Knaup
08/24/2020, 1:33 PMwhen
expressions over a String with plenty of constant cases could be optimized somehow, e.g. by using tableswitches for 1st & 2nd character (esp. if latin) or by using hashes.
Right now such cases will just repeatedly call equals
which can be much slower.
For now I’m using a HashMap
with String
as key and a lambda as value but the lambdas will create a crazy amount of anonymous classes.
I’ve also tried a HashMap
to Int
and then use the Int
for the when
expression but for whatever reason that was slower 😮 Prbl. because of boxing.huehnerlady
08/25/2020, 11:14 AMpublic fun <T : Any> Iterable<T?>.filterNotNull(): List<T> {
return filterNotNullTo(ArrayList<T>())
}
So I expect I can use it with a non-nullable list with nullable items, and I get a non-nullable list with just non-nullable items back.
But when I use this method like so:
fun List<String?>?.extract(): List<String> =
this?.filterNotNull().map {
"foo"
}.toList()
I get a compiler error as shown in my screenshot.
Why is this the case? I would have expected that the output is a non-nullable list, at least that is what I read out of the signature?
I am using kotlin 1.3.72FalseHonesty
08/25/2020, 7:07 PMjava.lang.IllegalStateException: No module deserializer found for <library Gradle: net.minecraft:minecraftSrc:1.12.2> is a module[ModuleDescriptorImpl@5c013a11]
. I'm not sure what this means?Adam
08/28/2020, 3:15 AMcaelum19
08/28/2020, 3:35 PMtmphey
08/29/2020, 10:25 AMMarc Knaup
09/01/2020, 12:54 PM.kt
files as you would with annotation processing?Imran/Malic
09/03/2020, 12:56 PMJames Hamilton
09/03/2020, 3:29 PMkotlinx-metadata-jvm
package published to mvn? The metadata generated by kotlinc 1.4 does not work with the metadata-jvm 0.1.0 versiongenovich
09/06/2020, 11:19 AMtoString()
implementation for object
classes. How I can do that?
Should I use kapt or is there some way to do it via compiler plugin?Nabil
09/07/2020, 6:06 PMisIntOrNullableInt
is not available in KotlinBuiltIns
? (similar for example to isLongOrNullableLong
).
When using a property var age:Int?
isInt
returns false
(which is correct) isNullablePrimitiveType
returns true
(which is correct), but there's no mechanism to detect a return type is Int
or Int?
Sebastian Kaspari
09/08/2020, 9:34 AMkotlinFile
and script
? `kotlinFile`'s topLevelObject
seems to only contain declarations. What is this used for? 🙂 (https://kotlinlang.org/docs/reference/grammar.html#syntax-grammar)Strum355
09/13/2020, 9:47 PMStrum355
09/13/2020, 9:47 PMraulraja
09/13/2020, 10:57 PMStrum355
09/13/2020, 11:04 PMephemient
09/14/2020, 5:18 AMudalov
09/14/2020, 11:10 AMStrum355
09/14/2020, 12:37 PMwith the Kotlin compiler reading Java sources if necessary.Am I right in saying this is how the Kotlin compiler can type-check constructs from Java sources used in Kotlin sources? And how much of this functionality is in kotlin-compiler-embeddable?
udalov
09/14/2020, 12:53 PMkotlin-compiler-embeddable
is in fact the full Kotlin compiler with shadow-jared dependencies.Strum355
09/14/2020, 1:07 PM