https://kotlinlang.org logo
#stdlib
Title
# stdlib
z

Zoltan Demant

08/13/2022, 5:58 AM
Why does typing out
run
always result in
kotlin.run {}
whereas with
apply
(and others) you just end up with a nice
apply {}
?
j

Joffrey

08/13/2022, 6:00 AM
It doesn't for me. Maybe you happen to have another
run
function imported or declared in the same file?
z

Zoltan Demant

08/13/2022, 6:02 AM
Really? 😮 Its always been like that for me, I dont have any other run
j

Joffrey

08/13/2022, 6:04 AM
Interesting. Before answering, I tried that in whatever file I had open, and I happened to be working in a gradle
buildSrc
dir. Now I just tried again in a regular project file, and indeed I get
kotlin.run
Maybe it has to do with recent Kotlin versions (
buildSrc
is usually older)
z

Zoltan Demant

08/13/2022, 6:05 AM
I think its been like this for at least 5 years for me, I never quite understood why
j

Joffrey

08/13/2022, 6:05 AM
That said, I almost never use
run
. Most of the time if you want to use
run
you probably want to extract a function
z

Zoltan Demant

08/13/2022, 6:05 AM
Yeah, I rarely use it too. But when I do, I always wonder the same thing ^
b

Big Chungus

08/13/2022, 8:02 AM
A known ide bug I'm affraid
👍 1
👍🏽 1
z

Zoltan Demant

09/21/2022, 9:04 AM
🎅🏽 This was fixed in Android Studio Flamingo! 🦩
🎉 2
4 Views