Change status "?foo" to just "?foo"

This commit is contained in:
Nigel Tao committed 2018-11-24 12:36:42 +11:00
1 parent 5f9d007b1c
commit 875362ea07
14 files changed
+136 -152

No files matched your search

-3
View File
@@ -872,9 +872,6 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (a.Bounds, error) {
n.Ident().Str(q.tm), lTyp.QID().Str(q.tm), n.Str(q.tm))
}
case t.IDStatus:
// No-op.
case t.IDComma:
for _, o := range n.Args() {
if _, err := q.bcheckExpr(o.AsExpr(), depth); err != nil {
+10 -10
View File
@@ -383,6 +383,16 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
n.SetMType(typeExprIdeal)
return nil
} else if id1.IsStrLiteral(q.tm) {
if _, ok := q.c.statuses[n.StatusQID()]; !ok {
msg, _ := t.Unescape(n.Ident().Str(q.tm))
if _, ok := builtin.StatusMap[msg]; !ok {
return fmt.Errorf("check: no error or status with message %q", msg)
}
}
n.SetMType(typeExprStatus)
return nil
} else if id1.IsIdent(q.tm) {
if q.localVars != nil {
if typ, ok := q.localVars[id1]; ok {
@@ -489,16 +499,6 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
case t.IDDot:
return q.tcheckDot(n, depth)
case t.IDStatus:
if _, ok := q.c.statuses[n.StatusQID()]; !ok {
msg, _ := t.Unescape(n.Ident().Str(q.tm))
if _, ok := builtin.StatusMap[msg]; !ok {
return fmt.Errorf("check: no error or status with message %q", msg)
}
}
n.SetMType(typeExprStatus)
return nil
case t.IDComma:
for _, o := range n.Args() {
o := o.AsExpr()