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

rejects valid shift expressions with different types #308

Closed
robpike opened this issue Jul 30, 2019 · 0 comments · Fixed by #370
Closed

rejects valid shift expressions with different types #308

robpike opened this issue Jul 30, 2019 · 0 comments · Fixed by #370
Labels
area/core bug Something isn't working
Milestone

Comments

@robpike
Copy link

robpike commented Jul 30, 2019

The following program sample.go triggers a compile-time error:

package main

func main() {
	var u uint64
	var v uint32
	println(u << v)
}

Expected result:

$ go run ./sample.go
0

Got:

$ yaegi ./sample.go
x.go:6:10: mismatched types .uint64 and .uint32

In a way I find this amusing, as shifts are a bitch to get right in Go. Took us ages even to figure out the spec.

@ldez ldez added area/core bug Something isn't working labels Jul 30, 2019
mvertes added a commit that referenced this issue Sep 18, 2019
Make an exception for shift operators when computing the type and
checking operands type consistency.

Fix #308
traefiker pushed a commit that referenced this issue Sep 18, 2019
Make an exception for shift operators when computing the type and
checking operands type consistency.

Fix #308
@traefiker traefiker added this to the alpha milestone Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants