// Restriction tests ensure the compiler rejects specific patterns with // a clean error message rather than crashing. // // Format: each .mx file starts with "// expected: " // The runner compiles the file, asserts exit != 0, and checks that // stderr contains the expected substring. It also asserts that the // compiler does NOT crash (no "panic:", "SIGSEGV", "nil pointer"). // // expected: a pointer converts to an integer only through unsafe.Pointer package main type file struct { fd int32 } func main() { f := &file{fd: 3} // Go has no direct pointer-to-integer conversion: the unsafe.Pointer step // is what makes the integer meaningful. Legacy rejects both spellings; so // must stage4, or code written here compiles and then fails to bootstrap. direct := int32(f) wide := uintptr(f) if direct == 0 || wide == 0 { panic("unreachable") } }