mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Reject type refinements unless of numeric types
This commit is contained in:
1 parent
afc6bb9ec3
commit
f58db5a4d8
1 file changed
+6
@@ -556,6 +556,12 @@ func (p *parser) parseTypeExpr() (*a.TypeExpr, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if name.IsNumType() &&
|
||||
((pkg == t.IDBase) || ((pkg == 0) && p.opts.AllowBuiltInNames)) {
|
||||
// No-op.
|
||||
} else {
|
||||
return nil, fmt.Errorf(`parse: cannot refine non-numeric type at %s:%d`, p.filename, p.line())
|
||||
}
|
||||
}
|
||||
|
||||
return a.NewTypeExpr(0, pkg, name, lhs.AsNode(), mhs, nil), nil
|
||||
|
||||
Reference in new issue
Block a user