From 1e0051658345a13ca9be9eeccdce2dabb016c627 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Wed, 7 Dec 2022 16:57:27 -0800 Subject: cmd/compile/internal/syntax: rename ErrorMap to CommentMap, make more flexible Change the ErrorMap function to collect all comments with a comment text that matches a given regexp pattern. Also rename it to CommentMap. Adjust uses and corresponding test. Adjust various type-checker tests with incorrect ERROR patterns. For #51006. Change-Id: I749e8f31b532edbf8568f27ba1546dc849efd143 Reviewed-on: https://go-review.googlesource.com/c/go/+/456155 Reviewed-by: Robert Findley Reviewed-by: Robert Griesemer Run-TryBot: Robert Griesemer TryBot-Result: Gopher Robot Auto-Submit: Cherry Mui --- src/internal/types/testdata/check/builtins0.go | 2 +- src/internal/types/testdata/check/decls3.go | 8 ++++---- src/internal/types/testdata/check/stmt0.go | 2 +- src/internal/types/testdata/fixedbugs/issue43190.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/internal') diff --git a/src/internal/types/testdata/check/builtins0.go b/src/internal/types/testdata/check/builtins0.go index 308f70b9cc..b54d339069 100644 --- a/src/internal/types/testdata/check/builtins0.go +++ b/src/internal/types/testdata/check/builtins0.go @@ -707,7 +707,7 @@ func Alignof1() { _ = unsafe.Alignof(new(struct{})) _ = unsafe.Alignof(1<<10) _ = unsafe.Alignof(1 << /* ERROR constant shift overflow */ 1000) - _ = unsafe.Alignof(nil /* ERROR "untyped nil */ ) + _ = unsafe.Alignof(nil /* ERROR untyped nil */ ) unsafe /* ERROR not used */ .Alignof(x) var y S0 diff --git a/src/internal/types/testdata/check/decls3.go b/src/internal/types/testdata/check/decls3.go index 01d4ffe4b5..947ab307ba 100644 --- a/src/internal/types/testdata/check/decls3.go +++ b/src/internal/types/testdata/check/decls3.go @@ -221,16 +221,16 @@ func _() { _ = S2{}.B _ = S2{}.C _ = S2{}.D /* ERROR "no field or method" */ - _ = S3{}.S1 /* ERROR "ambiguous selector S3{}.S1" */ + _ = S3{}.S1 /* ERROR "ambiguous selector S3{}\.S1" */ _ = S3{}.A - _ = S3{}.B /* ERROR "ambiguous selector" S3{}.B */ + _ = S3{}.B /* ERROR "ambiguous selector S3{}\.B" */ _ = S3{}.D _ = S3{}.E _ = S4{}.A _ = S4{}.B /* ERROR "no field or method" */ - _ = S5{}.X /* ERROR "ambiguous selector S5{}.X" */ + _ = S5{}.X /* ERROR "ambiguous selector S5{}\.X" */ _ = S5{}.Y - _ = S10{}.X /* ERROR "ambiguous selector S10{}.X" */ + _ = S10{}.X /* ERROR "ambiguous selector S10{}\.X" */ _ = S10{}.Y } diff --git a/src/internal/types/testdata/check/stmt0.go b/src/internal/types/testdata/check/stmt0.go index c456aace7c..3e8cb6836b 100644 --- a/src/internal/types/testdata/check/stmt0.go +++ b/src/internal/types/testdata/check/stmt0.go @@ -509,7 +509,7 @@ func switches0() { switch a { case [3]int{1, 2, 3}: case [3]int{1, 2, 3}: // no duplicate detection - case [ /* ERROR "mismatched types */ 4]int{4, 5, 6}: + case [ /* ERROR "mismatched types" */ 4]int{4, 5, 6}: } // switch on channel diff --git a/src/internal/types/testdata/fixedbugs/issue43190.go b/src/internal/types/testdata/fixedbugs/issue43190.go index d1b46b59f2..ace0487229 100644 --- a/src/internal/types/testdata/fixedbugs/issue43190.go +++ b/src/internal/types/testdata/fixedbugs/issue43190.go @@ -11,7 +11,7 @@ import ; // ERROR missing import path import "" // ERROR invalid import path \(empty string\) import var /* ERROR missing import path */ _ int -import .; // ERROR missing import path +import .; // ERROR missing import path import 'x' // ERROR import path must be a string var _ int import /* ERROR imports must appear before other declarations */ _ "math" -- cgit v1.3