diff --git a/src/cmd/gc/swt.c b/src/cmd/gc/swt.c index 2ed8216bc0..fbc9c49030 100644 --- a/src/cmd/gc/swt.c +++ b/src/cmd/gc/swt.c @@ -777,11 +777,12 @@ typeswitch(Node *sw) // binary search among cases to narrow by hash cas = list(cas, typebsw(c1, ncase)); } - - cas = list(cas, def); - sw->nbody = concat(cas, sw->nbody); - sw->list = nil; - walkstmtlist(sw->nbody); + if(nerrors == 0) { + cas = list(cas, def); + sw->nbody = concat(cas, sw->nbody); + sw->list = nil; + walkstmtlist(sw->nbody); + } } void