Skip to content

cmd/compile: extra (confusing) error message after shift error #27712

Closed

Description

@griesemer
package main

func main() {
	var s uint
	var _ interface{} = 1.0 << s
}

produces

prog.go:5:6: cannot use 1 << s as type interface {} in assignment
prog.go:5:26: invalid operation: 1 << s (shift of type float64)

on the playground (https://play.golang.org/p/lZceKWg78OH). The first error message is misleading and unnecessary. Should suppress once we know that the shift is invalid.

Not urgent.

Activity

  1. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Sep 17, 2018
  2. added this to the Unplanned milestone on Sep 17, 2018
  3. self-assigned this
    on Sep 17, 2018
  4. ALTree commented on Jul 22, 2020

    @ALTree
    Member

    This appears to be fixed, the reproducer above now generates a single error line:

    ./prog.go:5:6: invalid operation: 1 << s (shift of type float64)
    

    Closing here.

  5. locked and limited conversation to collaborators on Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions