wreck.mtv=; cat x.go
package main
var x = string.Split()
wreck.mtv=; 6g x.go
x.go:2: type string used as expression
x.go:2: undefined DOT Split on string
x.go:3: illegal types for operand: AS
undefined
wreck.mtv=;
BUG=
1938751
R=ken
OCL=30766
CL=30766
return;
}
// avoided repeated calculations, errors
- if(cvttype(n->type, t)) {
+ if(cvttype(n->type, t) == 1) {
n->type = t;
return;
}
n->val = v;
// check range.
- lno = lineno;
- lineno = n->lineno;
+ lno = setlineno(n);
overflow(v, n->type);
lineno = lno;
int32 lno;
lno = lineno;
- if(n != N && n->op != ONAME) {
+ if(n != N)
+ switch(n->op) {
+ case ONAME:
+ case OTYPE:
+ case OPACK:
+ case OLITERAL:
+ break;
+ default:
lineno = n->lineno;
if(lineno == 0) {
if(debug['K'])
return;
more = N;
- switch(n->op) {
- case ONAME: // one only; lineno isn't right for right now
- case OPACK:
- case OTYPE:
- case OLITERAL:
- break;
- default:
- lineno = n->lineno;
- }
+ setlineno(n);
switch(n->op) {
fatal("walktype: switch 1 unknown op %N", n);
goto ret;
+ case OTYPE:
+ if(!n->diag) {
+ n->diag = 1;
+ yyerror("type %T used as expression", n->type);
+ }
+ goto ret;
+
case ODCL:
goto ret;
n->op = ODOTPTR;
}
- if(!lookdot(n, t))
- yyerror("undefined DOT %S on %T", n->right->sym, n->left->type);
+ if(!lookdot(n, t)) {
+ if(!n->diag) {
+ n->diag = 1;
+ yyerror("undefined DOT %S on %T", n->right->sym, n->left->type);
+ }
+ }
}
Node*