https://kotlinlang.org logo
#javascript
Title
# javascript
e

Edoardo Luppi

02/23/2024, 1:32 PM
Since I wanted to specialize some return types in externals subclasses/subinterfaces, I ended up using:
Copy code
@Suppress("VAR_TYPE_MISMATCH_ON_OVERRIDE")
https://github.com/lppedd/kotlin-externals/commit/275f011ea65ebc6e6c57b855f71c4697d5ec8d70 It compiles, but with K2 I get:
Copy code
This code uses error suppression for 'VAR_TYPE_MISMATCH_ON_OVERRIDE'. While it might compile and work, the compiler behavior is UNSPECIFIED and WON'T BE PRESERVED
So I was wondering if it make sense to keep it. Haven't found another way apart from using annotations.
a

Artem Kobzar

02/23/2024, 1:51 PM
I mean, as we discuss such changes just not sound in terms of type system. You could keep it, but we don't guarantee stability for code that uses
@Suppress
.
e

Edoardo Luppi

02/23/2024, 1:55 PM
By stability you mean that the suppression could just stop working?
a

Artem Kobzar

02/23/2024, 2:16 PM
Yes, or the code that worked before with the new release could stop working.
gratitude thank you 1
e

Edoardo Luppi

02/23/2024, 3:24 PM
Ok! I'll keep it for now, since the places where it's done are very limited.
🫡 1
t

turansky

02/23/2024, 6:23 PM
If it will stop working - we have magic pills :)
🔝 1