diff --git a/Parser.mly b/Parser.mly index 62404c87a..76c829544 100644 --- a/Parser.mly +++ b/Parser.mly @@ -368,42 +368,21 @@ const_decl: } var_decl: - Var var COLON var_decl_type_expr ASS expr option(SEMI) { - let stop = - match $7 with - Some region -> region - | None -> expr_to_region $6 in + Var var COLON type_expr ASS extended_expr option(SEMI) { + let stop = match $7 with + Some region -> region + | None -> $6.region in let region = cover $1 stop in - let value = { - kwd_var = $1; - name = $2; - colon = $3; - var_type = $4; - assign = $5; - init = $6; - terminator = $7} - in {region; value} - } -| Var var COLON type_name type_tuple - ASS extended_expr option(SEMI) { - let region = cover $4.region $5.region in - let type_app = TypeApp {region; value=$4,$5} in - let cartesian = {region; value = type_app, []} in - let var_type = Prod cartesian in - let stop = match $8 with - Some region -> region - | None -> $7.region in - let region = cover $1 stop in let init = - match $7.value with + match $6.value with `Expr e -> e | `EList (lbracket, rbracket) -> - let region = $7.region + let region = $6.region and value = { lbracket; rbracket; colon = Region.ghost; - list_type = var_type} in + list_type = $4} in let value = { lpar = Region.ghost; inside = value; @@ -415,17 +394,17 @@ var_decl: inside = { c_None = region; colon = Region.ghost; - opt_type = var_type}; + opt_type = $4}; rpar = Region.ghost} in ConstrExpr (NoneExpr {region; value}) in let value = { kwd_var = $1; name = $2; colon = $3; - var_type; - assign = $6; + var_type = $4; + assign = $5; init; - terminator = $8} + terminator = $7} in {region; value} } @@ -436,21 +415,6 @@ extended_expr: value = `EList ($1,$2)} } | C_None { {region = $1; value = `ENone $1} } -var_decl_type_expr: - var_decl_cartesian { Prod $1 } -| sum_type { Sum $1 } -| record_type { Record $1 } - -var_decl_cartesian: - nsepseq(var_decl_core_type,TIMES) { - let region = nsepseq_to_region type_expr_to_region $1 - in {region; value=$1} - } - -var_decl_core_type: - type_name { TAlias $1 } -| par(type_expr) { ParType $1 } - instruction: single_instr { Single $1 } | block { Block $1 } diff --git a/Tests/crowdfunding.ligo b/Tests/crowdfunding.ligo index cead275ae..6434762e5 100644 --- a/Tests/crowdfunding.ligo +++ b/Tests/crowdfunding.ligo @@ -15,7 +15,7 @@ entrypoint contribute (storage store : state; if now > store.deadline then fail "Deadline passed" else - match store.backers[sender] with + case store.backers[sender] of None -> store := copy store with @@ -50,7 +50,7 @@ entrypoint claim (storage store : state; const sender : address) if now <= store.deadline then fail "Too soon" else - match store.backers[sender] with + case store.backers[sender] of None -> fail "Not a backer" | Some (amount) ->