...

Source file src/internal/types/testdata/check/go1_12.go

Documentation: internal/types/testdata/check

     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 "underscore in numeric literal requires go1.13 or later"
    14  	_ = 0b111 // ERROR "binary literal requires go1.13 or later"
    15  	_ = 0o567 // ERROR "0o/0O-style octal literal requires go1.13 or later"
    16  	_ = 0xabc // ok
    17  	_ = 0x0p1 // ERROR "hexadecimal floating-point literal 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 "underscore"
    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  )
    37  

View as plain text