Commit 9efd6b8a authored by Ken Thompson's avatar Ken Thompson

compiler falut for forgetting

the assignment on a type switch

R=r
OCL=27048
CL=27048
parent 58f5f4f1
...@@ -763,6 +763,13 @@ typeswitch(Node *sw) ...@@ -763,6 +763,13 @@ typeswitch(Node *sw)
Case *c, *c0, *c1; Case *c, *c0, *c1;
int ncase; int ncase;
if(sw->ntest == nil)
return;
if(sw->ntest->right == nil) {
setlineno(sw);
yyerror("type switch must have an assignment");
return;
}
walktype(sw->ntest->right, Erv); walktype(sw->ntest->right, Erv);
if(!istype(sw->ntest->right->type, TINTER)) { if(!istype(sw->ntest->right->type, TINTER)) {
yyerror("type switch must be on an interface"); yyerror("type switch must be on an interface");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment