isInitialised of method

The code doesn’t compile because compiler can’t see difference between engine field and engine method.

class Car {
    class Builder {

        lateinit var engine: Engine

        fun engine(obj: Engine): Builder {
            this.engine = obj
            return this
        }

        fun build(): Car {

            val stringId = engine.id.toString()

            if (!this::engine.isInitialized) {
                throw RuntimeException("engine is not defined")
            }

            return Car()
        }

        class Engine(val id: Int) {

            fun id(): Int {
                return id
            }
        }
    }
}

But that seems should be clear for compiler because class method doesn’t have meta field isInitialized, but class field has. Like it happens with regular fields:

val stringId = engine.id.toString()

Well the compiler can’t use extra information on how you use an expression to disambiguate it.
this::engine should have a unique meaning however you use it.

For example you could write:
val foo = this::engine
in that case the compiler must be able to find out what type foo has, and it can’t because it could be 2 different things.

For your use case you should use 2 different names.