Skip to content
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

Kotlin/Native can't use T::class in inline function of @Composable for iOS #3147

Closed
eymar opened this issue May 10, 2023 · 10 comments · Fixed by JetBrains/compose-multiplatform-core#1287 or #4652
Assignees
Labels
bug Something isn't working compiler Compiler plugin related ios

Comments

@eymar
Copy link
Collaborator

eymar commented May 10, 2023

Describe the bug

Affected platforms
Select one of the platforms below:

  • iOS

Versions

  • Kotlin version*: 1.8.20
  • Compose Multiplatform version*: 1.4.0

To Reproduce

@Composable
inline fun <reified T : ViewModel> getViewModel(
    key: Any,
    noinline viewModelBlock: () -> T
): T = getViewModel(key, T::class, viewModelBlock)
@eymar eymar added bug Something isn't working compiler Compiler plugin related ios labels May 10, 2023
@eymar eymar self-assigned this May 10, 2023
@ryanmitchener
Copy link
Contributor

This is also affecting me with Kotlin 1.9.0 and Compose multiplatform 1.5.0. This was a difficult bug to track down as the offending code was contained in a KMP library. It would be great if this could be resolved in the near future!

@hoc081098
Copy link

I have the same issue

@OptIn(ExperimentalObjCRefinement::class)
@HiddenFromObjC
inline fun <reified T : Route> routeContent(
  noinline content: @Composable (route: T) -> Unit,
): RouteContent<T> =
  object : RouteContent<T> {
    override val id: RouteContent.Id<T> = RouteContent.Id(T::class)

    @Composable
    override fun Content(route: T) = content(route)
  }

@ryanmitchener
Copy link
Contributor

@hoc081098 I was able to work around the issue by making a helper function that was not composable. It may or may not work in your situation.

@Composable
inline fun <reified T : Any> doSomething() =
    doSomethingWithReifiedType(getKClassForGenericType<T>())

@Composable
inline fun <reified T : Any> doSomethingWithReifiedType(clazz: KClass<T>) {
    // Do something
}

// Helper to get around @Composable inlined reified types
inline fun <reified T : Any> getKClassForGenericType(): KClass<T> = T::class

@hoc081098
Copy link

@hoc081098 I was able to work around the issue by making a helper function that was not composable. It may or may not work in your situation.

@Composable
inline fun <reified T : Any> doSomething() =
    doSomethingWithReifiedType(getKClassForGenericType<T>())

@Composable
inline fun <reified T : Any> doSomethingWithReifiedType(clazz: KClass<T>) {
    // Do something
}

// Helper to get around @Composable inlined reified types
inline fun <reified T : Any> getKClassForGenericType(): KClass<T> = T::class

Thanks, I have just used this way to workaround this issue

hoc081098 added a commit to hoc081098/kmp-viewmodel that referenced this issue Sep 24, 2023
hoc081098 added a commit to hoc081098/kmp-viewmodel that referenced this issue Sep 24, 2023
hoc081098 added a commit to hoc081098/kmp-viewmodel that referenced this issue Sep 24, 2023
@rockiedo
Copy link

rockiedo commented Oct 8, 2023

Hi @eymar, may I know how you found out the root cause? I'm facing the same problem but having no clue when looking at the build errors.

@taetae98coding
Copy link

Hi @ryanmitchener thank you for your comment.

I had same issue. But I solved it with your comment. And now I don't know why it solved can you explain?? 🥲

@ryanmitchener
Copy link
Contributor

@taetae98coding As far as I understand it, the only limitation is that you can't use T::class in a @Composable inline function. The workaround makes a separate function that is inline but not @Composable. The compiler does not have an issue with that. From there, you can use that function in any @Composable function.

@taetae98coding
Copy link

@ryanmitchener thank you!

hoc081098 added a commit to hoc081098/solivagant that referenced this issue Feb 25, 2024
@fbarthelery
Copy link
Contributor

I got the same issue on Kotlin/web

