...

Text file src/go/parser/testdata/issue23434.src

Documentation: go/parser/testdata

     1// Copyright 2018 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// Test case for go.dev/issue/23434: Better synchronization of
     6// parser after missing type. There should be exactly
     7// one error each time, with now follow errors.
     8
     9package p
    10
    11func g() {
    12	m := make(map[string]! /* ERROR "expected type, found '!'" */ )
    13	for {
    14		x := 1
    15		print(x)
    16	}
    17}
    18
    19func f() {
    20	m := make(map[string]) /* ERROR "expected type, found '\)'" */
    21	for {
    22		x := 1
    23		print(x)
    24	}
    25}

View as plain text