github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/types/testdata/check/go1_12.go (about)

     1  // -lang=go1.12
     2  
     3  // Copyright 2021 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Check Go language version-specific errors.
     8  
     9  package p
    10  
    11  // numeric literals
    12  const (
    13  	_ = 1_000 // ERROR "underscores in numeric literals requires go1.13 or later"
    14  	_ = 0b111 // ERROR "binary literals requires go1.13 or later"
    15  	_ = 0o567 // ERROR "0o/0O-style octal literals requires go1.13 or later"
    16  	_ = 0xabc // ok
    17  	_ = 0x0p1 // ERROR "hexadecimal floating-point literals requires go1.13 or later"
    18  
    19  	_ = 0B111 // ERROR "binary"
    20  	_ = 0O567 // ERROR "octal"
    21  	_ = 0Xabc // ok
    22  	_ = 0X0P1 // ERROR "hexadecimal floating-point"
    23  
    24  	_ = 1_000i // ERROR "underscores"
    25  	_ = 0b111i // ERROR "binary"
    26  	_ = 0o567i // ERROR "octal"
    27  	_ = 0xabci // ERROR "hexadecimal floating-point"
    28  	_ = 0x0p1i // ERROR "hexadecimal floating-point"
    29  )
    30  
    31  // signed shift counts
    32  var (
    33  	s int
    34  	_ = 1 << s // ERROR "invalid operation: signed shift count s (variable of type int) requires go1.13 or later"
    35  	_ = 1 >> s // ERROR "signed shift count"
    36  )