Please answer these questions before submitting your issue. Thanks!
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
package main
func main() {
s := "s"
_ = 'r' != s
_ = 1 != s
_ = 1.1 != s
}
What did you expect to see?
I expected to see "untyped rune", "untyped int", "untyped float".
What did you see instead?
"type untyped number" which is not a searchable keyword in the https://golang.org/ref/spec.
# command-line-arguments
./k.go:5:10: cannot convert 'r' (type untyped number) to type string
./k.go:5:10: invalid operation: 'r' != s (mismatched types rune and string)
./k.go:6:8: cannot convert 1 (type untyped number) to type string
./k.go:6:8: invalid operation: 1 != s (mismatched types int and string)
./k.go:7:10: cannot convert 1.1 (type untyped number) to type string
./k.go:7:10: invalid operation: 1.1 != s (mismatched types float64 and string)
To be precise, conversion error here is already inaccurate.
The error message implies s := string('r') is incorrect code, but it's not true.
Also "type untyped" is redundant expression to me.
cannot compare 'r' (untyped rune) to string
or
cannot assign 'r' (untyped rune) to string
is correct one. (initial one is better in this context)
Does this issue reproduce with the latest release (go1.9.2)?
I can see the conversion error, but I can't see "untyped number" in the error message.
System details
go version devel +23aefcd9ae Wed Jan 10 00:00:40 2018 +0000 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hiro/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/hiro/.go"
GORACE=""
GOROOT="/Users/hiro/go"
GOTMPDIR=""
GOTOOLDIR="/Users/hiro/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wq/dwn8hs0x7njbzty9f68y61700000gn/T/go-build157306342=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOROOT/bin/go version: go version devel +23aefcd9ae Wed Jan 10 00:00:40 2018 +0000 darwin/amd64
GOROOT/bin/go tool compile -V: compile version devel +23aefcd9ae Wed Jan 10 00:00:40 2018 +0000
uname -v: Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64
ProductName: Mac OS X
ProductVersion: 10.13.2
BuildVersion: 17C88
lldb --version: lldb-900.0.64
Swift-4.0
gdb --version: GNU gdb (GDB) 8.0.1
Please answer these questions before submitting your issue. Thanks!
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
What did you expect to see?
I expected to see "untyped rune", "untyped int", "untyped float".
What did you see instead?
"type untyped number" which is not a searchable keyword in the https://golang.org/ref/spec.
To be precise, conversion error here is already inaccurate.
The error message implies
s := string('r')is incorrect code, but it's not true.Also "type untyped" is redundant expression to me.
or
is correct one. (initial one is better in this context)
Does this issue reproduce with the latest release (go1.9.2)?
I can see the conversion error, but I can't see "untyped number" in the error message.
System details