case _Lbrack:
p.next()
- if p.tok == _Rbrack {
- // invalid empty instance, slice or index expression; accept but complain
- p.syntaxError("expecting operand")
- p.next()
- break
- }
-
var i Expr
if p.tok != _Colon {
var comma bool
- i, comma = p.typeList()
+ if p.tok == _Rbrack {
+ // invalid empty instance, slice or index expression; accept but complain
+ p.syntaxError("expecting operand")
+ i = p.badExpr()
+ } else {
+ i, comma = p.typeList()
+ }
if comma || p.tok == _Rbrack {
p.want(_Rbrack)
- // x[i,] or x[i, j, ...]
+ // x[], x[i,] or x[i, j, ...]
t := new(IndexExpr)
t.pos = pos
t.X = x
// crash 26
type T26 = interface{ F26[ /* ERROR interface method must have no type parameters */ Z any]() }
-func F26[Z any]() T26 { return F26 /* ERROR without instantiation */ [] /* ERROR operand */ }
+func F26[Z any]() T26 { return F26[] /* ERROR operand */ }
// crash 27
func e27[T any]() interface{ x27 /* ERROR not a type */ } { panic(0) }
// crash 26
type T26 = interface{ F26[ /* ERROR interface method must have no type parameters */ Z any]() }
-// The error messages on the line below differ from types2 because for backward
-// compatibility go/parser must produce an IndexExpr with BadExpr index for the
-// expression F26[].
func F26[Z any]() T26 { return F26[] /* ERROR operand */ }
// crash 27