1
0
mirror of https://github.com/golang/go synced 2024-11-23 15:40:06 -07:00
go/test/fixedbugs/bug299.go
Robert Griesemer e6a1350191 [dev.go2go] cmd/compile/internal/syntax: restore errors for embedded parenthesized fields
When we used ()'s for type parameters, we needed to relax the rules for
embedded struct fields and interface methods: parenthesized embedded
fields and methods were necessary to disambiguate from other constructs.
Now that we use []'s, we can go back to the existing Go rules.

Minor cleanups.

Change-Id: I45399e5b5592c76654a5d504f8bb8b23fff53b85
Reviewed-on: https://go-review.googlesource.com/c/go/+/253997
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-09-10 18:36:09 +00:00

30 lines
666 B
Go

// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
type T struct {
// legal according to spec
x int
y (int)
int
*float64
// not legal according to spec
(complex128) // ERROR "non-declaration|expected|parenthesize"
(*string) // ERROR "non-declaration|expected|parenthesize"
*(bool) // ERROR "non-declaration|expected|parenthesize"
}
// legal according to spec
func (p T) m() {}
// now legal according to spec
func (p (T)) f() {}
func (p *(T)) g() {}
func (p (*T)) h() {}
func (p (*(T))) i() {}
func ((T),) j() {}