...

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

Documentation: go/parser/testdata

     1// Copyright 2019 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/34946: Better synchronization of
     6// parser for function declarations that start their
     7// body's opening { on a new line.
     8
     9package p
    10
    11// accept Allman/BSD-style declaration but complain
    12// (implicit semicolon between signature and body)
    13func _() int
    14{ /* ERROR "unexpected semicolon or newline before {" */
    15	{ return 0 }
    16}
    17
    18func _() {}
    19
    20func _(); { /* ERROR "unexpected semicolon or newline before {" */ }
    21
    22func _() {}

View as plain text