Skip to content

go/types: incorrect error message for string(1<<s + 1.1) #21982

@griesemer

Description

@griesemer

Type-checking the program

package p
var s uint
var _ = string(1<<s + 1.0)

produces the error:

x.src:3:16: cannot convert 1 << s + 1.0 (untyped float value) to string

But the correct error would be:

cannot shift 1 (untyped float value)

See also the TODO in go/types/conversions.go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions