|
@@ -214,7 +214,8 @@ let rec typecheck node =
|
|
|
(* Array pointers cannot be re-assigned, because array dimension reduction
|
|
(* Array pointers cannot be re-assigned, because array dimension reduction
|
|
|
* makes assumptions about dimensions of an array *)
|
|
* makes assumptions about dimensions of an array *)
|
|
|
| VarLet (dec, None, _, _) when is_array dec ->
|
|
| VarLet (dec, None, _, _) when is_array dec ->
|
|
|
- raise (NodeError (node, "cannot re-assign array pointer"))
|
|
|
|
|
|
|
+ raise (NodeError (node, "cannot assign value to array pointer " ^
|
|
|
|
|
+ "after initialisation"))
|
|
|
|
|
|
|
|
(* Assigned values must match variable declaration *)
|
|
(* Assigned values must match variable declaration *)
|
|
|
| VarLet (dec, None, value, ann) ->
|
|
| VarLet (dec, None, value, ann) ->
|
|
@@ -234,6 +235,12 @@ let rec typecheck node =
|
|
|
|
|
|
|
|
VarLet (dec, Some dims, value, ann)
|
|
VarLet (dec, Some dims, value, ann)
|
|
|
|
|
|
|
|
|
|
+ (* ArrayConst initialisations are transformed during desugaring, so any
|
|
|
|
|
+ * occurrences that are left are illegal *)
|
|
|
|
|
+ | ArrayConst _ ->
|
|
|
|
|
+ raise (NodeError (node, "array constants can only be used in array " ^
|
|
|
|
|
+ "initialisation"))
|
|
|
|
|
+
|
|
|
| _ -> transform_children typecheck node
|
|
| _ -> transform_children typecheck node
|
|
|
|
|
|
|
|
let phase = function
|
|
let phase = function
|