https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
jvm-ir-backend-feedback
  • p

    Paul Griffith

    02/04/2021, 6:23 PM
    I'm getting a different IR generation error with kotlinx-serialization & 1.4.30:
    Caused by: java.lang.IllegalStateException: No mapping for symbol: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:io.inductiveautomation.devbot.slack.model.IncomingView.StateHolder
    (starting a thread)
    ✔️ 1
    i
    • 2
    • 4
  • j

    Joe

    02/04/2021, 7:01 PM
    pretty minor difference, but failing one of our unit tests with new IR: we have a test that expects a failure containing the string
    EasyMock.anyObject() must not be null
    when using EasyMock to pass an expectation to a mock of a method expecting a non-nullable parameter. Using the new IR, the string is just
    anyObject() must not be null
    . Is this expected?
    :youtrack: 1
    i
    • 2
    • 5
  • e

    eygraber

    02/04/2021, 7:46 PM
    I updated my project to use Kotlin 1.4.30 and enabled
    kotlinOptions.useIR
    . I'm getting a bunch of errors when doing a clean build. Should I post those here as messages or create YouTracks issue for them?
    :youtrack: 1
    i
    • 2
    • 1
  • b

    Big Chungus

    02/06/2021, 6:49 PM
    Should I expect a *.klib to be generated for JVM after swithing to IR compiler? I've added the flag, but there seems to be no difference in terms of build outputs
    i
    u
    i
    • 4
    • 4
  • r

    ralf

    02/10/2021, 8:19 PM
    We started to test the new backend and see a lot of red due to the Parcelize plugin? Is this a known issue? Happy to file a ticket if none exists (I wanted to double check first).
    e: java.lang.IndexOutOfBoundsException: Empty list doesn't contain element at index 0.
    	at kotlin.collections.EmptyList.get(Collections.kt:36)
    	at kotlin.collections.EmptyList.get(Collections.kt:24)
    	at org.jetbrains.kotlin.backend.common.ir.IrUtilsKt.remapTypeParameters(IrUtils.kt:330)
    	at org.jetbrains.kotlin.backend.common.ir.IrUtilsKt.remapTypeParameters(IrUtils.kt:343)
    	at org.jetbrains.kotlin.backend.common.ir.IrUtilsKt.copyTo$default(IrUtils.kt:121)
    	at org.jetbrains.kotlin.ir.builders.declarations.DeclarationBuildersKt.addFunction(declarationBuilders.kt:188)
    	at org.jetbrains.kotlin.ir.builders.declarations.DeclarationBuildersKt.addFunction$default(declarationBuilders.kt:164)
    	at org.jetbrains.kotlin.parcelize.ir.ParcelizeIrTransformer.addOverride(ParcelizeIrTransformer.kt:279)
    	at org.jetbrains.kotlin.parcelize.ir.ParcelizeIrTransformer.visitClass(ParcelizeIrTransformer.kt:115)
    i
    u
    e
    • 4
    • 5
  • e

    elihart

    02/11/2021, 6:05 PM
    I’ve also just tried the IR backend on our code base (with 1.4.30) and ran into a different IndexOutOfBoundsException that doesn’t seem related to parcelize like the one above
    IndexOutOfBoundsException: chars sequence.length:3389, start:1313, end:4337
    u
    • 2
    • 6
  • e

    elihart

    02/12/2021, 5:23 PM
    While I couldn’t compile our entire project with the ir backend (due to the crash above ^), I was able to compile a decent chunk of it and profiled the build with the gradle profiler. The ir backend seemed to give a solid 10% overall build speed improvement compared to vanilla 1.4.30. I hadn’t seen any mention of build speed improvements for android/jvm from the ir backend yet, so this was a pleasant surprise.
    🎉 1
    u
    • 2
    • 3
  • j

    Jilles van Gurp

    02/13/2021, 11:50 AM
    > Task :compileKotlin FAILED
    e: java.lang.AssertionError: Unbound symbols not allowed
    
    Unbound private symbol org.jetbrains.kotlin.ir.symbols.impl.IrClassSymbolImpl@2d1fdc09 (NON-PUBLIC API)
            at org.jetbrains.kotlin.ir.util.SymbolTableKt.noUnboundLeft(SymbolTable.kt:1119)
            at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:89)
            at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:106)
            at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
            at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:595)
            at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:211)
            at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:154)
            at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:169)
            at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
            at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88)
            at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
            at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
            at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:386)
            at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:110)
            at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:286)
            at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl$rebuild(IncrementalCompilerRunner.kt:99)
            at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:114)
            at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:74)
            at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:607)
            at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:96)
            at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1659)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.base/java.lang.reflect.Method.invoke(Method.java:564)
            at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
            at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
            at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
            at java.base/java.security.AccessController.doPrivileged(AccessController.java:691)
            at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
            at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
            at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
            at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
            at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
            at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
            at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
            at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
            at java.base/java.lang.Thread.run(Thread.java:832)
    i
    v
    p
    • 4
    • 13
  • c

    christophsturm

    02/23/2021, 10:38 PM
    if I compile a library with the IR backend, can non IR projects use that library?
    :yes: 1
    z
    c
    • 3
    • 6
  • k

    karenkovigor

    02/25/2021, 8:59 PM
    Hello everyone! I have problem with new IR which expected to be fixed in kotlin 1.4.30 but I reproduced it and find out the reason of this exception https://youtrack.jetbrains.com/issue/KT-42021#focus=Comments-27-4720921.0-0 I don't know why, but in kotlin 1.4.20 I could pass not suspend function reference to function that accepts only suspend functions
    👀 1
    • 1
    • 1
  • j

    jaran

    02/26/2021, 8:46 AM
    Hi there. For testing the new IR compiler backend the documentation says to add the following block to the Gradle build file:
    compileKotlin {
        kotlinOptions.useIR = true
    }
    this gives a build error for Android projects. If I add the following under
    android
    in my
    build.gradle
    file it seems to work. Am I correct?
    kotlinOptions {
        useIR = true
    }
    k
    i
    • 3
    • 4
  • e

    Emmanuel Chavane

    02/26/2021, 2:09 PM
    Hello, just tried the new backend 1.4.31 on my project => build failed. Below the stack trace and attaching the source file on which it seems to have crashed. I do not have a simple way to reproduce available.
    [ERROR] org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
    File being compiled: /Users/emmanuel/Documents/code/janngo/janngoship/src/main/kotlin/com/janngo/jpay/repo/sec/JpayUserRepo.kt
    The root cause java.lang.IndexOutOfBoundsException was thrown at: com.intellij.util.text.CharSequenceSubSequence.<init>(CharSequenceSubSequence.java:20)
    at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:239)
    at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException$default(CodegenUtil.kt:235)
    at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invoke(PhaseBuilders.kt:124)
    at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invoke(PhaseBuilders.kt:112)
    at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:94)
    at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:30)
    at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:94)
    at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.invokeToplevel(CompilerPhase.kt:41)
    at org.jetbrains.kotlin.backend.jvm.JvmLower.lower(JvmLower.kt:407)
    at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.doGenerateFilesInternal$backend_jvm(JvmIrCodegenFactory.kt:147)
    at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:120)
    at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:595)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:211)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:154)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:169)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
    at org.jetbrains.kotlin.maven.KotlinCompileMojoBase.execCompiler(KotlinCompileMojoBase.java:228)
    at org.jetbrains.kotlin.maven.K2JVMCompileMojo.execCompiler(K2JVMCompileMojo.java:237)
    at org.jetbrains.kotlin.maven.K2JVMCompileMojo.execCompiler(K2JVMCompileMojo.java:55)
    at org.jetbrains.kotlin.maven.KotlinCompileMojoBase.execute(KotlinCompileMojoBase.java:209)
    at org.jetbrains.kotlin.maven.K2JVMCompileMojo.execute(K2JVMCompileMojo.java:222)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:50)
    Caused by: java.lang.IndexOutOfBoundsException: chars sequence.length:1831, start:1917, end:1922
    at com.intellij.util.text.CharSequenceSubSequence.<init>(CharSequenceSubSequence.java:20)
    at com.intellij.util.text.ImmutableText.subSequence(ImmutableText.java:194)
    at org.jetbrains.kotlin.backend.jvm.lower.TypeOperatorLowering.visitTypeOperator(TypeOperatorLowering.kt:155)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitTypeOperator(IrElementTransformerVoid.kt:245)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitTypeOperator(IrElementTransformerVoid.kt:24)
    at org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl.accept(IrTypeOperatorCallImpl.kt:40)
    at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:33)
    at org.jetbrains.kotlin.ir.expressions.IrExpressionBody.transformChildren(IrBody.kt:46)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBody(IrElementTransformerVoid.kt:108)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpressionBody(IrElementTransformerVoid.kt:114)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpressionBody(IrElementTransformerVoid.kt:115)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitExpressionBody(IrElementTransformerVoid.kt:24)
    at org.jetbrains.kotlin.ir.expressions.IrExpressionBody.accept(IrBody.kt:36)
    at org.jetbrains.kotlin.ir.expressions.IrExpressionBody.transform(IrBody.kt:39)
    at org.jetbrains.kotlin.ir.declarations.IrValueParameter.transformChildren(IrValueParameter.kt:55)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:57)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitValueParameter(IrElementTransformerVoid.kt:98)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitValueParameter(IrElementTransformerVoid.kt:99)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitValueParameter(IrElementTransformerVoid.kt:24)
    at org.jetbrains.kotlin.ir.declarations.IrValueParameter.transform(IrValueParameter.kt:48)
    at org.jetbrains.kotlin.ir.declarations.IrValueParameter.transform(IrValueParameter.kt:27)
    at org.jetbrains.kotlin.ir.util.TransformKt.transformIfNeeded(transform.kt:107)
    at org.jetbrains.kotlin.ir.declarations.IrFunction.transformChildren(IrFunction.kt:69)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:57)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunction(IrElementTransformerVoid.kt:69)
    at org.jetbrains.kotlin.backend.common.lower.IrBuildingTransformer.visitFunction(LowerUtils.kt:143)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:72)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:73)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:24)
    at org.jetbrains.kotlin.ir.declarations.IrSimpleFunction.accept(IrSimpleFunction.kt:28)
    at org.jetbrains.kotlin.ir.IrElement$DefaultImpls.transform(IrElement.kt:32)
    at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:19)
    at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:35)
    at org.jetbrains.kotlin.ir.declarations.IrClass.transformChildren(IrClass.kt:66)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:57)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitClass(IrElementTransformerVoid.kt:66)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitClass(IrElementTransformerVoid.kt:67)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitClass(IrElementTransformerVoid.kt:24)
    at org.jetbrains.kotlin.ir.declarations.IrClass.accept(IrClass.kt:55)
    at org.jetbrains.kotlin.ir.IrElement$DefaultImpls.transform(IrElement.kt:32)
    at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:19)
    at org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl.transformChildren(IrFileImpl.kt:71)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:330)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.transformChildrenVoid(IrElementTransformerVoid.kt:325)
    at org.jetbrains.kotlin.backend.jvm.lower.TypeOperatorLowering.lower(TypeOperatorLowering.kt:52)
    at org.jetbrains.kotlin.backend.common.phaser.FileLoweringPhaseAdapter.invoke(PhaseBuilders.kt:155)
    at org.jetbrains.kotlin.backend.common.phaser.FileLoweringPhaseAdapter.invoke(PhaseBuilders.kt:151)
    at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:94)
    at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invoke(PhaseBuilders.kt:121)
    ... 51 more
    JpayUserRepo.kt
    👀 1
    c
    • 2
    • 2
  • c

    Chris Grigg

    02/26/2021, 10:20 PM
    Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't inline method call 'viewModel' into
    @androidx.compose.runtime.Composable public fun Header(onExitSession: () -> kotlin.Unit, `$composer`: androidx.compose.runtime.Composer?, `$changed`: <http://kotlin.Int|kotlin.Int>): kotlin.Unit defined in com.proteus.proteuskiosk.presentation.trainingsession.ui
    <no source>
    Cause: viewModel (Ljava/lang/String;Landroidx/lifecycle/ViewModelProvider$Factory;Landroidx/compose/runtime/Composer;II)Landroidx/lifecycle/ViewModel;:
    👍 1
    • 1
    • 3
  • d

    dinomite

    03/01/2021, 1:30 PM
    The IR backend appears to have changed the way constructors are generated. This test works under the old backend, but with the IR backend Jackson is unable to find the
    @JsonCreator
    -annotated constructor https://github.com/FasterXML/jackson-module-kotlin/blob/kotlin-jvm-ir-backend/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/Github145.kt#L33
    Untitled
    i
    • 2
    • 4
  • m

    muliyul

    03/01/2021, 3:19 PM
    Hi. My project won't compile on IR:
    e: java.lang.RuntimeException: TypeAliasDescriptor expected: class BusinessId (not found): KtBinaryExpression:
    notification.businessId ?: NO_BUSINESS
    notification.businessId
    is of type
    String
    aliased as
    BusinessId
    .
    u
    • 2
    • 1
  • g

    Grantas33

    03/03/2021, 11:22 PM
    hello, this might be a dumb question, but when compiling project with IR, do all of the libs have to be compiled with IR aswell?
    z
    • 2
    • 1
  • r

    robfletcher

    03/04/2021, 12:31 AM
    I’m seeing an error relating to
    kotlin.Result
    when I enable IR. No other changes. [This line of code](https://github.com/robfletcher/strikt/blob/main/strikt-core/src/main/kotlin/strikt/assertions/Result.kt#L17) starts throwing
    java.lang.ClassCastException: class kotlin.Result$Failure cannot be cast to class kotlin.Result (kotlin.Result$Failure and kotlin.Result are in unnamed module of loader 'app')
    i
    • 2
    • 4
  • g

    gbaldeck

    03/06/2021, 7:28 PM
    I am getting the below error very regularly when I build in IntelliJ with Kotlin 1.4.31 and Compose for desktop 0.4.0-build171. The only way I have found to fix it is to do a gradle clean and build. Is there a way I can get it to go away permanently? It seems to happen only when I edit my composable functions.
    u
    • 2
    • 4
  • a

    Agi Maulana

    03/08/2021, 5:16 AM
    Hello, everyone! My app got an error and the app is an Android app, but I think this is the right channel for this topic. As long as I remember, the last thing I've done that might be contributing to this error is enabling the IR compiler on the Android Studio by the following line
    kotlinOptions.useIR = true
    The view model has a LiveData that hold Kotlin's Result class
    fun doSomething(code: String, price: Long)  {
            repository.doX(code, price)
                    .doOnComplete { _priceSubmission.postValue(Result.success(true)) }
                    .doOnError { _priceSubmission.postValue(Result.failure(it.cause ?: it)) }
                    .fromIo2Ui()
                    .subscribe()
                    .disposeOnCleared()
    }
    and the activity observing it by
    viewModel.priceSubmission.observe(this) { result ->
                if (result.isSuccess) {
                    setResult(RESULT_OK)
                    finish()
                } else {
                    val error = result.exceptionOrNull()
                    if (error is HttpException && error.code() == 400) {
                        showDialog()
                    } else {
                        ToastUtils.showNetworkFailureToast()
                    }
                }
            }
    I got an error on runtime
    java.lang.VerifyError: Bad type on operand stack
    Exception Details:
      Location:
        com/app/package/ui/MyActivity$onCreate$1.onChanged(Lkotlin/Result;)V @31: invokevirtual
      Reason:
        Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 'kotlin/Result'
      Current Frame:
        bci: @31
        flags: { }
        locals: { 'com/app/package/ui/MyActivity$onCreate$1', 'kotlin/Result' }
        stack: { 'java/lang/Object' }
      Bytecode:
        0x0000000: 2b59 c600 09b6 001c a700 0557 0112 1eb8
        0x0000010: 0024 2b59 c600 09b6 001c a700 0557 01b6
        0x0000020: 001c b800 2899 0015 2ab4 000d 02b6 002e
        0x0000030: 2ab4 000d b600 31a7 004d 2b59 c600 09b6
        0x0000040: 001c a700 0557 0112 1eb8 0024 2b59 c600
        0x0000050: 09b6 001c a700 0557 01b6 001c b800 354d
        0x0000060: 2cc1 0037 9900 1a2c c000 37b6 003b 1101
        0x0000070: 90a0 000d 2ab4 000d b800 3ea7 0009 b200
        0x0000080: 44b6 0047 b1                           
      Stackmap Table:
        same_locals_1_stack_item_frame(@11,Object[#24])
        same_locals_1_stack_item_frame(@13,Object[#5])
        same_locals_1_stack_item_frame(@29,Object[#24])
        same_locals_1_stack_item_frame(@31,Object[#5])
        same_frame(@58)
        same_locals_1_stack_item_frame(@69,Object[#24])
        same_locals_1_stack_item_frame(@71,Object[#5])
        same_locals_1_stack_item_frame(@87,Object[#24])
        same_locals_1_stack_item_frame(@89,Object[#5])
        append_frame(@126,Object[#76])
        chop_frame(@132,1)
    
    
    	at com.app.package.ui.MyActivity.onCreate(MyActivity.kt:36)
    	at android.app.Activity.performCreate(Activity.java:7136)
    	at android.app.Activity.performCreate(Activity.java:7127)
    The 36th line of
    MyActivity
    is the
    priceSubmission
    observer Is this Kotlin's IR backend issue? Thanks.
    i
    • 2
    • 3
  • r

    ralf

    03/15/2021, 1:14 AM
    I was a little surprised to see that the
    useIR
    flag became a no-op with 1.5. Was this intentional? I’m aware that the new IR backend will be the default with 1.5. But I assumed setting it to false will go back to the old backend (rather than using another property). https://github.com/JetBrains/kotlin/blob/1.5.0-M1/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt#L195-L200
    i
    u
    • 3
    • 3
  • r

    Roland Yeghiazaryan

    03/16/2021, 1:36 PM
    When trying out new IR, should we add
    kotlinOptions.useIR = true
    for every module we have? New IR works fine, no issues so far 👌
    e
    • 2
    • 2
  • e

    eygraber

    03/25/2021, 10:33 PM
    https://youtrack.jetbrains.com/issue/KT-45704
    l
    u
    • 3
    • 12
  • r

    ralf

    03/29/2021, 1:58 PM
    Not gonna lie, it’s quite discouraging if bugs reported for the IR backend over a month ago are targeted to be fixed in
    1.5.20
    rather than the
    1.5.0
    release https://youtrack.jetbrains.com/issue/KT-44891
    i
    e
    +2
    • 5
    • 6
  • w

    wasyl

    03/29/2021, 3:51 PM
    Is JVM IR on by default in 1.5.0-M2?
    r
    • 2
    • 1
  • i

    ivan.savytskyi

    03/29/2021, 4:13 PM
    With new backend IR, should kotlinx serialization library be updated to specific version? Getting this crash when run build with IR enabled (Kotlin 1.4.31, Kotlinx serialization 1.0.1)
    w
    r
    l
    • 4
    • 8
  • s

    Steffen Funke

    04/01/2021, 2:29 PM
    Hello, just ran a quick benchmark on a Android Project, Kotlin 1.4.30, and it seems
    useIR
    does slow down the build a bit:
    useIR: false, clean & rebuild:
    1. 41s
    2. 41s
    3. 40s
    
    useIR: true, clean & rebuild:
    1. 44s
    2. 43s
    3. 43s
    Granted, it is only marginal slower since it is also only a relatively small project (single module) - but will it affect larger projects proportionally? Out of curiosity I also tried with
    compose: true
    and was rather disappointed:
    useIR: true, compose: true, clean & rebuild:
    1. 53s
    2. 52s
    3. 52s
    I honestly expected the new Backend to be if anything, then faster than the existing one?
    👍 1
    l
    • 2
    • 1
  • c

    Colton Idle

    04/02/2021, 7:58 PM
    I'm trying to test a fix in 1.5.0 m2 to see if this fixes an issue with IR compiler BUT I can't seem to run it because I use hilt in this project. I just added hilt last week. Hope I don't have to revert it. Searching in kotlinlang slack and on google hasn't gotten me any promising results. Am I missing something simple to just enable hilt working with 1.5+?
    z
    • 2
    • 5
  • h

    hho

    04/07/2021, 10:24 PM
    Not sure if it's a bug in the new backend or in MockK, but it sure is a difference in behavior: This test fails with the new backend and works with the old one.
    :tnx: 1
    • 1
    • 1
  • m

    marios proto

    04/21/2021, 10:43 AM
    We are having a failure on our CI, running UI tests, only after enabling the useIR option in our :android: project. The failure is about a custom rule failing with this
    protected val activity: T by lazy {
    activityRule.activity
    } must not be null
    This is happening somehow else. also, if it helps,
    @JvmField
    @Rule
    var activityRule: SomeActivityTestRule<out T> =
    i
    • 2
    • 1
  • z

    Zac Sweers

    05/06/2021, 12:56 AM
    I’ve been working on a compiler plugin that hooks in via
    AnalysisHandlerExtension
    , it just generates some extra files and nothing too complicated. It works fine on the old backend, but when IR is enabled it fails somewhere deep in the compiler for reasons that aren’t clear to me. Looking to see if I should file a bug or if there’s something I’m doing wrong using this API.
    Caused by: java.lang.AssertionError: IR backend shouldn't call KotlinTypeMapper.mapType
    Repo is here: https://github.com/ZacSweers/auto-service-kt, stacktrace in thread
    😱 1
    :tnx: 2
    • 1
    • 2
Powered by Linen
Title
z

Zac Sweers

05/06/2021, 12:56 AM
I’ve been working on a compiler plugin that hooks in via
AnalysisHandlerExtension
, it just generates some extra files and nothing too complicated. It works fine on the old backend, but when IR is enabled it fails somewhere deep in the compiler for reasons that aren’t clear to me. Looking to see if I should file a bug or if there’s something I’m doing wrong using this API.
Caused by: java.lang.AssertionError: IR backend shouldn't call KotlinTypeMapper.mapType
Repo is here: https://github.com/ZacSweers/auto-service-kt, stacktrace in thread
😱 1
:tnx: 2
e: org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during file facade code generation
File being compiled: file:///Users/zacsweers/dev/kotlin/personal/redacted-compiler-plugin/redacted-compiler-plugin/src/main/kotlin/dev/zacsweers/redacted/compiler/RedactedCodegenExtension.kt
The root cause java.lang.AssertionError was thrown at: org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.kt:271)
        at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:239)
        at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:78)
        at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:77)
        at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generateModule(CodegenFactory.kt:62)
        at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
        at dev.zacsweers.autoservice.compiler.AutoServiceAnalysisHandlerExtension.analysisCompleted(AutoServiceAnalysisHandlerExtension.kt:68)
        at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$invokeExtensionsOnAnalysisComplete(TopDownAnalyzerFacadeForJVM.kt:111)
        at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:128)
        at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:85)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:514)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:505)
        at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:112)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:505)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:189)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:155)
        at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:169)
        at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
        at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:386)
        at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:110)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:303)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl$rebuild(IncrementalCompilerRunner.kt:99)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:124)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:74)
        at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:607)
        at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:96)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1659)
        at jdk.internal.reflect.GeneratedMethodAccessor101.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.AssertionError: IR backend shouldn't call KotlinTypeMapper.mapType: RedactedCodegenExtension
        at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.kt:271)
        at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapClass(KotlinTypeMapper.kt:232)
        at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:300)
        at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:289)
        at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateClassesAndObjectsInFile(PackageCodegenImpl.java:119)
        at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateFile(PackageCodegenImpl.java:138)
        at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:70)
        ... 43 more
Just went ahead and filed anyway https://youtrack.jetbrains.com/issue/KT-46494
👍 1
View count: 6