Description
If a VarDecl has an explicit type expression, it will get evaluated once for each declared variable. So if you have a VarDecl like var x, y interface { M() }
you end up with two different *types2.Interface
objects.
I ran into this because I wanted to map all types2.Type
objects (that appeared in source) back to some syntactic element, so my initial approach was to just walk the AST looking for type expressions and then using Info.Types[expr].Type
to get the types2.Type
object and insert them into a map[types2.Type]syntax.Expr
map.
However, this approach missed some types, because of VarDecls with multiple variables and an explicit type expression.
I don't think this is strictly a violation of the types2 API (you're supposed to use types2.Identical), but I think it would be nice and less surprising if there was a 1:1 correspondance.
I assume this also affects go/types.
/cc @griesemer @findleyr
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status