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
029457aa
Commit
029457aa
authored
Feb 27, 2013
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/types: don't crash when assigning to undefined variables
R=adonovan CC=golang-dev
https://golang.org/cl/7369059
parent
877153f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
src/pkg/go/types/stmt.go
src/pkg/go/types/stmt.go
+4
-0
src/pkg/go/types/testdata/stmt0.src
src/pkg/go/types/testdata/stmt0.src
+2
-0
No files found.
src/pkg/go/types/stmt.go
View file @
029457aa
...
...
@@ -62,6 +62,10 @@ func (check *checker) assign1to1(lhs, rhs ast.Expr, x *operand, decl bool, iota
}
}
if
x
.
mode
==
invalid
||
z
.
mode
==
invalid
{
return
}
check
.
assignOperand
(
&
z
,
x
)
if
x
.
mode
!=
invalid
&&
z
.
mode
==
constant
{
check
.
errorf
(
x
.
pos
(),
"cannot assign %s to %s"
,
x
,
&
z
)
...
...
src/pkg/go/types/testdata/stmt0.src
View file @
029457aa
...
...
@@ -32,6 +32,8 @@ func _() {
var
u64
uint64
u64
+=
1
<<
u64
undeclared
/*
ERROR
"undeclared"
*/
=
991
}
func
_incdecs
()
{
...
...
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