ALTree
changed the title
cmd/compile: incorrect error message on unclosed ] in map indexing
cmd/compile: incorrect error message on unclosed [ in map indexing
Aug 14, 2021
Note that is a syntax error and not a type-checking error, so the compiler doesn't know the type of m. In this case the parser assumes that the incomplete m[0 was going to be a slice expression and thus expected a : (slices tend to be more common than maps). The error should probably be syntax error: unexpected newline, expecting : or ].
The
expecting :
part of the error message is plainly wrong, as there's no way to get a program that compiles by putting a:
there.go/types correctly reports
expected ']', found newline
.cc @griesemer
The text was updated successfully, but these errors were encountered: