From 9f013687086937df8be81dd6a0ebd86fc750abf7 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Wed, 16 Aug 2017 19:26:04 +0100 Subject: Added the feature to bind type variables in patterns. The reason you want this is to do something like (note new parser only): ********* default Order dec type bits 'n:Int = vector('n - 1, 'n, dec, bit) val zeros : forall 'n. atom('n) -> bits('n) val decode : bool -> unit function decode b = { let 'datasize: {|32, 64|} = if b then 32 else 64; let imm: bits('datasize) = zeros(datasize); () } ********* for the ASL decode functions, where the typechecker now knows that the datasize variable and the length of imm are the same. --- src/parse_ast.ml | 1 + 1 file changed, 1 insertion(+) (limited to 'src/parse_ast.ml') diff --git a/src/parse_ast.ml b/src/parse_ast.ml index 54feaf29..3951ab51 100644 --- a/src/parse_ast.ml +++ b/src/parse_ast.ml @@ -234,6 +234,7 @@ pat_aux = (* Pattern *) | P_as of pat * id (* named pattern *) | P_typ of atyp * pat (* typed pattern *) | P_id of id (* identifier *) + | P_var of kid | P_app of id * (pat) list (* union constructor pattern *) | P_record of (fpat) list * bool (* struct pattern *) | P_vector of (pat) list (* vector pattern *) -- cgit v1.2.3