Text file src/cmd/compile/internal/syntax/testdata/issue47704.src

     1  // Copyright 2021 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  package p
     6  
     7  // error messages for parser in non-generic mode
     8  func _() {
     9  	_ = m[]   // ERROR expecting operand
    10  	_ = m[x,] // ERROR unexpected comma, expecting \: or \]
    11  	_ = m[x /* ERROR unexpected a */ a b c d]
    12  }
    13  
    14  // test case from the issue
    15  func f(m map[int]int) int {
    16  	return m[0 // ERROR expecting \: or \]
    17  		]
    18  }
    19  

View as plain text