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

+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()