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
680ee6af
Commit
680ee6af
authored
Oct 08, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add & fix bug208, from ken.
fix bug198. R=ken OCL=35504 CL=35507
parent
98fff8ff
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
12 deletions
+42
-12
src/cmd/gc/dcl.c
src/cmd/gc/dcl.c
+8
-0
src/cmd/gc/go.h
src/cmd/gc/go.h
+1
-0
src/cmd/gc/typecheck.c
src/cmd/gc/typecheck.c
+11
-4
test/fixedbugs/bug198.go
test/fixedbugs/bug198.go
+2
-1
test/fixedbugs/bug208.go
test/fixedbugs/bug208.go
+20
-0
test/golden.out
test/golden.out
+0
-7
No files found.
src/cmd/gc/dcl.c
View file @
680ee6af
...
...
@@ -781,6 +781,10 @@ stotype(NodeList *l, int et, Type **t)
if
(
n
->
right
!=
N
)
{
typecheck
(
&
n
->
right
,
Etype
);
n
->
type
=
n
->
right
->
type
;
if
(
n
->
type
==
T
)
{
*
t0
=
T
;
return
t0
;
}
if
(
n
->
left
!=
N
)
n
->
left
->
type
=
n
->
type
;
n
->
right
=
N
;
...
...
@@ -886,6 +890,10 @@ dostruct(NodeList *l, int et)
t
=
typ
(
et
);
t
->
funarg
=
funarg
;
stotype
(
l
,
et
,
&
t
->
type
);
if
(
t
->
type
==
T
&&
l
!=
nil
)
{
t
->
broke
=
1
;
return
t
;
}
if
(
!
funarg
)
checkwidth
(
t
);
return
t
;
...
...
src/cmd/gc/go.h
View file @
680ee6af
...
...
@@ -145,6 +145,7 @@ struct Type
uchar
copyany
;
uchar
local
;
// created in this file
uchar
deferwidth
;
uchar
broke
;
Node
*
nod
;
// canonical OTYPE node
int
lineno
;
...
...
src/cmd/gc/typecheck.c
View file @
680ee6af
...
...
@@ -81,10 +81,12 @@ typecheck(Node **np, int top)
n
->
typecheck
=
2
;
redo:
if
(
n
->
sym
)
walkdef
(
n
);
lno
=
setlineno
(
n
);
if
(
n
->
sym
)
{
walkdef
(
n
);
if
(
n
->
op
==
ONONAME
)
goto
error
;
}
reswitch:
ok
=
0
;
...
...
@@ -683,6 +685,8 @@ reswitch:
ok
|=
Erv
;
if
(
t
->
outtuple
==
1
)
{
t
=
getoutargx
(
l
->
type
)
->
type
;
if
(
t
==
T
)
goto
error
;
if
(
t
->
etype
==
TFIELD
)
t
=
t
->
type
;
n
->
type
=
t
;
...
...
@@ -1384,6 +1388,9 @@ typecheckaste(int op, Type *tstruct, NodeList *nl)
lno
=
lineno
;
if
(
tstruct
->
broke
)
goto
out
;
if
(
nl
!=
nil
&&
nl
->
next
==
nil
&&
(
n
=
nl
->
n
)
->
type
!=
T
)
if
(
n
->
type
->
etype
==
TSTRUCT
&&
n
->
type
->
funarg
)
{
setlineno
(
n
);
...
...
@@ -1592,7 +1599,6 @@ typecheckcomplit(Node **np)
memset
(
hash
,
0
,
sizeof
hash
);
// TODO: dup detection
l
=
typecheck
(
&
n
->
right
/* sic */
,
Etype
/* TODO | Edotarray */
);
if
((
t
=
l
->
type
)
==
T
)
goto
error
;
...
...
@@ -1699,6 +1705,7 @@ typecheckcomplit(Node **np)
typecheck
(
&
l
->
right
,
Erv
);
continue
;
}
l
->
left
=
newname
(
l
->
left
->
sym
);
l
->
left
->
typecheck
=
1
;
f
=
lookdot1
(
l
->
left
->
sym
,
t
,
t
->
type
);
typecheck
(
&
l
->
right
,
Erv
);
...
...
test/bugs/bug198.go
→
test/
fixed
bugs/bug198.go
View file @
680ee6af
...
...
@@ -5,7 +5,8 @@
// license that can be found in the LICENSE file.
package
main
func
f
(
a
T
)
T
{
return
a
}
// ERROR "T
"
func
f
(
a
T
)
T
{
return
a
}
// ERROR "undefined
"
func
main
()
{
x
:=
f
(
0
);
_
=
x
;
}
test/fixedbugs/bug208.go
0 → 100644
View file @
680ee6af
// 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
type
T
struct
{
f
int
;
}
var
_
=
T
{
f
:
1
}
// 6g used to get confused by the f:1 above
// and allow uses of f that would be silently
// dropped during the compilation.
var
_
=
f
;
// ERROR "undefined"
test/golden.out
View file @
680ee6af
...
...
@@ -167,10 +167,3 @@ BUG: errchk: bugs/bug193.go:14: missing expected error: 'shift'
too many calls: 5
panic PC=xxx
BUG: bug196
=========== bugs/bug198.go
bugs/bug198.go:8: undefined: T
bugs/bug198.go:8: T is not a type
bugs/bug198.go:8: too many arguments to return
bugs/bug198.go:10: too many arguments to CALL
BUG: errchk: compiler crashed
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