compiler: disallow generic type decl

Need to be reverted and properly handled within the scope of #2376.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2023-08-16 18:33:03 +03:00
parent 380de580a7
commit 35c3b65c8a
3 changed files with 69 additions and 0 deletions

View file

@ -566,6 +566,13 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
// x = 2
// )
case *ast.GenDecl:
// Filter out generics usage.
err := c.checkGenericsGenDecl(n, c.currPkg.PkgPath)
if err != nil {
c.prog.Err = err
return nil // Program is invalid.
}
if n.Tok == token.VAR || n.Tok == token.CONST {
c.saveSequencePoint(n)
}