In `commonMain` I keep getting a warning: > Ext...
# multiplatform
e
In
commonMain
I keep getting a warning:
Extension is shadowed by a member
Now, I don't care, I'm happy it's shadowed and I want to suppress it. So I do that, and now it says "redundant suppression" ๐Ÿ˜ž Can I suppress the "redundant suppression"? lol
m
probably #gradle
Ah wait.. maybe not?
e
@mbonnin I think it's really a Kotlin "core" issue here. I mean I'm ok with it, but I'd like to suppress the suppression warning
m
Yea,
commonMain
, sorry I somehow expected that in
build.gradle.kts
Can you share a snippet that reproduces it?
e
Sure. Have you got a multiplatform project ready to use?
m
Always!
Although TBH this feels like a bug
e
in `commonMain`:
Copy code
public expect class ZDeferred<T>

public expect inline fun <T, S> ZDeferred<T>.then(noinline thenFn: (T) -> S): ZDeferred<S>
in `jsMain`:
Copy code
@Suppress("ACTUAL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE", "ACTUAL_WITHOUT_EXPECT")
public actual typealias ZDeferred<T> = Promise<T>

@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
public actual inline fun <T, S> ZDeferred<T>.then(noinline thenFn: (T) -> S): ZDeferred<S> =
  then(onFulfilled = thenFn)
Always amazing to see the amount of suppressions lmao
m
I don't have any warning here
Except the
Copy code
Expected performance impact from inlining is insignificant. Inlining works best for functions with parameters of functional types
e
So you compile and you get no warnings?
m
Yep,
Copy code
> Task :compileKotlinJvm
w: file:///Users/mbonnin/git/test-suppression/src/jvmMain/kotlin/Main.jvm.kt:3:8 Expected performance impact from inlining is insignificant. Inlining works best for functions with parameters of functional types
Same for JS:
Copy code
> Task :compileKotlinJs
w: file:///Users/mbonnin/git/test-suppression/src/jsMain/kotlin/Main.js.kt:3:8 Expected performance impact from inlining is insignificant. Inlining works best for functions with parameters of functional types
e
Ok I'll pull it and I'll try to repro
๐Ÿ‘ 1
Ahhh you forgot to assign the typealias to a JS
Promise<T>
in
jsMain
it should be
Copy code
@Suppress("ACTUAL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE", "ACTUAL_WITHOUT_EXPECT")
actual typealias ZDeferred<T> = Promise<T>
m
Ah good catch ๐Ÿ‘
e
You'll see the inline warning will go away, replaced by the shadowed one
m
yep, now I have it ๐Ÿ‘
I guess it's a Youtrack
e
So you can suppress it in the JS side, but it will keep bugging you in common.
I guess it's a Youtrack
I guess so, I'll create it tonight. In the meantime, do you happen to know if something similar to
Copy code
@Suppress("REDUNDANT_SUPPRESSION")
exists?
m
No idea at all, sorry.
gratitude thank you 1
It's "just" an IDE thing though, right?
e
Yeah, it really bugs me. My poor OCD lol
m
I'm hoping future KTIJ update should fix this?
e
I would hope so. I'll open the issue and link it back here so you can follow it.
thank you color 1
m
You can "disable" the inspection
gratitude thank you 1
e
AHHHHHH! DAMN! I got so used to Kotlin own suppressions that I forgot about the IDE ones. Yup, just use
Copy code
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "KotlinRedundantDiagnosticSuppress")
๐ŸŽ‰ 1
Worth a YT issue anyway tho
๐Ÿ’ฏ 1
j
@Suppress("KotlinRedundantDiagnosticSuppress")
might be what you're looking for.
e
@Jeff Lockhart yup exactly, Martin pointed out it was an IDE suppression, and not a Kotlin one
j
Ah, yes, I see you did reach that conclusion. ๐Ÿ‘Œ๐Ÿผ