]> Cypherpunks repositories - gostls13.git/commitdiff
go/types, types2: consistently use singular when reporting version errors
authorRobert Griesemer <gri@golang.org>
Tue, 27 Feb 2024 17:21:44 +0000 (09:21 -0800)
committerGopher Robot <gobot@golang.org>
Wed, 28 Feb 2024 02:54:13 +0000 (02:54 +0000)
Change-Id: I39af932b789cd18dc4bfc84f9667b1c32c9825f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/567476
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/compile/internal/types2/conversions.go
src/cmd/compile/internal/types2/version.go
src/go/types/conversions.go
src/go/types/version.go
src/internal/types/testdata/check/go1_12.go
test/fixedbugs/issue31747.go

index 286fad578a92f4238ff2ad35c0573535cd7b796b..d9ed0b3c1b6a35cccb4923c3c50a8b8b38e2e1c9 100644 (file)
@@ -203,7 +203,7 @@ func (x *operand) convertibleTo(check *Checker, T Type, cause *string) bool {
                                // check != nil
                                if cause != nil {
                                        // TODO(gri) consider restructuring versionErrorf so we can use it here and below
-                                       *cause = "conversion of slices to arrays requires go1.20 or later"
+                                       *cause = "conversion of slice to array requires go1.20 or later"
                                }
                                return false
                        }
@@ -215,7 +215,7 @@ func (x *operand) convertibleTo(check *Checker, T Type, cause *string) bool {
                                        }
                                        // check != nil
                                        if cause != nil {
-                                               *cause = "conversion of slices to array pointers requires go1.17 or later"
+                                               *cause = "conversion of slice to array pointer requires go1.17 or later"
                                        }
                                        return false
                                }
index b904072a7baa8c70eb85c705dacc6be35e6742d5..1b6e48e78898a82aa32db918388ad6db04c52a9b 100644 (file)
@@ -59,7 +59,7 @@ func (check *Checker) langCompat(lit *syntax.BasicLit) {
        }
        // len(s) > 2
        if strings.Contains(s, "_") {
-               check.versionErrorf(lit, go1_13, "underscores in numeric literals")
+               check.versionErrorf(lit, go1_13, "underscore in numeric literal")
                return
        }
        if s[0] != '0' {
@@ -67,15 +67,15 @@ func (check *Checker) langCompat(lit *syntax.BasicLit) {
        }
        radix := s[1]
        if radix == 'b' || radix == 'B' {
-               check.versionErrorf(lit, go1_13, "binary literals")
+               check.versionErrorf(lit, go1_13, "binary literal")
                return
        }
        if radix == 'o' || radix == 'O' {
-               check.versionErrorf(lit, go1_13, "0o/0O-style octal literals")
+               check.versionErrorf(lit, go1_13, "0o/0O-style octal literal")
                return
        }
        if lit.Kind != syntax.IntLit && (radix == 'x' || radix == 'X') {
-               check.versionErrorf(lit, go1_13, "hexadecimal floating-point literals")
+               check.versionErrorf(lit, go1_13, "hexadecimal floating-point literal")
        }
 }
 
index 89043f2c46134ff3ca4f571cab10d3c547b648d7..f5834cd86da27d5c9faea80a85cfada1aa80fedb 100644 (file)
@@ -205,7 +205,7 @@ func (x *operand) convertibleTo(check *Checker, T Type, cause *string) bool {
                                // check != nil
                                if cause != nil {
                                        // TODO(gri) consider restructuring versionErrorf so we can use it here and below
-                                       *cause = "conversion of slices to arrays requires go1.20 or later"
+                                       *cause = "conversion of slice to array requires go1.20 or later"
                                }
                                return false
                        }
@@ -217,7 +217,7 @@ func (x *operand) convertibleTo(check *Checker, T Type, cause *string) bool {
                                        }
                                        // check != nil
                                        if cause != nil {
-                                               *cause = "conversion of slices to array pointers requires go1.17 or later"
+                                               *cause = "conversion of slice to array pointer requires go1.17 or later"
                                        }
                                        return false
                                }
index 1b02ae54932075812b2b7fb1b6d9abc2cdebf43d..a11e989b6484c1b49fcab666724fe6120e1b3f6a 100644 (file)
@@ -60,7 +60,7 @@ func (check *Checker) langCompat(lit *ast.BasicLit) {
        }
        // len(s) > 2
        if strings.Contains(s, "_") {
-               check.versionErrorf(lit, go1_13, "underscores in numeric literals")
+               check.versionErrorf(lit, go1_13, "underscore in numeric literal")
                return
        }
        if s[0] != '0' {
@@ -68,15 +68,15 @@ func (check *Checker) langCompat(lit *ast.BasicLit) {
        }
        radix := s[1]
        if radix == 'b' || radix == 'B' {
-               check.versionErrorf(lit, go1_13, "binary literals")
+               check.versionErrorf(lit, go1_13, "binary literal")
                return
        }
        if radix == 'o' || radix == 'O' {
-               check.versionErrorf(lit, go1_13, "0o/0O-style octal literals")
+               check.versionErrorf(lit, go1_13, "0o/0O-style octal literal")
                return
        }
        if lit.Kind != token.INT && (radix == 'x' || radix == 'X') {
-               check.versionErrorf(lit, go1_13, "hexadecimal floating-point literals")
+               check.versionErrorf(lit, go1_13, "hexadecimal floating-point literal")
        }
 }
 
index b47d3de147ad7abbfd6c3f745f312d278ac7bc32..f1266c23cc25789907962b8716edcc19ff3b3e07 100644 (file)
@@ -10,18 +10,18 @@ package p
 
 // numeric literals
 const (
-       _ = 1_000 // ERROR "underscores in numeric literals requires go1.13 or later"
-       _ = 0b111 // ERROR "binary literals requires go1.13 or later"
-       _ = 0o567 // ERROR "0o/0O-style octal literals requires go1.13 or later"
+       _ = 1_000 // ERROR "underscore in numeric literal requires go1.13 or later"
+       _ = 0b111 // ERROR "binary literal requires go1.13 or later"
+       _ = 0o567 // ERROR "0o/0O-style octal literal requires go1.13 or later"
        _ = 0xabc // ok
-       _ = 0x0p1 // ERROR "hexadecimal floating-point literals requires go1.13 or later"
+       _ = 0x0p1 // ERROR "hexadecimal floating-point literal requires go1.13 or later"
 
-       _ = 0B111 // ERROR "binary"
-       _ = 0O567 // ERROR "octal"
-       _ = 0Xabc // ok
-       _ = 0X0P1 // ERROR "hexadecimal floating-point"
+       _ = 0b111 // ERROR "binary"
+       _ = 0o567 // ERROR "octal"
+       _ = 0xabc // ok
+       _ = 0x0p1 // ERROR "hexadecimal floating-point"
 
-       _ = 1_000i // ERROR "underscores"
+       _ = 1_000i // ERROR "underscore"
        _ = 0b111i // ERROR "binary"
        _ = 0o567i // ERROR "octal"
        _ = 0xabci // ERROR "hexadecimal floating-point"
index 319a721337efc6ae470c5e77401456c1d266b342..b40aecd5d2e3d31a753933a72d0a4c0a55dd9d32 100644 (file)
@@ -8,18 +8,18 @@ package p
 
 // numeric literals
 const (
-       _ = 1_000 // ERROR "underscores in numeric literals requires go1.13 or later \(-lang was set to go1.12; check go.mod\)|requires go1.13"
-       _ = 0b111 // ERROR "binary literals requires go1.13 or later"
-       _ = 0o567 // ERROR "0o/0O-style octal literals requires go1.13 or later"
+       _ = 1_000 // ERROR "underscore in numeric literal requires go1.13 or later \(-lang was set to go1.12; check go.mod\)|requires go1.13"
+       _ = 0b111 // ERROR "binary literal requires go1.13 or later"
+       _ = 0o567 // ERROR "0o/0O-style octal literal requires go1.13 or later"
        _ = 0xabc // ok
-       _ = 0x0p1 // ERROR "hexadecimal floating-point literals requires go1.13 or later"
+       _ = 0x0p1 // ERROR "hexadecimal floating-point literal requires go1.13 or later"
 
-       _ = 0B111 // ERROR "binary"
-       _ = 0O567 // ERROR "octal"
-       _ = 0Xabc // ok
-       _ = 0X0P1 // ERROR "hexadecimal floating-point"
+       _ = 0b111 // ERROR "binary"
+       _ = 0o567 // ERROR "octal"
+       _ = 0xabc // ok
+       _ = 0x0p1 // ERROR "hexadecimal floating-point"
 
-       _ = 1_000i // ERROR "underscores"
+       _ = 1_000i // ERROR "underscore"
        _ = 0b111i // ERROR "binary"
        _ = 0o567i // ERROR "octal"
        _ = 0xabci // ERROR "hexadecimal floating-point"