cmd/compile: better error message when generics are used with -lang=go1.17 #47818
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
release-blocker
Milestone
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
allowVersion
error messages if users try to use generics with go1.17 or earlier./cc @griesemer @findleyr
The text was updated successfully, but these errors were encountered: