Fixed the parsing of [a * b -> c] as [(a * b) -> c].

This commit is contained in:
Christian Rinderknecht 2020-01-24 14:15:07 +01:00
parent 1a1a8d986c
commit 47a41971d7

View File

@ -141,23 +141,23 @@ type_decl:
in {region; value} }
type_expr:
sum_type | record_type | cartesian { $1 }
fun_type | sum_type | record_type { $1 }
cartesian:
function_type { $1 }
| function_type "*" nsepseq(function_type,"*") {
let value = Utils.nsepseq_cons $1 $2 $3 in
let region = nsepseq_to_region type_expr_to_region value
in TProd {region; value} }
function_type:
core_type { $1 }
| core_type "->" function_type {
fun_type:
cartesian { $1 }
| cartesian "->" fun_type {
let start = type_expr_to_region $1
and stop = type_expr_to_region $3 in
let region = cover start stop in
TFun {region; value = $1,$2,$3} }
cartesian:
core_type { $1 }
| core_type "*" nsepseq(core_type,"*") {
let value = Utils.nsepseq_cons $1 $2 $3 in
let region = nsepseq_to_region type_expr_to_region value
in TProd {region; value} }
core_type:
type_name { TVar $1 }
| par(type_expr) { TPar $1 }