Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
bebe06a7
Commit
bebe06a7
authored
Sep 02, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
type switch bug involving function parameter names
R=ken OCL=34232 CL=34232
parent
ad9fabd7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
subr.c
src/cmd/gc/subr.c
+6
-2
swt.c
src/cmd/gc/swt.c
+2
-2
bug200.go
test/fixedbugs/bug200.go
+19
-0
No files found.
src/cmd/gc/subr.c
View file @
bebe06a7
...
...
@@ -1920,8 +1920,12 @@ typehash(Type *at, int addsym, int d)
break
;
case
TSTRUCT
:
for
(
t
=
at
->
type
;
t
!=
T
;
t
=
t
->
down
)
h
+=
PRIME7
*
typehash
(
t
,
addsym
,
d
+
1
);
for
(
t
=
at
->
type
;
t
!=
T
;
t
=
t
->
down
)
{
if
(
at
->
funarg
)
// walk into TFIELD in function argument struct
h
+=
PRIME7
*
typehash
(
t
->
type
,
addsym
,
d
+
1
);
else
h
+=
PRIME7
*
typehash
(
t
,
addsym
,
d
+
1
);
}
break
;
case
TFUNC
:
...
...
src/cmd/gc/swt.c
View file @
bebe06a7
...
...
@@ -387,7 +387,7 @@ mkcaselist(Node *sw, int arg)
continue
;
setlineno
(
c1
->
link
->
node
);
yyerror
(
"duplicate case in switch"
);
print
(
"
previous case at %L
\n
"
,
print
(
"
\t
previous case at %L
\n
"
,
c1
->
node
->
lineno
);
}
break
;
...
...
@@ -400,7 +400,7 @@ mkcaselist(Node *sw, int arg)
continue
;
setlineno
(
c1
->
link
->
node
);
yyerror
(
"duplicate case in switch"
);
print
(
"
previous case at %L
\n
"
,
print
(
"
\t
previous case at %L
\n
"
,
c1
->
node
->
lineno
);
}
break
;
...
...
test/fixedbugs/bug200.go
0 → 100644
View file @
bebe06a7
// errchk $G $D/$F.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
main
func
main
()
{
// 6g used to compile these as two different
// hash codes so it missed the duplication
// and worse, compiled the wrong code
// for one of them.
var
x
interface
{};
switch
v
:=
x
.
(
type
)
{
case
func
(
int
)
:
case
func
(
f
int
)
:
// ERROR "duplicate"
}
}
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