You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
go version devel +4dfbf5ab9c Thu Jun 25 02:57:14 2020 +0000 linux/amd64
Does this issue reproduce with the latest release?
Tried with latest commit dev.go2go branch.
What did you do?
package main
typestack(typeT) []Tfuncmain() {
slice:= []int{}
_=stack(slice) // Error: slice (variable of type []int) is not a type// _ = stack(int)(slice) // Ok
}
In the current design draft type inference only works for function calls, not for type conversions. So this is working as expected.
In order to add this feature to the design draft I'd like to see some realistic code that would use it. It strikes me as being likely to be more confusing than readable.
What version of Go are you using (
go version
)?dev.go2go
branchDoes this issue reproduce with the latest release?
Tried with latest commit
dev.go2go
branch.What did you do?
https://go2goplay.golang.org/p/jACGE-qTJ5L
What did you expect to see?
Type inference to work when casting to generic type though to be fair I couldn't find anything related to that specific point in the design draft.
What did you see instead?
I had to provide the type parameter, then it worked.
The text was updated successfully, but these errors were encountered: