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
A parenthesized type assertion in a comma,ok context doesn't get a recorded comma-ok
type: it gets a scalar type and only the enclosing ParenExpr gets a tuple.
I've instrumented the record functions below so you can see it in the log.
cheers
alan
% cat c.go
package main
func main() {
var i interface{}
v, ok := (i.(*int))
print(v, ok)
}
% ./ssadump c.go
recordTypeAndValue("<expr *ast.InterfaceType>", interface{})
recordTypeAndValue("i", interface{})
recordTypeAndValue("int", int)
recordTypeAndValue("*int", *int)
recordTypeAndValue("i.(*int)", *int)
recordTypeAndValue("(i.(*int))", *int)
recordCommaOkTypes("(i.(*int))", *int, bool)
recordTypeAndValue("print", invalid type)
recordTypeAndValue("v", *int)
recordTypeAndValue("ok", bool)
recordTypeAndValue("print", func(*int, bool))
recordTypeAndValue("print(v, ok)", ())
panic: interface conversion: types.Type is *types.Pointer, not *types.Tuple
code.google.com/p/go.tools/ssa.(*builder).exprN(0x7f8288597c8f, 0xc210021b40,
0x7f828871f838, 0xc210037cf0, 0x7f828871fa01, ...)
/home/adonovan/go3/got/src/code.google.com/p/go.tools/ssa/builder.go:216 +0x857
...
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: