Currently, when compiling with -G=3 -lang=go1.17, we run the types2 typechecker, but parse without the AllowGenerics flag. The result is when users try to write generic code, they'll get syntax error messages like unexpected [, expecting (, which seems to be a recurring source of confusion and leaves users (incl. expert Go users) uncertain of how to proceed.
I think we should probably instead always parse with AllowGenerics (at least when we're going to use types2), and have types2 report the usual allowVersion error messages if users try to use generics with go1.17 or earlier.
/cc @griesemer @findleyr
Currently, when compiling with
-G=3 -lang=go1.17, we run the types2 typechecker, but parse without the AllowGenerics flag. The result is when users try to write generic code, they'll get syntax error messages likeunexpected [, expecting (, which seems to be a recurring source of confusion and leaves users (incl. expert Go users) uncertain of how to proceed.I think we should probably instead always parse with AllowGenerics (at least when we're going to use types2), and have types2 report the usual
allowVersionerror messages if users try to use generics with go1.17 or earlier./cc @griesemer @findleyr