Skip to content

Commit 5e00352

Browse files
griesemergopherbot
authored andcommitted
go/types, types2: consistently use singular when reporting version errors
Change-Id: I39af932b789cd18dc4bfc84f9667b1c32c9825f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/567476 Reviewed-by: Robert Findley <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> Auto-Submit: Robert Griesemer <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 1a6498e commit 5e00352

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

src/cmd/compile/internal/types2/conversions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (x *operand) convertibleTo(check *Checker, T Type, cause *string) bool {
203203
// check != nil
204204
if cause != nil {
205205
// TODO(gri) consider restructuring versionErrorf so we can use it here and below
206-
*cause = "conversion of slices to arrays requires go1.20 or later"
206+
*cause = "conversion of slice to array requires go1.20 or later"
207207
}
208208
return false
209209
}
@@ -215,7 +215,7 @@ func (x *operand) convertibleTo(check *Checker, T Type, cause *string) bool {
215215
}
216216
// check != nil
217217
if cause != nil {
218-
*cause = "conversion of slices to array pointers requires go1.17 or later"
218+
*cause = "conversion of slice to array pointer requires go1.17 or later"
219219
}
220220
return false
221221
}

src/cmd/compile/internal/types2/version.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,23 @@ func (check *Checker) langCompat(lit *syntax.BasicLit) {
5959
}
6060
// len(s) > 2
6161
if strings.Contains(s, "_") {
62-
check.versionErrorf(lit, go1_13, "underscores in numeric literals")
62+
check.versionErrorf(lit, go1_13, "underscore in numeric literal")
6363
return
6464
}
6565
if s[0] != '0' {
6666
return
6767
}
6868
radix := s[1]
6969
if radix == 'b' || radix == 'B' {
70-
check.versionErrorf(lit, go1_13, "binary literals")
70+
check.versionErrorf(lit, go1_13, "binary literal")
7171
return
7272
}
7373
if radix == 'o' || radix == 'O' {
74-
check.versionErrorf(lit, go1_13, "0o/0O-style octal literals")
74+
check.versionErrorf(lit, go1_13, "0o/0O-style octal literal")
7575
return
7676
}
7777
if lit.Kind != syntax.IntLit && (radix == 'x' || radix == 'X') {
78-
check.versionErrorf(lit, go1_13, "hexadecimal floating-point literals")
78+
check.versionErrorf(lit, go1_13, "hexadecimal floating-point literal")
7979
}
8080
}
8181

src/go/types/conversions.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/go/types/version.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,23 @@ func (check *Checker) langCompat(lit *ast.BasicLit) {
6060
}
6161
// len(s) > 2
6262
if strings.Contains(s, "_") {
63-
check.versionErrorf(lit, go1_13, "underscores in numeric literals")
63+
check.versionErrorf(lit, go1_13, "underscore in numeric literal")
6464
return
6565
}
6666
if s[0] != '0' {
6767
return
6868
}
6969
radix := s[1]
7070
if radix == 'b' || radix == 'B' {
71-
check.versionErrorf(lit, go1_13, "binary literals")
71+
check.versionErrorf(lit, go1_13, "binary literal")
7272
return
7373
}
7474
if radix == 'o' || radix == 'O' {
75-
check.versionErrorf(lit, go1_13, "0o/0O-style octal literals")
75+
check.versionErrorf(lit, go1_13, "0o/0O-style octal literal")
7676
return
7777
}
7878
if lit.Kind != token.INT && (radix == 'x' || radix == 'X') {
79-
check.versionErrorf(lit, go1_13, "hexadecimal floating-point literals")
79+
check.versionErrorf(lit, go1_13, "hexadecimal floating-point literal")
8080
}
8181
}
8282

src/internal/types/testdata/check/go1_12.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ package p
1010

1111
// numeric literals
1212
const (
13-
_ = 1_000 // ERROR "underscores in numeric literals requires go1.13 or later"
14-
_ = 0b111 // ERROR "binary literals requires go1.13 or later"
15-
_ = 0o567 // ERROR "0o/0O-style octal literals requires go1.13 or later"
13+
_ = 1_000 // ERROR "underscore in numeric literal requires go1.13 or later"
14+
_ = 0b111 // ERROR "binary literal requires go1.13 or later"
15+
_ = 0o567 // ERROR "0o/0O-style octal literal requires go1.13 or later"
1616
_ = 0xabc // ok
17-
_ = 0x0p1 // ERROR "hexadecimal floating-point literals requires go1.13 or later"
17+
_ = 0x0p1 // ERROR "hexadecimal floating-point literal requires go1.13 or later"
1818

19-
_ = 0B111 // ERROR "binary"
20-
_ = 0O567 // ERROR "octal"
21-
_ = 0Xabc // ok
22-
_ = 0X0P1 // ERROR "hexadecimal floating-point"
19+
_ = 0b111 // ERROR "binary"
20+
_ = 0o567 // ERROR "octal"
21+
_ = 0xabc // ok
22+
_ = 0x0p1 // ERROR "hexadecimal floating-point"
2323

24-
_ = 1_000i // ERROR "underscores"
24+
_ = 1_000i // ERROR "underscore"
2525
_ = 0b111i // ERROR "binary"
2626
_ = 0o567i // ERROR "octal"
2727
_ = 0xabci // ERROR "hexadecimal floating-point"

test/fixedbugs/issue31747.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ package p
88

99
// numeric literals
1010
const (
11-
_ = 1_000 // ERROR "underscores in numeric literals requires go1.13 or later \(-lang was set to go1.12; check go.mod\)|requires go1.13"
12-
_ = 0b111 // ERROR "binary literals requires go1.13 or later"
13-
_ = 0o567 // ERROR "0o/0O-style octal literals requires go1.13 or later"
11+
_ = 1_000 // ERROR "underscore in numeric literal requires go1.13 or later \(-lang was set to go1.12; check go.mod\)|requires go1.13"
12+
_ = 0b111 // ERROR "binary literal requires go1.13 or later"
13+
_ = 0o567 // ERROR "0o/0O-style octal literal requires go1.13 or later"
1414
_ = 0xabc // ok
15-
_ = 0x0p1 // ERROR "hexadecimal floating-point literals requires go1.13 or later"
15+
_ = 0x0p1 // ERROR "hexadecimal floating-point literal requires go1.13 or later"
1616

17-
_ = 0B111 // ERROR "binary"
18-
_ = 0O567 // ERROR "octal"
19-
_ = 0Xabc // ok
20-
_ = 0X0P1 // ERROR "hexadecimal floating-point"
17+
_ = 0b111 // ERROR "binary"
18+
_ = 0o567 // ERROR "octal"
19+
_ = 0xabc // ok
20+
_ = 0x0p1 // ERROR "hexadecimal floating-point"
2121

22-
_ = 1_000i // ERROR "underscores"
22+
_ = 1_000i // ERROR "underscore"
2323
_ = 0b111i // ERROR "binary"
2424
_ = 0o567i // ERROR "octal"
2525
_ = 0xabci // ERROR "hexadecimal floating-point"

0 commit comments

Comments
 (0)