mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 16:52:18 +01:00
check: reject io_bind an io_writer to a roslice
This commit is contained in:
1 parent
bf3afab25a
commit
d446e71e1f
1 file changed
+5
-2
+5
-2
@@ -163,7 +163,10 @@ func (q *checker) tcheckStatement(n *a.Node) error {
|
|||||||
arg1Typ := (*a.TypeExpr)(nil)
|
arg1Typ := (*a.TypeExpr)(nil)
|
||||||
switch n.Keyword() {
|
switch n.Keyword() {
|
||||||
case t.IDIOBind:
|
case t.IDIOBind:
|
||||||
arg1Typ = typeExprSliceU8
|
arg1Typ = typeExprRosliceU8
|
||||||
|
if n.IO().MType().Eq(typeExprIOWriter) {
|
||||||
|
arg1Typ = typeExprSliceU8
|
||||||
|
}
|
||||||
case t.IDIOForgetHistory:
|
case t.IDIOForgetHistory:
|
||||||
// No-op.
|
// No-op.
|
||||||
case t.IDIOLimit:
|
case t.IDIOLimit:
|
||||||
@@ -173,7 +176,7 @@ func (q *checker) tcheckStatement(n *a.Node) error {
|
|||||||
if err := q.tcheckExpr(n.Arg1(), 0); err != nil {
|
if err := q.tcheckExpr(n.Arg1(), 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if typ := n.Arg1().MType(); !typ.EqIgnoringRefinementsLHSReadOnly(arg1Typ) {
|
if typ := n.Arg1().MType(); !arg1Typ.EqIgnoringRefinementsLHSReadOnly(typ) {
|
||||||
return fmt.Errorf("check: %s expression %q, of type %q, does not have type %q",
|
return fmt.Errorf("check: %s expression %q, of type %q, does not have type %q",
|
||||||
n.Keyword().Str(q.tm), n.Arg1().Str(q.tm), typ.Str(q.tm), arg1Typ.Str(q.tm))
|
n.Keyword().Str(q.tm), n.Arg1().Str(q.tm), typ.Str(q.tm), arg1Typ.Str(q.tm))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user