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
f1fe21a0
Commit
f1fe21a0
authored
Jan 26, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug134
R=ken OCL=23532 CL=23532
parent
4efad58d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
7 deletions
+25
-7
src/cmd/gc/dcl.c
src/cmd/gc/dcl.c
+13
-6
src/cmd/gc/go.h
src/cmd/gc/go.h
+1
-1
test/fixedbugs/bug134.go
test/fixedbugs/bug134.go
+11
-0
No files found.
src/cmd/gc/dcl.c
View file @
f1fe21a0
...
...
@@ -313,9 +313,9 @@ addmethod(Node *n, Type *t, int local)
}
if
(
d
==
T
)
stotype
(
n
,
&
pa
->
method
);
stotype
(
n
,
0
,
&
pa
->
method
);
else
stotype
(
n
,
&
d
->
down
);
stotype
(
n
,
0
,
&
d
->
down
);
if
(
dflag
())
print
(
"method %S of type %T
\n
"
,
sf
,
pa
);
...
...
@@ -472,36 +472,43 @@ funcbody(Node *n)
* turn a parsed struct into a type
*/
Type
**
stotype
(
Node
*
n
,
Type
**
t
)
stotype
(
Node
*
n
,
int
et
,
Type
**
t
)
{
Type
*
f
;
Iter
save
;
String
*
note
;
int
lno
;
lno
=
lineno
;
n
=
listfirst
(
&
save
,
&
n
);
loop:
note
=
nil
;
if
(
n
==
N
)
{
*
t
=
T
;
lineno
=
lno
;
return
t
;
}
lineno
=
n
->
lineno
;
if
(
n
->
op
==
OLIST
)
{
// recursive because it can be lists of lists
t
=
stotype
(
n
,
t
);
t
=
stotype
(
n
,
et
,
t
);
goto
next
;
}
if
(
n
->
op
!=
ODCLFIELD
||
n
->
type
==
T
)
fatal
(
"stotype: oops %N
\n
"
,
n
);
if
(
et
==
TSTRUCT
&&
n
->
type
->
etype
==
TFUNC
)
yyerror
(
"bad structure field type: %T"
,
n
->
type
);
switch
(
n
->
val
.
ctype
)
{
case
CTSTR
:
note
=
n
->
val
.
u
.
sval
;
break
;
default:
yyerror
(
"
structure
field annotation must be string"
);
yyerror
(
"field annotation must be string"
);
case
CTxxx
:
note
=
nil
;
break
;
...
...
@@ -546,7 +553,7 @@ dostruct(Node *n, int et)
}
t
=
typ
(
et
);
t
->
funarg
=
funarg
;
stotype
(
n
,
&
t
->
type
);
stotype
(
n
,
et
,
&
t
->
type
);
if
(
!
funarg
)
checkwidth
(
t
);
return
t
;
...
...
src/cmd/gc/go.h
View file @
f1fe21a0
...
...
@@ -707,7 +707,7 @@ void funchdr(Node*);
void
funcargs
(
Type
*
);
void
funcbody
(
Node
*
);
Type
*
dostruct
(
Node
*
,
int
);
Type
**
stotype
(
Node
*
,
Type
**
);
Type
**
stotype
(
Node
*
,
int
,
Type
**
);
Type
*
sortinter
(
Type
*
);
void
markdcl
(
void
);
void
popdcl
(
void
);
...
...
test/fixedbugs/bug134.go
0 → 100644
View file @
f1fe21a0
// 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.
// errchk $G $D/$F.go
package
main
type
T
struct
{
v
();
// ERROR "field type"
}
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