When the file contains only a single class/interface/etc declaration that matches the name of the file, then it displays the file by its type.
For example, the following Question.kt file would display the class icon and name Question
package com.bignerdranch.android.geoquiz
data class Question(@StringRes val textResId: Int, val answer: Boolean)
But the following will display the Kotlin icon and the name Question.kt
package com.bignerdranch.android.geoquiz
private const val DEFAULT_ANSWER = false
data class Question(@StringRes val textRedId: Int, val answer: Boolean = DEFAULT_ANSWER)