Affected platforms

  • Web (K/JS)

Versions

  • Kotlin version: 1.9.22
  • Compose Multiplatform version: 1.6.0

To Reproduce

inline fun <reified VM: Any> viewModel(): VM {
    return VM::class as VM
}

Stacktrace

e: java.lang.IllegalStateException: Symbol for [ compose.viewmodel/viewModel|viewModel(compose.viewmodel.ViewModelStoreOwner;kotlin.String?){0§<kotlin.Any>}[0] <- Local[<TP>,0|TYPE_PARAMETER name:VM index:0 variance: superTypes:[kotlin.Any] reified:true] ] is unbound
	at org.jetbrains.kotlin.ir.symbols.impl.IrBindablePublicSymbolBase.getOwner(IrPublicSymbolBase.kt:63)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartiallyLinkedIrTreePatcher$ExpressionTransformer.checkReferencedDeclaration(PartiallyLinkedIrTreePatcher.kt:585)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartiallyLinkedIrTreePatcher$ExpressionTransformer.checkReferencedDeclaration$default(PartiallyLinkedIrTreePatcher.kt:574)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartiallyLinkedIrTreePatcher$ExpressionTransformer.visitClassReference(PartiallyLinkedIrTreePatcher.kt:492)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitClassReference(IrElementTransformerVoid.kt:254)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitClassReference(IrElementTransformerVoid.kt:24)
	at org.jetbrains.kotlin.ir.expressions.IrClassReference.accept(IrClassReference.kt:26)
	at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:31)
	at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:22)
	at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:45)
	at org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression.transformChildren(IrMemberAccessExpression.kt:50)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoidKt.transformChildrenVoid(IrElementTransformerVoid.kt:346)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartiallyLinkedIrTreePatcher$ExpressionTransformer.visitCall(PartiallyLinkedIrTreePatcher.kt:1322)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:215)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:24)
	at org.jetbrains.kotlin.ir.expressions.IrCall.accept(IrCall.kt:26)
	at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:31)
	at org.jetbrains.kotlin.ir.declarations.IrVariable.transformChildren(IrVariable.kt:45)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:57)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartiallyLinkedIrTreePatcher$ExpressionTransformer.visitDeclaration(PartiallyLinkedIrTreePatcher.kt:462)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitVariable(IrElementTransformerVoid.kt:101)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitVariable(IrElementTransformerVoid.kt:102)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitVariable(IrElementTransformerVoid.kt:24)
	at org.jetbrains.kotlin.ir.declarations.IrVariable.accept(IrVariable.kt:38)
	at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:24)
	at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:35)
	at org.jetbrains.kotlin.ir.expressions.IrBlockBody.transformChildren(IrBlockBody.kt:32)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBody(IrElementTransformerVoid.kt:108)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:117)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartiallyLinkedIrTreePatcher$ExpressionTransformer.visitBlockBody(PartiallyLinkedIrTreePatcher.kt:467)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:118)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:24)
	at org.jetbrains.kotlin.ir.expressions.IrBlockBody.accept(IrBlockBody.kt:25)
	at org.jetbrains.kotlin.ir.expressions.IrBody.transform(IrBody.kt:22)
	at org.jetbrains.kotlin.ir.declarations.IrFunction.transformChildren(IrFunction.kt:62)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:57)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartiallyLinkedIrTreePatcher$ExpressionTransformer.visitDeclaration(PartiallyLinkedIrTreePatcher.kt:462)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunction(IrElementTransformerVoid.kt:69)
	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:37)
	at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:24)
	at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:35)
	at org.jetbrains.kotlin.ir.declarations.IrFile.transformChildren(IrFile.kt:41)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitPackageFragment(IrElementTransformerVoid.kt:41)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartiallyLinkedIrTreePatcher$ExpressionTransformer.visitPackageFragment(PartiallyLinkedIrTreePatcher.kt:453)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFile(IrElementTransformerVoid.kt:47)
	at org.jetbrains.kotlin.backend.common.linkage.partial.FileAwareIrElementTransformerVoid.access$visitFile$s-1784493990(PartialLinkageUtils.kt:82)
	at org.jetbrains.kotlin.backend.common.linkage.partial.FileAwareIrElementTransformerVoid$visitFile$1.invoke(PartialLinkageUtils.kt:97)
	at org.jetbrains.kotlin.backend.common.linkage.partial.FileAwareIrElementTransformerVoid$visitFile$1.invoke(PartialLinkageUtils.kt:96)
	at org.jetbrains.kotlin.backend.common.linkage.partial.FileAwareIrElementTransformerVoid.runInFile(PartialLinkageUtils.kt:90)
	at org.jetbrains.kotlin.backend.common.linkage.partial.FileAwareIrElementTransformerVoid.visitFile(PartialLinkageUtils.kt:96)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFile(IrElementTransformerVoid.kt:48)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFile(IrElementTransformerVoid.kt:24)
	at org.jetbrains.kotlin.ir.declarations.IrFile.accept(IrFile.kt:31)
	at org.jetbrains.kotlin.ir.declarations.IrFile.transform(IrFile.kt:34)
	at org.jetbrains.kotlin.ir.declarations.IrFile.transform(IrFile.kt:22)
	at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:35)
	at org.jetbrains.kotlin.ir.declarations.IrModuleFragment.transformChildren(IrModuleFragment.kt:52)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitModuleFragment(IrElementTransformerVoid.kt:33)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitModuleFragment(IrElementTransformerVoid.kt:38)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitModuleFragment(IrElementTransformerVoid.kt:24)
	at org.jetbrains.kotlin.ir.declarations.IrModuleFragment.accept(IrModuleFragment.kt:42)
	at org.jetbrains.kotlin.ir.declarations.IrModuleFragment.transform(IrModuleFragment.kt:45)
	at org.jetbrains.kotlin.ir.declarations.IrModuleFragment.transform(IrModuleFragment.kt:26)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartiallyLinkedIrTreePatcher.transformVoid(PartiallyLinkedIrTreePatcher.kt:87)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartiallyLinkedIrTreePatcher.patchModuleFragments(PartiallyLinkedIrTreePatcher.kt:68)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartialLinkageSupportForLinkerImpl$generateStubsAndPatchUsages$1.invoke(PartialLinkageSupportForLinkerImpl.kt:62)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartialLinkageSupportForLinkerImpl$generateStubsAndPatchUsages$1.invoke(PartialLinkageSupportForLinkerImpl.kt:62)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartialLinkageSupportForLinkerImpl.generateStubsAndPatchUsagesInternal(PartialLinkageSupportForLinkerImpl.kt:80)
	at org.jetbrains.kotlin.backend.common.linkage.partial.PartialLinkageSupportForLinkerImpl.generateStubsAndPatchUsages(PartialLinkageSupportForLinkerImpl.kt:62)
	at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.postProcess(KotlinIrLinker.kt:231)
	at org.jetbrains.kotlin.ir.backend.js.KlibKt.getIrModuleInfoForKlib(klib.kt:305)
	at org.jetbrains.kotlin.ir.backend.js.KlibKt.loadIr(klib.kt:242)
	at org.jetbrains.kotlin.ir.backend.js.CompilerKt.compile(compiler.kt:54)
	at org.jetbrains.kotlin.ir.backend.js.CompilerKt.compile$default(compiler.kt:39)
	at org.jetbrains.kotlin.cli.js.K2JsIrCompiler$Ir2JsTransformer.lowerIr(K2JsIrCompiler.kt:103)
	at org.jetbrains.kotlin.cli.js.K2JsIrCompiler$Ir2JsTransformer.makeJsCodeGenerator(K2JsIrCompiler.kt:125)
	at org.jetbrains.kotlin.cli.js.K2JsIrCompiler$Ir2JsTransformer.compileAndTransformIrNew(K2JsIrCompiler.kt:133)
	at org.jetbrains.kotlin.cli.js.K2JsIrCompiler.doExecute(K2JsIrCompiler.kt:391)
	at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:181)
	at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:72)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:104)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:48)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1523)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
	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:712)
	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:399)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

