Stephan Schroeder
07/01/2019, 1:45 PMif (prioritizedViews != null) {
prioritizedViews as PrioritizedViews<CareHomeView>
} else ...
in
class CareHomeCombinedView(
private var prioritizedViews: PrioritizedViews<CareHomeView>? = null
) {
private val views: PrioritizedViews<CareHomeView> =
if (prioritizedViews != null) {
prioritizedViews as PrioritizedViews<CareHomeView>
} else {
PrioritizedViews(
)
}
}
class PrioritizedViews<T>(
vararg viewsByPriority: T?
)
interface CareHomeView {}
the type inference normally includes the null-check! What is different this time?
Here the link to the playground: https://pl.kotl.in/js_ASkwV9Dias
07/01/2019, 1:50 PMStephan Schroeder
07/01/2019, 1:50 PMprioritizedViews
a val
fixes it!adamd
07/01/2019, 4:13 PM