`val global: MarsComponent.this.global.type = ...` would obviate the need for casts.