ralf
05/20/2020, 3:42 AMPackageFragmentProviderExtension
? I’m always looking at the Android Synthetic implementation, but it’s quite complicated.
My goal is only to generate a new top level property without a setter in a new package. I see good examples how to generate the property here: https://github.com/JetBrains/kotlin/blob/5636227857545fb11ae2790fca55934b0f88a468/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/res/syntheticDescriptorGeneration.kt Only the PackageFragmentProvider code is extremely confusing.rnett
05/21/2020, 11:32 PMfun test(x: @Watched Int)
--> fun test(x$watch: Watcher<Int>){ var x by x$watch ...
This is easy enough on the IR side, but I get "Can't assign to a var" errors, and when I suppress them, Not a variable: value-parameter x: @com.rnett.klairvoyant.Watched <http://kotlin.Int|kotlin.Int>
errors from org.jetbrains.kotlin.psi2ir
classes. Is there a way to intercept this phase or another way around this? I'm trying to avoid editing the PSI because it looks like a pain after looking at arrow-meta.Johann Beleites
05/22/2020, 8:36 AMPHondogo
05/22/2020, 9:49 AMclass CliProcessor : CommandLineProcessor {
override val pluginId = "my.test"
override val pluginOptions: Collection<AbstractCliOption> = listOf(
CliOption(
"myTest",
"<1|2>",
"Test option"
)
)
override fun processOption(option: AbstractCliOption, value: String, configuration: CompilerConfiguration) {
super.processOption(option, value, configuration)
// DO smth
}
}
How can I pass my option from command line?
I'm passing it this way
private fun setKotlinCompilerArgs(options: KotlinCommonOptions) {
options.freeCompilerArgs += "-myTest=1"
}
I've tried several variants: --myTest=1, myTest=1, myTest:1, -myTest:1
But every time got error:
e: Invalid argument: -myTest=1
Please help me to find out right way.mp
05/27/2020, 2:02 AMFrame.merge()
.Rachel
05/29/2020, 11:53 AM1.4-M3
? It seems it solves the issue with the backend IR which is broken since 1.3.7x: https://youtrack.jetbrains.com/issue/KT-37482 Thanks in advance!russhwolf
06/02/2020, 4:50 PMIrGenerationExtension
in there runs fine on JVM and native, when I add a AnalysisHandlerExtension
it's only being run on JVM.Daniel Svensson
06/05/2020, 6:37 PMfoo.let(Bar::method)
vs foo.let { Bar.method(it) }
in terms of compiler speed, thinking that the function reference opens up to fewer possibilities compared to a block, and it could have a slight, but measurable compilation speedup if used a lot. Generating a 1000 long file with identical .let { .. }
and another file with .let(func::ref)
resulted in .let { ... }
being consistently slightly faster with 7.125 seconds vs 7.882 seconds. One hypothesis is that the function reference version is transformed to the block version during compilation, perhaps someone here knows more of the compiler internals to pitch in on that. As expected identical byte code is generated in both cases. When I then tried with Kotlin 1.4 M2, it turned out that the .let { ... }
version had become slower, and has now consistently the exact same compilation speed as the function reference. Which is the reason to why I signed up to this slack 🙂 Was hoping for the opposite as 1.4 is touted to improve compilation speed (but it's not like it's life or death which style is preferred 🙂 ).Daren Klamer
06/08/2020, 2:06 AMkotlinc
command.dephinera
06/09/2020, 7:15 PMAhmed Mourad
06/12/2020, 2:11 PMRohan Maity
06/15/2020, 3:12 AMkotlinc
fails . Is there any way to bypass that failure ?
Any way I can tweak kotlinc
to turn off the failure ?Ahmed Mourad
06/15/2020, 6:09 PMpublic
to lower values.
So, I created this a synthetic resolver with this method:
override fun generateSyntheticMethods(
thisDescriptor: ClassDescriptor,
name: Name,
bindingContext: BindingContext,
fromSupertypes: List<SimpleFunctionDescriptor>,
result: MutableCollection<SimpleFunctionDescriptor>
) {
/* ... */
result.elementAt(methodIndex).let { descriptor ->
val replacement = descriptor.createCustomCopy {
it.newCopyBuilder().setVisibility(newVisibility)
}
result.remove(descriptor)
result.add(replacement)
}
}
This works for if newVisibility
is private
and protected
but does not work if it's internal
and gives this error:
Exception in thread "main" java.lang.NoSuchMethodError: dev.ahmedmourad.sample.SomeClass.functionName$ModuleName(Ljava/lang/String;)Ldev/ahmedmourad/sample/SomeClass;
at dev.ahmedmourad.sample.MainKt.main(Main.kt:25)
at dev.ahmedmourad.sample.MainKt.main(Main.kt)
I know that the internal
modifier doesn't exist in the JVM and that synthetic methods are used to simulate it, so I guess I need to create a synthetic method whenever I change access to internal
, how and where do I do that?Daren Klamer
06/17/2020, 12:49 PMturansky
06/25/2020, 12:54 AM@Suppress
for IrTypeOperatorCall
by compiler plugin?
external interface INode
// before
val isNode = i is INode
// after
val isNode = @Suppress(
"UNCHECKED_CAST_TO_EXTERNAL_INTERFACE",
"USELESS_IS_CHECK"
) i is INode
Fudge
06/26/2020, 12:21 PMKtElement
using the kotlin compiler api? When I try to access `getReference()`/`getReferences()` all I get is null / empty list. I'm assuming there's some extra configuration I need to do, because calls to resolve references go through this call:
ServiceManager.getService(KotlinReferenceProvidersService::class.java) ?: NO_REFERENCES_SERVICE
And the left hand side is always null.bloder
06/30/2020, 3:52 AMRetryWithAdditionalRoots
but it rewinds only one time, I've already tried build these retry returning with different additional files but still repeating only one time, is this expected by Kotlin compiler? Is there a way that I can retry multiple times?Daren Klamer
07/07/2020, 10:36 AMDaren Klamer
07/07/2020, 11:09 AMPHondogo
07/09/2020, 1:37 PMshikasd
07/09/2020, 2:19 PMBindingContext
with custom slices as a source of such information, but it was mostly relying on certain descriptors being in place.
As I see, I still can do same kind of manipulations with them, but as they are deprecated, is there any other means achieve similar results?PHondogo
07/10/2020, 8:54 PMPHondogo
07/11/2020, 7:59 PMgroostav
07/11/2020, 10:50 PM... double1, double2, double3, arrayRefwhere double1..3 are primative double types, and arrayRef is a DoubleArray. I want to put these doubles into the array.
DASTORE
expects
arrayRef, index, value.Problem is, i cant swap double3 and arrayRef. double3 is a category2, and arrayRef is a category 1. There is no DUP bytecode for this swap where the stack has got a category 1 type on top, and a category 2 type below. kotlinc (and javac) are both smart enough to know the array will need to be created before pushing these values to the stack, so they push their array on the stack and then pus the values to store into that array on stack. Smart. Can i really not do this without a local variable? Am I missing something?
ralf
07/12/2020, 12:09 AMturansky
07/12/2020, 8:43 PMIrClass
(companion object) to IrExpression
or IrValueSymbol
?jdemeulenaere
07/14/2020, 2:04 PMkotlin-scripting-jvm-host
from the 1.4-M3 source but the ./gradlew :kotlin-stdlib:compileKotlin
task fails. I'm on a clean branch with tag build-1.4-M3-release-207
(the one that was apparently used to compile the compiler jar available at the bottom of https://github.com/JetBrains/kotlin/releases/tag/v1.3.72) . It fails with the error below. Any idea what's going on?
> Task :kotlin-annotations-jvm:processResources NO-SOURCE
> Task :kotlin-annotations-jvm:classes
> Task :kotlin-annotations-jvm:inspectClassesForKotlinIC
> Task :kotlin-annotations-jvm:jar
> Task :prepare:build.version:writeStdlibVersion UP-TO-DATE
> Task :kotlin-stdlib-common:compileKotlinCommon UP-TO-DATE
> Task :kotlin-stdlib-common:processResources NO-SOURCE
> Task :kotlin-stdlib-common:classes UP-TO-DATE
> Task :kotlin-stdlib-common:inspectClassesForKotlinIC UP-TO-DATE
> Task :kotlin-stdlib-common:jar UP-TO-DATE
> Task :kotlin-stdlib:compileKotlin
e: /usr/local/google/code/kotlin/libraries/stdlib/jvm/src/kotlin/reflect/TypesJVM.kt: (98, 9): 'getTypeName' hides member of supertype 'Type' and needs 'override' modifier
e: /usr/local/google/code/kotlin/libraries/stdlib/jvm/src/kotlin/reflect/TypesJVM.kt: (102, 9): Class 'TypeVariableImpl' is not abstract and does not implement abstract member public abstract fun <T : Annotation!> getAnnotation(p0: Class<T!>!): T! defined in java.lang.reflect.TypeVariable
> Task :kotlin-stdlib:compileKotlin FAILED
Build time for tasks:
Compiling kotlin: 52.33s (90.48% of total time)
Uncategorized: 4.89s (8.46% of total time)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':kotlin-stdlib:compileKotlin'.
shikasd
07/16/2020, 12:54 AMA
in my module and I used IrPluginContext.referenceClass(FqName("A"))
in my extension, I get the following exception (in thread):Jan Skrasek
07/16/2020, 8:28 AMdiego-gomez-olvera
07/22/2020, 12:18 PMERROR
, would it be possible to do it simultaneously? Class B complains about the usage of Adiego-gomez-olvera
07/22/2020, 12:18 PMERROR
, would it be possible to do it simultaneously? Class B complains about the usage of AMarc Knaup
07/26/2020, 5:43 PM@Suppress("DEPRECATION_ERROR")
on B
diego-gomez-olvera
07/27/2020, 10:33 AM