Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types: no error on "x int = complex(1<<s, 2)" #5029

Closed
remyoudompheng opened this issue Mar 11, 2013 · 3 comments
Closed

go/types: no error on "x int = complex(1<<s, 2)" #5029

remyoudompheng opened this issue Mar 11, 2013 · 3 comments

Comments

@remyoudompheng
Copy link
Contributor

What steps will reproduce the problem?
1. Run gotype (code.google.com/p/go.exp/gotype) on:

package main

var (
      s uint = 20
      x int = complex(1<<s, 2)
)

What is the expected output? What do you see instead?

Expected: something like
truc.go:5:??: cannot assign complex(1<<s, 2) (untyped complex) to x of type int

Got: no error.

Please use labels and text to provide additional information.
@rsc
Copy link
Contributor

rsc commented Mar 12, 2013

Comment 1:

[The time for maybe has passed.]

@griesemer
Copy link
Contributor

Comment 2:

See https://golang.org/cl/8241043
This now reports:
gotype x.go 
x.go:5:23: invalid operation: shifted operand 1 (type float64) must be integer
x.go:5:15: cannot initialize x (type int) with complex(1 << s, 2) (value of type
complex128)

Owner changed to @griesemer.

Status changed to Accepted.

@griesemer
Copy link
Contributor

Comment 3:

This issue was closed by revision golang/exp@cc31dd1.

Status changed to Fixed.

zend pushed a commit to go-src/inotify that referenced this issue Apr 3, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants