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
6e03ed32
Commit
6e03ed32
authored
Feb 17, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: interface error message fixes
Fixes #1526. R=ken2 CC=golang-dev
https://golang.org/cl/4190051
parent
dd7403b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
subr.c
src/cmd/gc/subr.c
+6
-2
typecheck.c
src/cmd/gc/typecheck.c
+2
-2
No files found.
src/cmd/gc/subr.c
View file @
6e03ed32
...
...
@@ -1909,8 +1909,12 @@ assignop(Type *src, Type *dst, char **why)
return
0
;
}
if
(
src
->
etype
==
TINTER
&&
dst
->
etype
!=
TBLANK
)
{
if
(
why
!=
nil
)
*
why
=
": need type assertion"
;
if
(
why
!=
nil
)
{
if
(
isptrto
(
dst
,
TINTER
))
*
why
=
smprint
(
":
\n\t
%T is interface, not pointer to interface"
,
src
);
else
*
why
=
": need type assertion"
;
}
return
0
;
}
...
...
src/cmd/gc/typecheck.c
View file @
6e03ed32
...
...
@@ -1613,7 +1613,7 @@ typecheckaste(int op, Node *call, int isddd, Type *tstruct, NodeList *nl, char *
exportassignok
(
tn
->
type
,
desc
);
if
(
assignop
(
tn
->
type
,
tl
->
type
->
type
,
&
why
)
==
0
)
{
if
(
call
!=
N
)
yyerror
(
"cannot use %T as type %T in argument to %#N%s"
,
tn
->
type
,
tl
->
type
->
type
,
desc
,
call
,
why
);
yyerror
(
"cannot use %T as type %T in argument to %#N%s"
,
tn
->
type
,
tl
->
type
->
type
,
call
,
why
);
else
yyerror
(
"cannot use %T as type %T in %s%s"
,
tn
->
type
,
tl
->
type
->
type
,
desc
,
why
);
}
...
...
@@ -1625,7 +1625,7 @@ typecheckaste(int op, Node *call, int isddd, Type *tstruct, NodeList *nl, char *
exportassignok
(
tn
->
type
,
desc
);
if
(
assignop
(
tn
->
type
,
tl
->
type
,
&
why
)
==
0
)
{
if
(
call
!=
N
)
yyerror
(
"cannot use %T as type %T in argument to %#N%s"
,
tn
->
type
,
tl
->
type
,
desc
,
call
,
why
);
yyerror
(
"cannot use %T as type %T in argument to %#N%s"
,
tn
->
type
,
tl
->
type
,
call
,
why
);
else
yyerror
(
"cannot use %T as type %T in %s%s"
,
tn
->
type
,
tl
->
type
,
desc
,
why
);
}
...
...
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