-
Notifications
You must be signed in to change notification settings - Fork 1.2k
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception during IR lowering #301
Comments
Please retry with Compose |
I switched to those versions, and I get the same error. I did also verify that they were the correct versions, so yes it is still happening. |
I don't even see any Composable functions in that file you attached and Compose is not on your stack trace. This doesn't preclude Compose from being the source of the problem, but it does mean that the source of the problem isn't obvious. The file you posted isn't too useful because it doesn't even build without the dependencies referenced in that file. Can you create a minimal repro project such that the same error occurs? That will allow us to investigate further. |
Sure - here you are! |
@olonho You were correct in your speculation that it was kotlin-serialization related, removing the kotlin-serialization plugin causes the build to succeed. How confident are we that the Also, how old is the Otherwise, sounds like perhaps this repro should be passed to the Kotlin serialization team? I applied the following diff on top of @ejektaflex repository, got the same error message @ejektaflex did.
|
It's indeed the conflict between compose and kotlinx.serialization — because Compose copies the whole IR tree, serialization plugin gets incorrect accessors for some declarations. In this particular case, the workaround is to remove any |
@sandwwraith I just checked with Where is kotlinx.serialization getting the incorrect accessors from? Is the Compose Compiler doing something wrong here? Intuitively it seems like both plugins get IR in and IR out, as long as the IR is well-formed when it comes out of the plugin, then the other plugin should be able to operate without issue. Is our plugin somehow producing illegal IR? |
Since $serializer is a nested class, and |
Leland mentioned that if it is on the Compose side, the type remapping seems like a possible suspect. Let us know if you find that Compose is somehow to blame. I imagine that as more and more plugins get written, weird compatibility bugs are going to become more common unless there is some sort of validator that plugin authors can run on their output to verify their plugin is producing acceptable code, because it's still not clear who or why is responsible for this crash. Certainly some expectation is violated by one of the plugins. |
Not sure if this is helpful and it's the same root cause with this issue: I encounter the same stack trace crash when I try to refactor a method name or change its parameter type from non-null to nullable, only one special method has this problem. The problem goes away after I execute My project doesn't depend on kotlin serializer but it depends on Compose(Android). LMK if you need more information. versions: |
Currently it is prohibited to use Compose and Serialization at the same module. The WO is to put them to separate ones. |
Are you referring to Gradle modules? If so, does this mean we must separate our project into two parts? |
@ejektaflex |
@ejektaflex please see nice example here- https://github.com/eymar/reproducing-issues/tree/compose-web-with-serialization |
Sorry for posting here; it's the first result that comes up when I search this error, but I got it from a completely different cause. This line causes the error This line fixes it This was with |
@EyeOfMidas do you have the same issue in the plain Kotlin code? Do you have the same issue on Android? |
This is plain Kotlin code. We're writing a backend server using Ktor, so I don't have an Android development environment. You can reproduce it like this: package example
class ExampleError<T> {
suspend fun forEach(block: suspend (T) -> Unit) = listOf<T>().forEach(fun(it:T) { block(it) })
} |
@EyeOfMidas |
Looks like you are trying to use Compose along with Serialization. They couldn't be used in the same module. Try to move either of them to a separate one. Newer versions of Compose would throw an error about it before compilation. |
@akurasov I'm facing the problem too but I'm not using kotlin-serialization, please help me...
|
@Iridescentangle Without a minimal repro, we probably wouldn't be able to make much progress understanding why you are running into an issue. Please post a minimal example project which demonstrates your issue. |
I think it's difficult because I'm intergrating compose into current project , which means I bearly find the way to reproduce this problem😓 I doubt there is something wrong the way I intergrated ,so I tried several times these days in different branches, but got same result. |
If this problem is reproduced without kotlinx-serialization, please use Kotlin's issue tracker: https://youtrack.jetbrains.com/issues/KT |
Typically, I start by reproducing the problem in my project, then start deleting as much stuff as I can until the problem goes away. If deleting something causes the problem to go away, I undo that change (so the problem comes back) and delete something else. Repeat this process until I'm left with the minimal amount of code necessary to reproduce the issue. |
Sounds well , maybe it would take me a long time to do this 😄 because my project is a hodgepodge |
@jimgoog private var confirmPopup : ForwardConfirmPopup? = null
private fun showForwardFavoriteConfirm(conversation:EMConversation?= null,group:EMGroup? = null,contact: UserDataBean?=null) {
if(confirmPopup == null){
confirmPopup = XPopup.Builder(this)
.setPopupCallback(object:SimpleCallback(){
override fun onCreated() {
showConfirmDetail(conversation,group,contact)
}
})
.asCustom(ForwardConfirmPopup(this){conversations,groups,contacts->
confirmPopup!!.dismiss()
showLoading()
viewModel.sendMessage(chooseType,conversations,groups,contacts)
})
.show() as ForwardConfirmPopup
}else{
showConfirmDetail(conversation,group,contact)
confirmPopup!!.show()
}
} |
@jimgoog I have no idea why it causes the exception,because it works well in the past.But if it became a problem ,I have to try other ways to solve this.So these codes look like this below private fun showForwardFavoriteConfirm(conversation:EMConversation?= null,group:EMGroup? = null,contact: UserDataBean?=null) {
if(confirmPopup == null){
confirmPopup = ForwardConfirmPopup(this)
// confirmPopup?.setOnForwardConfirmListener(object:OnForwardConfirmListener{
// override fun onForwardConfirm(
// conversations: MutableSet<EMConversation?>,
// groups: MutableSet<EMGroup?>,
// contacts: MutableSet<UserDataBean?>
// ) {
// confirmPopup!!.dismiss()
// showLoading()
// viewModel.sendMessage(chooseType,conversations,groups,contacts)
// }
// })
confirmPopup = XPopup.Builder(this)
.setPopupCallback(object: SimpleCallback() {
override fun onCreated(popupView: BasePopupView?) {
super.onCreated(popupView)
showConfirmDetail(conversation,group,contact)
}
})
.asCustom(confirmPopup)
.show() as ForwardConfirmPopup
}else{
showConfirmDetail(conversation,group,contact)
confirmPopup!!.show()
}
} |
I'm also facing the same issue & I'm not using any serialization plugin. Any help would be appreciated. |
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
I've been trying to get JetBrains Compose to work with my existing project, but it keeps on giving me this error:
This is with build
0.3.0-build141
and Kotlin1.4.21
.Attached is what
GameRegistry.kt
looks like.GameRegistry.txt
The text was updated successfully, but these errors were encountered: