Re: [go-nuts] Generics and formatting

2021-01-06 Thread Ivan Majeru
If I understand right the panic is because the `m := NewMap[string, int]` is a function not a function call and after that you try to assign to this function `m[int]`. This works https://go2goplay.golang.org/p/NOaPH-dJyWd . On Tue, 2021-01-05 at 08:10 -0800, Brian Candler wrote: > I don't know if t

Re: [go-nuts] Generics and formatting

2021-01-06 Thread Brian Candler
On 06/01/2021 21:52, Ivan Majeru wrote: If I understand right the panic is because the `m := NewMap[string, int]` is a function not a function call and after that you try to assign to this function `m[int]`. This works https://go2goplay.golang.org/p/NOaPH-dJyWd

Re: [go-nuts] Generics and formatting

2021-01-05 Thread Ian Lance Taylor
On Tue, Jan 5, 2021 at 8:11 AM Brian Candler wrote: > > I don't know if this is expected, but this (bad) program causes the go2go > playground to give "panic: assertion failed" > > https://go2goplay.golang.org/p/VH5SLJNxw3X > > - I think it's the compiler itself that's panicing, not the runtime (

Re: [go-nuts] Generics and formatting

2021-01-05 Thread Brian Candler
Here's another unhelpful error: https://go2goplay.golang.org/p/GDxiXiIIti7 Error: "prog.go2:7:11: all type parameters must be named" Actual problem: the type parameters *were* named, but no constraint was given. func blah[T1, T2](x T1) T2 { // wrong func blah[T1, T2 any](x T1) T2 { // fixed

Re: [go-nuts] Generics and formatting

2021-01-05 Thread Brian Candler
I don't know if this is expected, but this (bad) program causes the go2go playground to give "panic: assertion failed" https://go2goplay.golang.org/p/VH5SLJNxw3X - I think it's the compiler itself that's panicing, not the runtime (since it doesn't get as far as the next line). Aside: my

Re: [go-nuts] Generics and formatting

2021-01-02 Thread Ian Lance Taylor
On Sat, Jan 2, 2021 at 10:28 AM 'Brian Candler' via golang-nuts wrote: > > Raised as https://github.com/golang/go/issues/43470 Thanks. Ian > On Friday, 1 January 2021 at 18:40:36 UTC Ian Lance Taylor wrote: >> >> On Fri, Jan 1, 2021 at 9:50 AM 'Brian Candler' via golang-nuts >> wrote: >> > >

Re: [go-nuts] Generics and formatting

2021-01-02 Thread 'Brian Candler' via golang-nuts
Raised as https://github.com/golang/go/issues/43470 On Friday, 1 January 2021 at 18:40:36 UTC Ian Lance Taylor wrote: > On Fri, Jan 1, 2021 at 9:50 AM 'Brian Candler' via golang-nuts > wrote: > > > > Just a minor issue, but playing with this example: > > https://go2goplay.golang.org/p/IUL1QDrtOw

Re: [go-nuts] Generics and formatting

2021-01-01 Thread Ian Lance Taylor
On Fri, Jan 1, 2021 at 9:50 AM 'Brian Candler' via golang-nuts wrote: > > Just a minor issue, but playing with this example: > https://go2goplay.golang.org/p/IUL1QDrtOwW > - click "Run" and it works > - click "Format" and it fails with the following error: > > prog.go:40:24: expected ']', found ',

[go-nuts] Generics and formatting

2021-01-01 Thread 'Brian Candler' via golang-nuts
Just a minor issue, but playing with this example: https://go2goplay.golang.org/p/IUL1QDrtOwW - click "Run" and it works - click "Format" and it fails with the following error: prog.go:40:24: expected ']', found ',' (and 6 more errors) -- You received this message because you are subscribed to t