aboutsummaryrefslogtreecommitdiff
path: root/test/syntax
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2017-02-08 17:30:45 -0800
committerRobert Griesemer <gri@golang.org>2017-02-09 01:45:17 +0000
commit9799622f09ba2ece6fa8eb7607d0d471d75d9915 (patch)
treeb7e4aaaf7e5ae59cb48ad6035aafa7bb708e97c8 /test/syntax
parent4f6d4bb3f4461e7e25eff24254115b689495e834 (diff)
downloadgo-9799622f09ba2ece6fa8eb7607d0d471d75d9915.tar.gz
go-9799622f09ba2ece6fa8eb7607d0d471d75d9915.zip
cmd/compile/internal/syntax: differentiate between ';' and '\n' in syntax errors
Towards better syntax error messages: With this change, the parser knows whether a semicolon was an actual ';' in the source, or whether it was an automatically inserted semicolon as result of a '\n' or EOF. Using this information in error messages makes them more understandable. For #17328. Change-Id: I8cd9accee8681b62569d0ecef922d38682b401eb Reviewed-on: https://go-review.googlesource.com/36636 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test/syntax')
-rw-r--r--test/syntax/semi6.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/syntax/semi6.go b/test/syntax/semi6.go
index 325cc27425..4a04f89ddb 100644
--- a/test/syntax/semi6.go
+++ b/test/syntax/semi6.go
@@ -6,6 +6,6 @@
package main
-type T // ERROR "unexpected semicolon or newline in type declaration"
-// line below uncommented to avoid follow-up error
-// { \ No newline at end of file
+type T1 // ERROR "unexpected newline in type declaration"
+
+type T2 /* // ERROR "unexpected EOF in type declaration" */ \ No newline at end of file