Intent.action smart cast to "Kotlin.String!" is impossible (beta 2)


#1

"Smart cast to "Kotlin.String!" is impossible, because 'intent.action' is a member value that has open or custom getter" in Kotlin Beta 2 under Android Studio. Is it studio plugin issue?

/uploads/kotlinlang/original/1X/bcc75a278e09ea93391c420e0a1d91467c6ee5b0.png

on the other hand
/uploads/kotlinlang/original/1X/7760e49ca5ea0dcd798764ce0e8803353c44cea6.png


#2

Unfortunately it's hard to see what the issue is from the very limited snippet that you have provided.


#3

  

import android.appwidget.AppWidgetProvider
import android.content.Context
import android.content.Intent

class Test : AppWidgetProvider() {

  override fun onReceive(context: Context, intent: Intent) {
super.onReceive(context, intent)

  if (intent.action != null) {

           when (intent.action) {
           “1” -> {

           }
           }
  }
  }
}

There is an example. I've created an issue 10061