reject_const_overflow.mx raw

   1  // expected: overflows
   2  //
   3  // A constant must fit its target type. stage4 materialized constants at their
   4  // default type and compared only kind classes, so `var x int8 = 1000`
   5  // compiled and printed the wrapped value, where legacy reports "cannot use
   6  // 1000 (untyped int constant) as int8 value in variable declaration
   7  // (overflows)". The same check covers a negative value in an unsigned type.
   8  package main
   9  
  10  func main() {
  11  	var x int8 = 1000
  12  	println(x)
  13  }
  14