Skip to content

Commit

Permalink
go/types, types2: consolidate a test file with different syntax errors
Browse files Browse the repository at this point in the history
For #54511.

Change-Id: I317c5f9beed7f1de4979ec12c6ec8d5de71bac1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/426554
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
  • Loading branch information
griesemer authored and gopherbot committed Sep 2, 2022
1 parent cb35783 commit 042f051
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions src/cmd/compile/internal/types2/testdata/fixedbugs/issue51658.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// This test checks syntax errors which differ between
// go/parser and the syntax package.
// TODO: consolidate eventually

package p

type F { // ERROR syntax error
type F { // ERROR expected type|type declaration
float64
} // ERROR syntax error
} // ERROR expected declaration|non-declaration statement

func _[T F | int](x T) {
_ = x == 0 // don't crash when recording type of 0
}

// test case from issue

type FloatType { // ERROR syntax error
type FloatType { // ERROR expected type|type declaration
float32 | float64
} // ERROR syntax error
} // ERROR expected declaration|non-declaration statement

type IntegerType interface {
int8 | int16 | int32 | int64 | int |
Expand Down
12 changes: 8 additions & 4 deletions src/go/types/testdata/fixedbugs/issue51658.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// This test checks syntax errors which differ between
// go/parser and the syntax package.
// TODO: consolidate eventually

package p

type F { // ERROR expected type
type F { // ERROR expected type|type declaration
float64
} // ERROR expected declaration
} // ERROR expected declaration|non-declaration statement

func _[T F | int](x T) {
_ = x == 0 // don't crash when recording type of 0
}

// test case from issue

type FloatType { // ERROR expected type
type FloatType { // ERROR expected type|type declaration
float32 | float64
} // ERROR expected declaration
} // ERROR expected declaration|non-declaration statement

type IntegerType interface {
int8 | int16 | int32 | int64 | int |
Expand Down

0 comments on commit 042f051

Please sign in to comment.