Re: [go-nuts] Type inference in non-constant shift expressions

2018-12-30 Thread Caleb Spare
On Sun, Dec 30, 2018 at 12:05 PM Ian Lance Taylor wrote: > On Sat, Dec 29, 2018 at 11:12 PM Caleb Spare wrote: > > > > I noticed the following: > > > > package main > > > > func main() { > > x := float64(1 << 3) // fine (constant expression) > > > > v := uint(3) > > x = float64(1 << v) // invali

Re: [go-nuts] Type inference in non-constant shift expressions

2018-12-30 Thread Ian Lance Taylor
On Sat, Dec 29, 2018 at 11:12 PM Caleb Spare wrote: > > I noticed the following: > > package main > > func main() { > x := float64(1 << 3) // fine (constant expression) > > v := uint(3) > x = float64(1 << v) // invalid operation: 1 << uint(v) (shift of type float64) > > _ = x > } > > (playground: