Why is this not an error?

When I write

let x: Int
switch x {
    default:
        print("x")
}

I get this error: error: constant 'x' used before being initialized

When I write

let x: Never
print(x)

I get this error: error: constant 'x' used before being initialized

But when I write

let x: Never
switch x {
    default:
        print("x")
}

I don’t get an error, but running the program results in a crash.

Why is this?

1 Like

Also, I would like to express that I was delighted by the excellent crash interface.

1 Like

Sounds like a bug in the compiler! Can you file an issue to have it triaged?

I have filed an issue.

2 Likes