Calling global function before declaration

I think this is a bug, here's a reduced example:

// This program compiles and print 0 when run:
print(x) 
let x = 123
// This program compiles and crashes (segmentation fault 11) when run:
print(x) 
let x = [1, 2, 3]

Are you sure that this hasn't always been the case? See for example this old perhaps somewhat related thread:


If it the behavior has changed in Swift 5.2, then it seems like more/different bugs have been introduced, since the example in the end of the following old post now compiles (though @jrose says at the end of the post that it is important to make sure it continues to be rejected):