I'm very surprise that the following code is compiled:
lateinit var progressBar: ProgressBar
and in onCreate:
progressBar = view.findViewById(R.id.pb_loader)
findViewById declared that it can return a null, so how doesn't the compiler enforce me to declare:
lateinit var progressBar: ProgressBar?
Can someone help me to understand when the compiler does enforce and when it doesn't?