]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/syntax: better error msg for some 'if' statements
authorRobert Griesemer <gri@golang.org>
Thu, 11 Jan 2018 00:05:12 +0000 (16:05 -0800)
committerRobert Griesemer <gri@golang.org>
Mon, 12 Feb 2018 22:57:54 +0000 (22:57 +0000)
commitbe9a1774f274e5333bef873868bb28b93918d8e7
tree05b1a3ad456b6a4814c3b4920d21b71c8b6b9f83
parentac45cb9aa0154a84a63d18d87161dd39a2885449
cmd/compile/internal/syntax: better error msg for some 'if' statements

R=go1.11

A common error is to write '=' instead of '==' inside the condition
of a simple 'if' statement:

if x = 0 { ... }

Highlight the fact that we have an assignment in the error message
to prevent further confusion.

Fixes #23385.

Change-Id: I1552050fd6da927bd12a1be0977bd2e98eca5885
Reviewed-on: https://go-review.googlesource.com/87316
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/syntax/parser.go