andreasmattsson
08/13/2019, 7:39 AMOverload Resolution Ambiguity
in the Android app modules of my MPP in cases where the disambiguity appears to only be in "comments" for the resolution of typealiases, see example snippet.
It compiles fine with gradle, however it would be nice to get syntax highlighting and autocomplete etc on these types... Any suggestions for ways to resolve this?louiscad
08/13/2019, 8:01 AMandreasmattsson
08/13/2019, 8:43 AMAndroid Studio 3.4.2
Build #AI-183.6156.11.34.5692245, built on June 27, 2019
JRE: 1.8.0_152-release-1343-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
louiscad
08/13/2019, 8:46 AMandreasmattsson
08/13/2019, 8:48 AMlouiscad
08/13/2019, 8:49 AMandreasmattsson
08/13/2019, 9:02 AMCannot choose among the following candidates without completing type inference:
public fun <T : Any> rxObservableOf(value: Float): RxObservable<Float> defined in se.sdg12.deedster.concurrency.rx
public fun <T : Any> rxObservableOf(value: Float): RxObservable<Float> /* = Flowable<Float> */ defined in se.sdg12.deedster.concurrency.rx
louiscad
08/13/2019, 9:03 AMandreasmattsson
08/13/2019, 9:06 AMRxObservable
type which i have typealiased to RxJava2's Flowable
for my java/android projectslouiscad
08/13/2019, 9:08 AMandreasmattsson
08/13/2019, 9:16 AMkotlin.srcDir('src/jvmCommonMain/kotlin')
).
@louiscad are you aware of if there are any existing issues related to IDE and including same file in multiple sourcesets, or should I still create a new one?louiscad
08/13/2019, 9:18 AMandreasmattsson
08/13/2019, 9:18 AMlouiscad
08/13/2019, 9:19 AMandreasmattsson
08/13/2019, 9:20 AMlouiscad
08/13/2019, 9:20 AMandreasmattsson
08/13/2019, 9:26 AMexpect/actual
with different impls for pure/android (with the android versions needing access to the application context for example).
I could get around it with a more dependency injection-like approach (having just an interface in the common module and "injecting" the different impls in consuming platform-specific modules) but that would require pretty significant work, whereas different expect/actual
impls seemed much easier.louiscad
08/13/2019, 9:59 AMjvmCommon
intermediate source set. It'll not delete existing directories, so it's safe to use on existing structure.
Be sure to launch the script from the directory of your project's root using kotlin -script path/to/the/script/dir/Add-Kotlin-Targets.kts
.
https://github.com/LouisCAD/Splitties/blob/develop/scripts/Add-Kotlin-Targets.kts#L27
Then, you'll need to make an edited (and probably simpler) version of this buildSrc
code I made to make the IDE point to the symlinked directories for each target: https://github.com/LouisCAD/Splitties/blob/0318f6047059ef5e97fb7bd53bd363420ad5fdf9/buildSrc/src/main/kotlin/config/KotlinSourceSetsConfig.kt#L35
It targets Kotlin/Native, but you can add support for Kotlin/JVM and Android too.
After you made this and renamed the function (since it no longer targets native source sets only if at all), you can simply call it after you define the targets in your build.gradle(.kts).
Note that after this is setup, symlinked files need to be manually saved (using cmd/ctrl + S), and the IDE might be a little slow to propagate files creations to other symlinked targets.
Let me know if you need further help.andreasmattsson
08/13/2019, 10:04 AMlouiscad
08/13/2019, 10:05 AM