aboutsummaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2022-12-07 16:57:27 -0800
committerGopher Robot <gobot@golang.org>2023-01-17 19:53:18 +0000
commit1e0051658345a13ca9be9eeccdce2dabb016c627 (patch)
tree04aa00fce01bb3d666b2ec234a2ddb9aa9f7d7ec /src/internal
parent83f8688915de59d974e74dd6accd7a3d54e9a6e7 (diff)
downloadgo-1e0051658345a13ca9be9eeccdce2dabb016c627.tar.xz
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 <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/types/testdata/check/builtins0.go2
-rw-r--r--src/internal/types/testdata/check/decls3.go8
-rw-r--r--src/internal/types/testdata/check/stmt0.go2
-rw-r--r--src/internal/types/testdata/fixedbugs/issue43190.go2
4 files changed, 7 insertions, 7 deletions
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"