Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
82accf44
Commit
82accf44
authored
Jan 09, 2013
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/parser: better error message for declaration error
Fixes #4616. R=rsc CC=golang-dev
https://golang.org/cl/7069049
parent
f1cc0f44
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
1 deletion
+2
-1
src/pkg/go/parser/parser.go
src/pkg/go/parser/parser.go
+1
-1
src/pkg/go/parser/short_test.go
src/pkg/go/parser/short_test.go
+1
-0
No files found.
src/pkg/go/parser/parser.go
View file @
82accf44
...
...
@@ -149,7 +149,7 @@ func (p *parser) shortVarDecl(decl *ast.AssignStmt, list []ast.Expr) {
}
}
}
else
{
p
.
errorExpected
(
x
.
Pos
(),
"identifier"
)
p
.
errorExpected
(
x
.
Pos
(),
"identifier
on left side of :=
"
)
}
}
if
n
==
0
&&
p
.
mode
&
DeclarationErrors
!=
0
{
...
...
src/pkg/go/parser/short_test.go
View file @
82accf44
...
...
@@ -70,6 +70,7 @@ var invalids = []string{
`package p; func f() { select { case _ <- chan /* ERROR "expected expression" */ int: } };`
,
`package p; func f() { _ = (<-<- /* ERROR "expected 'chan'" */ chan int)(nil) };`
,
`package p; func f() { _ = (<-chan<-chan<-chan<-chan<-chan<- /* ERROR "expected channel type" */ int)(nil) };`
,
`package p; func f() { var t []int; t /* ERROR "expected identifier on left side of :=" */ [0] := 0 };`
,
}
func
TestInvalid
(
t
*
testing
.
T
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment