newer version
authorceriel <none@none>
Tue, 22 Apr 1986 23:22:19 +0000 (23:22 +0000)
committerceriel <none@none>
Tue, 22 Apr 1986 23:22:19 +0000 (23:22 +0000)
lang/m2/comp/chk_expr.c
lang/m2/comp/declar.g
lang/m2/comp/typequiv.c
lang/m2/comp/walk.c

index bf9c58c..22d91ea 100644 (file)
@@ -369,7 +369,7 @@ left->nd_def->df_idf->id_text, left->nd_def->df_value.df_stdname));
                                        /* A dynamic array has no explicit
                                           index type
                                        */
-                                       expp->nd_type = int_type;
+                                       expp->nd_type = intorcard_type;
                                }
                                else    cstcall(expp, S_MAX);
                                break;
@@ -667,16 +667,19 @@ node_error(expp, "IN operator: type of LHS not compatible with element type of R
        }
 
        if (expp->nd_symb == '[') {
-               /* Handle ARRAY selection specially too! */
+               /* Handle ARRAY selection specially too!
+               */
                if (tpl->tp_fund != T_ARRAY) {
                        node_error(expp,
                                   "array index not belonging to an ARRAY");
                        return 0;
                }
-               if (!TstCompat(tpl->next, tpr)) {
+
+               if ((tpl->next && !TstCompat(tpl->next, tpr)) ||
+                   (!tpl->next && !TstCompat(intorcard_type, tpr)) {
                        node_error(expp, "incompatible index type");
-                       return 0;
                }
+
                expp->nd_type = tpl->arr_elem;
                return 1;
        }
index b42921f..abd63d3 100644 (file)
@@ -61,7 +61,7 @@ ProcedureHeading(struct def **pdf; int type;)
                        /* We already saw a definition of this type
                           in the definition module.
                        */
-                       if (!TstTypeEquiv(tp, df->df_type)) {
+                       if (!TstProcEquiv(tp, df->df_type)) {
 error("inconsistent procedure declaration for \"%s\"", df->df_idf->id_text); 
                        }
                        FreeType(df->df_type);
index 3054afc..4c48a30 100644 (file)
@@ -95,6 +95,10 @@ TstCompat(tp1, tp2)
                &&
                   (tp2 == int_type || tp2 == card_type)
                )
+           ||
+               (tp1 == char_type && tp2 == charc_type)
+           ||
+               (tp2 == char_type && tp1 == charc_type)
            ||
                (  tp2 == intorcard_type
                &&
index 653b6db..6324b8b 100644 (file)
@@ -272,7 +272,7 @@ ExpectBool(nd)
 
        chk_expr(nd);
 
-       if (nd->nd_type != bool_type) {
+       if (nd->nd_type != bool_type && nd->nd_type != error_type) {
                node_error(nd, "boolean expression expected");
        }