Kotlin / kotlin-spec

Kotlin Language Specification:
https://kotlinlang.org/spec
Apache License 2.0
387 stars 80 forks source link

Wrong fun generics autocast without using val/var #125

Closed Std1o closed 11 months ago

Std1o commented 11 months ago

How did it happen that the unused variable from below affects the autocast of generics in the line above?

normal cringe

And I can tell how it happened.

decompiled bytecode with val usage decompiled bytecode without val usage

It's not ok, because I need receive right input type of data without specifying explicit type and without useless var/val. Please fix it!

Std1o commented 11 months ago

It's coroutine issue https://github.com/Kotlin/kotlinx.coroutines/issues/3904