@oblakr24
Copy link

oblakr24 commented Apr 5, 2024

This issue still occurs on Kotlin native when building for iOS, versions:

compose-plugin = "1.6.0"
kotlin = "1.9.22"

The workaround I did is to have a separate non-composable inline function which takes the reified parameter and returns the result (i.e. a string value of the name etc.).

shishkin-pavel added a commit to JetBrains/compose-multiplatform-core that referenced this issue Apr 16, 2024
fixes JetBrains/compose-multiplatform#3147

there is a bug on all platforms related to incorrect
`IrTypeParameterSymbol` remapping during function body transformation

because of `copyWithNewTypeParams` is called on function body directly,
it doesn't accumulate typeparam symbols mapping (located in signature),
which leads to preserving old symbols during body transformation

Test: tested against Compose Multiplatform testsuite

Change-Id: If813824a3387e78910670174bd6aabe7d13e2d43
Signed-off-by: Pavel Shishkin <pavel.shishkin@jetbrains.com>
shishkin-pavel added a commit to JetBrains/compose-multiplatform-core that referenced this issue Apr 18, 2024
fixes JetBrains/compose-multiplatform#3147

there is a bug on all platforms related to incorrect
`IrTypeParameterSymbol` remapping during function body transformation

because of `copyWithNewTypeParams` is called on function body directly,
it doesn't accumulate typeparam symbols mapping (located in signature),
which leads to preserving old symbols during body transformation

