shifts.go raw

   1  // Copyright 2022 The Go Authors. All rights reserved.
   2  // Use of this source code is governed by a BSD-style
   3  // license that can be found in the LICENSE file.
   4  
   5  // The following shift tests are disabled in the shared
   6  // testdata/check/shifts.go file because they don't work
   7  // correctly with types2 at the moment. See go.dev/issue/52080.
   8  // Make sure we keep testing them with go/types.
   9  //
  10  // TODO(gri) Once go.dev/issue/52080 is fixed, this file can be
  11  //           deleted in favor of the re-enabled tests
  12  //           in the shared file.
  13  
  14  package p
  15  
  16  func _() {
  17  	var s uint
  18  
  19  	_ = int32(0x80000000 /* ERROR "overflows int32" */ << s)
  20  	// TODO(rfindley) Eliminate the redundant error here.
  21  	_ = int32(( /* ERROR "truncated to int32" */ 0x80000000 /* ERROR "truncated to int32" */ + 0i) << s)
  22  
  23  	_ = int(1 + 0i<<0)
  24  	_ = int((1 + 0i) << s)
  25  	_ = int(1.0 << s)
  26  	_ = int(complex(1, 0) << s)
  27  }
  28