Justin Wei
09/15/2020, 7:42 PMagta1991
09/18/2020, 9:06 AMJason A. Donenfeld
09/18/2020, 3:24 PMZach Klippenstein (he/him) [MOD]
09/19/2020, 12:10 AMrnett
09/19/2020, 7:58 AMkartik1712
09/19/2020, 1:09 PMrecords
may be helpful in implementing data
classes.rnett
09/20/2020, 2:41 AMinvokeSuspend
, but the original isn't deleted. Gists of the ir dump before lowering and after lowering (when the error happens). Note in the after lowering the original lambda's body on line 192, and the body in the continuation on line 210.rnett
09/20/2020, 3:14 AMjava.lang.IllegalStateException: Not found Idx for public kotlin.collections/mapOf|5848051883920634516[0]
from the IrLinker. I'm referencing and using mapOf(vararg Pair<>)
which works fine on JVM. The compileKotlinJs
task works fine, it's the compileProductionExecutableKotlinJs
task that fails.
It's happening on other methods to. Seems to be just top level functions. Is this a known bug?
Poking around in debug in KotlinIrLinker.IrDeserializerForFile
, while the referenced function (in this case, to
) isn't in reversedSignitureIndex
, it is in fileLocalDeserializationState.reachableTopLevels
, so it is obviously being found somehow.ventura
09/21/2020, 10:25 AMdesktopMain
to another OSFalseHonesty
09/22/2020, 8:20 PMrnett
09/23/2020, 4:17 AMconst val prop = "..."
). I'm using context.referenceProperties(name).single().owner.backingField!!.initalizer!!.expression as IrConst<String>
and it works fine on JVM, however on JS backingField.expression
is IrErrorExpressionImpl: Expression body is not deserialized yet
. I'll make an issue if this is indeed a bug, but wanted to check its not due to me miss-using something (should I just make an issue in the future?).Nabil
09/23/2020, 7:21 PMaddGetter
extension was left on the IrProperty
https://github.com/JetBrains/kotlin/blob/master/compiler/ir/backend.common/src/org/jetbrains/kotlin/ir/builders/declarations/declarationBuilders.kt#L107 while addSetter
was removed in https://github.com/JetBrains/kotlin/commit/d1dc938a5d7331ba43fcbb8ce53c3e17ef76a22a#diff-2726c3747ace0a1c93ad82365cf3ff18L114 ? What's the new way to create setters on a generated property since 1.4.255
?PHondogo
09/25/2020, 6:48 AMinline fun<reified T> test() {throw AssertionError("Implementing by compiler plugin")}
In IR generator I want to replace all calls to this function by some expression (using T type literal).
For calls with direct literals (for example test<Int>()
) it works as expected.
But when calling from templated function with template parameter it appears to substitute just type parameter.
For example inline fun<reified T> test2(){test<T>()}
Is it possible in IR generation phase to transform all actual inlined types?Manuel Wrage
09/26/2020, 1:21 PMpablisco
09/29/2020, 10:36 PMgroostav
10/05/2020, 7:00 PMgetInstance
flow. Im looking at something like this:
inline fun <reified T> Injector.getInstance(): T {
val targetType = T::class.java
if(targetType.typeParameters.isEmpty()){
return getInstance(T::class.java)
}
else {
val targetTypeSpecifically = Key.get(object: TypeLiteral<T>(){})
return getInstance(targetTypeSpecifically)
}
}
I'm wondering what the compiler does with dead-code-elimination of the type that gets created for targetTypeSpecifically
. For the case where the type isnt generic (we take the true branch) Will that create a new Class
entry at runtime or wont it? Whats the best way for me to test that?Daniel Svensson
10/14/2020, 7:25 AMraulraja
10/14/2020, 10:30 AMs
should not have compiled or become accessible.Marc Knaup
10/16/2020, 12:38 AM(0..10).forEach { … }
cause an IntRange
and an iterator to be allocated.
If I recall correctly calls like that are supposed to be optimized.coroutinedispatcher
10/16/2020, 2:32 PMpublic
modifier in Kotlin. Since everything is already public by default, is there a use case where you actually need to "force" put that modifier? Basically, at the moment I cannot think of such case, when you need a public
modifier in front of something.spierce7
10/16/2020, 2:57 PMlouiscad
10/19/2020, 7:20 AMconst val
affect/hinder incremental compilation in ways plan val
don't, granted their value don't change, but something else changed in the host class (e.g. a new constant or property)?Olivier Notteghem
10/20/2020, 6:40 PMlouiscad
10/28/2020, 10:44 AMw: Flag is not supported by this version of the compiler: -XInlineClasses
groostav
10/28/2020, 11:50 PMsealed class Configuration {
data class Customer(val name: String, val age: Int): Configuration()
data class User(val email: String): Configuration()
}
class Whatever {
fun doStuff(config: Configuration): Int {
//...
}
}
and I would like kotlin to do something automagical with
w.doStuff("bob", 42) // --calls Customer.<init>, doStuff()
w.doStuff("<mailto:jane_doe@email.com|jane_doe@email.com>") // calls User.<init>, doStuff()
I feel like I use sealed-classes as a way to expand a functions capability a lot. Right now (at least 3x in recent memory), I'll add exension functions to call the constructor and the method for you. eg
fun Whatever.doStuff(name: String, age: Int) = doStuff(Customer(name, age))
but this is kinda tedious, and i feel like the compiler could do it for me.Zach Klippenstein (he/him) [MOD]
11/02/2020, 11:28 PMfoo$default
) were generated as synthetic
and non-final methods without the IR backend, but are now generated as final and non-synthetic (+final, -synthetic). Does anyone know if this is intentional?mbonnin
11/04/2020, 10:31 AMemptyList<Value>
would behave differently than emptyList<Node>
?mbonnin
11/04/2020, 10:48 AMList<Any>
there. I guess because it could because List<Named>
is as good of a solution than List<Node>
? But in the context of List<Node>
, I feel like this could be disambiguated_?_bjonnh
11/09/2020, 7:43 PMdiesieben07
11/09/2020, 9:27 PMclass MyModel : Model() {
val foo by IntField()
// this is generated by my plugin:
interface EntityI {
val foo: Int
}
}
Now I also want to generate the following companion object:
companion object : ModelCompanion<MyModel, EntityI>
I can create the companion object using SyntheticResolveExtension.getSyntheticCompanionObjectNameIfNeeded
, however inside addSyntheticSupertypes
for the companion object I cannot add the supertype, because EntityI
is not yet resolvable as a descriptor (trying to do so will report a recursion, which does make sense).
I understand I need to somehow create a lazy KotlinType (which seems to exist), but I have no idea how I would create it with what I have available in addSyntheticSupertypes
.
Any advice?diesieben07
11/09/2020, 9:27 PMclass MyModel : Model() {
val foo by IntField()
// this is generated by my plugin:
interface EntityI {
val foo: Int
}
}
Now I also want to generate the following companion object:
companion object : ModelCompanion<MyModel, EntityI>
I can create the companion object using SyntheticResolveExtension.getSyntheticCompanionObjectNameIfNeeded
, however inside addSyntheticSupertypes
for the companion object I cannot add the supertype, because EntityI
is not yet resolvable as a descriptor (trying to do so will report a recursion, which does make sense).
I understand I need to somehow create a lazy KotlinType (which seems to exist), but I have no idea how I would create it with what I have available in addSyntheticSupertypes
.
Any advice?shikasd
11/10/2020, 1:34 AMdiesieben07
11/12/2020, 11:19 AMMiguel Vera Belmonte
03/05/2021, 1:39 AMoverride fun addSyntheticSupertypes(thisDescriptor: ClassDescriptor, supertypes: MutableList<KotlinType>) {
val classDescriptor = thisDescriptor.module
.findClassAcrossModuleDependencies(ClassId(FqName("<package>"), Name.identifier("<className>")))
}