Test: tested against Compose Multiplatform testsuite

Change-Id: If813824a3387e78910670174bd6aabe7d13e2d43
Signed-off-by: Pavel Shishkin <pavel.shishkin@jetbrains.com>
MatkovIvan pushed a commit to JetBrains/compose-multiplatform-core that referenced this issue Apr 19, 2024
MatkovIvan added a commit to JetBrains/compose-multiplatform-core that referenced this issue Apr 19, 2024
…)`" (#1290)

This reverts commit dc44b84.

## Proposed Changes

- Since JetBrains/compose-multiplatform#3147
is fixed we can commonize this overload
- Keep internal usages of this as KClass calls to avoid breaking usage
of Compose with old compilers

## Testing

Test: Try to call new API
MatkovIvan pushed a commit that referenced this issue Apr 19, 2024
version bump & test added for reified generic in composable functions

Fixes #3147
copybara-service bot pushed a commit to androidx/androidx that referenced this issue Apr 22, 2024
fixes JetBrains/compose-multiplatform#3147

there is a bug on all platforms related to incorrect
`IrTypeParameterSymbol` remapping during function body transformation

because of `copyWithNewTypeParams` is called on function body directly,
it doesn't accumulate typeparam symbols mapping (located in signature),
which leads to preserving old symbols during body transformation

Test: tested against Compose Multiplatform testsuite

Change-Id: If813824a3387e78910670174bd6aabe7d13e2d43
Signed-off-by: Pavel Shishkin <pavel.shishkin@jetbrains.com>
KotlinBuild pushed a commit to JetBrains/kotlin that referenced this issue Apr 22, 2024
fixes JetBrains/compose-multiplatform#3147

there is a bug on all platforms related to incorrect
`IrTypeParameterSymbol` remapping during function body transformation

because of `copyWithNewTypeParams` is called on function body directly,
it doesn't accumulate typeparam symbols mapping (located in signature),
which leads to preserving old symbols during body transformation

Test: tested against Compose Multiplatform testsuite

Change-Id: If813824a3387e78910670174bd6aabe7d13e2d43 ( https://android-review.googlesource.com/q/If813824a3387e78910670174bd6aabe7d13e2d43 )
Signed-off-by: Pavel Shishkin <pavel.shishkin@jetbrains.com>

Moved from: androidx/androidx@faae2fb
KotlinBuild pushed a commit to JetBrains/kotlin that referenced this issue Apr 22, 2024
fixes JetBrains/compose-multiplatform#3147

there is a bug on all platforms related to incorrect
`IrTypeParameterSymbol` remapping during function body transformation

because of `copyWithNewTypeParams` is called on function body directly,
it doesn't accumulate typeparam symbols mapping (located in signature),
which leads to preserving old symbols during body transformation

Test: tested against Compose Multiplatform testsuite

Change-Id: If813824a3387e78910670174bd6aabe7d13e2d43 ( https://android-review.googlesource.com/q/If813824a3387e78910670174bd6aabe7d13e2d43 )
Signed-off-by: Pavel Shishkin <pavel.shishkin@jetbrains.com>

Moved from: androidx/androidx@faae2fb
KotlinBuild pushed a commit to JetBrains/kotlin that referenced this issue Apr 22, 2024
fixes JetBrains/compose-multiplatform#3147

there is a bug on all platforms related to incorrect
`IrTypeParameterSymbol` remapping during function body transformation

because of `copyWithNewTypeParams` is called on function body directly,
it doesn't accumulate typeparam symbols mapping (located in signature),
which leads to preserving old symbols during body transformation

Test: tested against Compose Multiplatform testsuite

Change-Id: If813824a3387e78910670174bd6aabe7d13e2d43 ( https://android-review.googlesource.com/q/If813824a3387e78910670174bd6aabe7d13e2d43 )
Signed-off-by: Pavel Shishkin <pavel.shishkin@jetbrains.com>

Moved from: androidx/androidx@faae2fb
KotlinBuild pushed a commit to JetBrains/kotlin that referenced this issue Apr 23, 2024
fixes JetBrains/compose-multiplatform#3147

there is a bug on all platforms related to incorrect
`IrTypeParameterSymbol` remapping during function body transformation

because of `copyWithNewTypeParams` is called on function body directly,
it doesn't accumulate typeparam symbols mapping (located in signature),
which leads to preserving old symbols during body transformation

Test: tested against Compose Multiplatform testsuite

Change-Id: If813824a3387e78910670174bd6aabe7d13e2d43 ( https://android-review.googlesource.com/q/If813824a3387e78910670174bd6aabe7d13e2d43 )
Signed-off-by: Pavel Shishkin <pavel.shishkin@jetbrains.com>

Moved from: androidx/androidx@faae2fb
KotlinBuild pushed a commit to JetBrains/kotlin that referenced this issue Apr 23, 2024
fixes JetBrains/compose-multiplatform#3147

there is a bug on all platforms related to incorrect
`IrTypeParameterSymbol` remapping during function body transformation

because of `copyWithNewTypeParams` is called on function body directly,
it doesn't accumulate typeparam symbols mapping (located in signature),
which leads to preserving old symbols during body transformation

Test: tested against Compose Multiplatform testsuite

Change-Id: If813824a3387e78910670174bd6aabe7d13e2d43 ( https://android-review.googlesource.com/q/If813824a3387e78910670174bd6aabe7d13e2d43 )
Signed-off-by: Pavel Shishkin <pavel.shishkin@jetbrains.com>

Moved from: androidx/androidx@faae2fb
shishkin-pavel added a commit to JetBrains/compose-multiplatform-core that referenced this issue Apr 29, 2024
fixes JetBrains/compose-multiplatform#3147

there is a bug on all platforms related to incorrect
`IrTypeParameterSymbol` remapping during function body transformation

because of `copyWithNewTypeParams` is called on function body directly,
it doesn't accumulate typeparam symbols mapping (located in signature),
which leads to preserving old symbols during body transformation

Test: tested against Compose Multiplatform testsuite

Change-Id: If813824a3387e78910670174bd6aabe7d13e2d43
Signed-off-by: Pavel Shishkin <pavel.shishkin@jetbrains.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler Compiler plugin related ios
Projects
None yet
7 participants