miha-x64
02/26/2019, 8:15 AMkevinmost
02/27/2019, 9:31 PMMarc Knaup
03/02/2019, 12:24 AMjw
03/06/2019, 6:05 PMraulraja
03/08/2019, 12:45 AMfoo { bar(it) }
has a performance cost over foo(bar)
allocating an extra lambda? If so is this something the Kotlin compiler already optimizes for?mp
03/11/2019, 4:42 PMraulraja
03/31/2019, 10:53 PMswitch
based on ints. Does the kotlin compiler ever optimizes when
to become a fast switch
based on ints? If not what is the equivalent in Kotlin of https://www.scala-lang.org/api/current/scala/annotation/switch.html if any? thanks!louiscad
04/02/2019, 7:46 PMJorge Castillo
04/04/2019, 10:13 AMDefaultErrorMessages
and make them work in the inlined errors from the IDE inspections? Since looks like the errors print with new line chars on terminal if you build the project, but the inlined IDE error inspections don’t seem to show new line chars and show everything on a single line.aerb
04/07/2019, 6:33 PMjlleitschuh
04/12/2019, 6:52 PMorg/junit/jupiter/api/Assertions.assertEquals:(ILjava/lang/Integer;)V
https://github.com/junit-team/junit5/issues/1859Paulius Ruminas
04/15/2019, 8:22 PMinterface Command<T>
class TestUnitCommand : Command<Unit>
class TestIntCommand : Command<Int>
class TestStringCommand : Command<String>
class Result<T>
inline fun <reified T : Command<R>, reified R : Any> execute(crossinline block: suspend (T) -> R) {}
fun main() {
execute<TestUnitCommand, Unit> { Result<Unit>() } // OK
execute<TestIntCommand, Int> { Result<Int>() } // Error
execute<TestStringCommand, String> { Result<String>() } // Error
}
Why does it not error when Command
generic parameter is Unit
? Does it implicitly not return anything?colljos
04/16/2019, 2:07 PM--add-exports java.base/sun.security.x509=UNNAMED-MODULE
.
How does one coax the Kotlin compiler to process/pass this directive?simon.vergauwen
04/23/2019, 8:10 AMimport kotlin.coroutines.Continuation
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.startCoroutine
val f: suspend () -> String = suspend { "Hello World!" }
fun main() {
f.startCoroutine(Continuation(EmptyCoroutineContext, ::println))
}
aerb
05/04/2019, 7:35 PMpardom
05/06/2019, 4:59 AMKtCallExpression
. Anyone know how?pardom
05/08/2019, 4:16 AMmiha-x64
05/15/2019, 8:01 AMprintln
is an inline-function which calls System.out.println
internally.
That's how Kotlin function inlining look like.kralli
06/05/2019, 1:29 PMCompilerConfiguration
using the CompilerConfigurationExtension
in order to get hold of the output directory. You can then write your own files using the BinaryClassWriter
. This way is pretty safe and should be stable across future releases. The second method would be to use either the AnalysisHandlerExtension
or the CollectAdditionalSourcesExtension
to access and modify the list of source files. The list of sources is leaking and can simply be casted into a MutableList
. While this can be pretty useful, it is not recommendable, because this will probably be fixed in the future.pablisco
06/06/2019, 10:21 PMsealed class Location: Serializable {
object Unknown : Location() {
override fun equals(other: Any?) = other is Unknown
override fun hashCode() = toString().hashCode()
override fun toString(): String = "Location.Unknown"
}
data class Known(val lat: Float, val lon: Float) : Location()
}
https://stackoverflow.com/a/56485743/458365raulraja
06/09/2019, 8:43 PMTypeResolutionInterceptorExtension
in the compiler?. I see Jetpack Compose uses that and can’t find that on github.raulraja
06/12/2019, 12:05 PMorg.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
. It does not seem like it’s calling me back so I’m guessing is not using the IR format. Is there a compiler flag or some kind of way to turn IR generation on?. Thanks!Hanno
06/12/2019, 12:43 PMraulraja
06/12/2019, 4:00 PMIrType
for a known type given it’s fully qualified name and type arguments?
I need to refer to a known type that is not in the IrBuiltins
constants.jw
06/13/2019, 3:27 AMraulraja
06/13/2019, 9:11 PMKotlin Bytecode Viewer
actually decompiling binaries or just making a best effort based on the sources presented? I have a compiler plugin injecting stuff in the bytecode that I don’t see in the bytecode viewer. What do people use to debug emitted bytecode when working with compiler plugins? thanks!raulraja
06/13/2019, 11:50 PMSyntheticResolverExtension
I’m overriding generateSyntheticClasses(PackageFragmentDescriptor, ...)
and addSyntheticSupertypes
. I’m attempting to add a super type to a class that I generate myself in that pass.
For example:
package x
interface Foo<A>
class Bar
I want to expand to:
package x
interface Foo<A>
class GeneratedClass
class Bar : Foo<GeneratedClass>
The issue I’m having is that addSyntheticSupertypes
happens before GeneratedClass
has a valid ClasDescriptor
so when I add the supertype I get:
Bar : Foo<[ERROR : Unsubstituted type for <ERROR CLASS>]>
e: java.lang.IllegalStateException: Backend Internal error: Exception during code generation
Cause: Error type encountered: [ERROR : Unsubstituted type for <ERROR CLASS>] (ErrorType).
How can I generate a valid descriptor in that phase for GeneratedClass
or how can I add a supertype to a class given the class the type refers to may not have been generated yet?
Is this the wrong phase to do this kind of work?spierce7
06/17/2019, 5:52 PMraulraja
06/18/2019, 3:16 PMPackageFragmentProviderExtension
and now I’m verifying that all the code is generated properly and I can even import classes and they compile fine from the command line. For example this compiles:
import sample.GeneratedClass
And also this:
Class.forName("sample.GeneratedClass")
I’m still seeing these issues:
1. This compiles fine only in the command line. IDEA still shows redlines for all the types it can’t find. Does IDEA use automatically the PackageFramentDescriptor
and SyntheticResolver
info or am I missing additional setup to get this to work on IDEA?
2. It only compiles fine with import sample.GeneratedClass
if its in the same module. If I add the compilation result with codegen as dependency in a different module it does not compile but shows instead:
sample/test.kt: (3, 21): Unresolved reference: GeneratedClass
Any help is appreciated, thanks!pardom
06/18/2019, 6:48 PMkotlin-compiler
and kotlin-script-util
to evaluate a simple expression like Foo("bar")
and get an instance? Kind of a like a Class.forName
evaluator?pardom
06/18/2019, 6:48 PMkotlin-compiler
and kotlin-script-util
to evaluate a simple expression like Foo("bar")
and get an instance? Kind of a like a Class.forName
evaluator?tschuchort
06/19/2019, 12:03 AM