Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/desugar.ml
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,7 @@ and to_arg p : (Ir.arg * (Ir.exp -> Ir.exp)) =
(fun e -> blockE [letP (pat p) v] e)


and to_args cc p0 : (Ir.arg list * (Ir.exp -> Ir.exp)) =
let p = match p0.it, p0.note with
| S.ParP p1, _ -> p1
| S.TupP [p1], Type.Tup [n] -> { p0 with it = p1.it; note = n }
| _ -> p0 in

and to_args cc p : (Ir.arg list * (Ir.exp -> Ir.exp)) =
let n = cc.Value.n_args in
let tys = if n = 1 then [p.note] else T.as_seq p.note in

Expand Down
22 changes: 6 additions & 16 deletions src/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ seplist(X, SEP) :
| x=X { [x] }
| x=X SEP xs=seplist(X, SEP) { x::xs }

seplist1(X, SEP) :
| (* empty *) { [] }
| x=X SEP xs=seplist(X, SEP) { x::xs }


(* Basics *)

Expand Down Expand Up @@ -201,10 +197,8 @@ typ_obj :
{ tfs }

typ_nullary :
| LPAR t=typ RPAR
{ ParT(t) @! at $loc }
| LPAR ts=seplist1(typ_item, COMMA) RPAR
{ TupT(ts) @! at $sloc }
| LPAR ts=seplist(typ_item, COMMA) RPAR
{ (match ts with [t] -> ParT(t) | _ -> TupT(ts)) @! at $sloc }
| x=id tso=typ_args?
{ VarT(x, Lib.Option.get tso []) @! at $sloc }
| LBRACKET m=var_opt t=typ RBRACKET
Expand Down Expand Up @@ -337,10 +331,8 @@ exp_nullary :
{ VarE(x) @? at $sloc }
| l=lit
{ LitE(ref l) @? at $sloc }
| LPAR e=exp RPAR
{ e }
| LPAR es=seplist1(exp, COMMA) RPAR
{ TupE(es) @? at $sloc }
| LPAR es=seplist(exp, COMMA) RPAR
{ match es with [e] -> e | _ -> TupE(es) @? at $sloc }
| PRIM s=TEXT
{ PrimE(s) @? at $sloc }

Expand Down Expand Up @@ -482,10 +474,8 @@ pat_nullary :
{ VarP(x) @! at $sloc }
| l=lit
{ LitP(ref l) @! at $sloc }
| LPAR p=pat RPAR
{ ParP(p) @! p.at }
| LPAR ps=seplist1(pat_bin, COMMA) RPAR
{ TupP(ps) @! at $sloc }
| LPAR ps=seplist(pat_bin, COMMA) RPAR
{ (match ps with [p] -> ParP(p) | _ -> TupP(ps)) @! at $sloc }

pat_un :
| p=pat_nullary
Expand Down
8 changes: 0 additions & 8 deletions test/fail/ok/one-tuple-ambiguity.tc.ok
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
one-tuple-ambiguity.as:10.2-10.7: type error, expression of type
((),)
cannot produce expected type
()
one-tuple-ambiguity.as:16.3-16.5: type error, literal of type
Nat
does not have expected type
(Nat, Bool)
one-tuple-ambiguity.as:16.1-16.5: type error, expected function type, but expression produces type
()
one-tuple-ambiguity.as:21.2-21.16: type error, expression of type
((Nat, Bool),)
cannot produce expected type
(Nat, Bool)
6 changes: 3 additions & 3 deletions test/run-dfinity/ok/data-params.run-ir.ok
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data-params.as:46.19-46.27: warning, this pattern does not cover all possible values
data-params.as:118.19-118.27: warning, this pattern does not cover all possible values
data-params.as:190.19-190.27: warning, this pattern does not cover all possible values
data-params.as:46.18-46.28: warning, this pattern does not cover all possible values
data-params.as:118.18-118.28: warning, this pattern does not cover all possible values
data-params.as:190.18-190.28: warning, this pattern does not cover all possible values
1
3
6
Expand Down
6 changes: 3 additions & 3 deletions test/run-dfinity/ok/data-params.run-low.ok
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data-params.as:46.19-46.27: warning, this pattern does not cover all possible values
data-params.as:118.19-118.27: warning, this pattern does not cover all possible values
data-params.as:190.19-190.27: warning, this pattern does not cover all possible values
data-params.as:46.18-46.28: warning, this pattern does not cover all possible values
data-params.as:118.18-118.28: warning, this pattern does not cover all possible values
data-params.as:190.18-190.28: warning, this pattern does not cover all possible values
1
3
6
Expand Down
6 changes: 3 additions & 3 deletions test/run-dfinity/ok/data-params.run.ok
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data-params.as:46.19-46.27: warning, this pattern does not cover all possible values
data-params.as:118.19-118.27: warning, this pattern does not cover all possible values
data-params.as:190.19-190.27: warning, this pattern does not cover all possible values
data-params.as:46.18-46.28: warning, this pattern does not cover all possible values
data-params.as:118.18-118.28: warning, this pattern does not cover all possible values
data-params.as:190.18-190.28: warning, this pattern does not cover all possible values
1
3
6
Expand Down
6 changes: 3 additions & 3 deletions test/run-dfinity/ok/data-params.tc.ok
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data-params.as:46.19-46.27: warning, this pattern does not cover all possible values
data-params.as:118.19-118.27: warning, this pattern does not cover all possible values
data-params.as:190.19-190.27: warning, this pattern does not cover all possible values
data-params.as:46.18-46.28: warning, this pattern does not cover all possible values
data-params.as:118.18-118.28: warning, this pattern does not cover all possible values
data-params.as:190.18-190.28: warning, this pattern does not cover all possible values
6 changes: 3 additions & 3 deletions test/run-dfinity/ok/data-params.wasm.stderr.ok
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data-params.as:46.19-46.27: warning, this pattern does not cover all possible values
data-params.as:118.19-118.27: warning, this pattern does not cover all possible values
data-params.as:190.19-190.27: warning, this pattern does not cover all possible values
data-params.as:46.18-46.28: warning, this pattern does not cover all possible values
data-params.as:118.18-118.28: warning, this pattern does not cover all possible values
data-params.as:190.18-190.28: warning, this pattern does not cover all possible values
2 changes: 0 additions & 2 deletions test/run-dfinity/ok/nary-async.dvm-run.ok
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
W, hypervisor: call failed with trap message: Uncaught RuntimeError: unreachable
W, hypervisor: call failed with trap message: Uncaught RuntimeError: unreachable
W, hypervisor: call failed with trap message: Uncaught RuntimeError: unreachable
0_0
1_0
2_0
Expand Down
6 changes: 3 additions & 3 deletions test/run/ok/coverage.run-ir.ok
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ coverage.as:32.43-32.44: warning, this pattern is never matched
coverage.as:33.35-33.49: warning, this case is never reached
coverage.as:34.42-34.51: warning, this case is never reached
coverage.as:4.7-4.8: warning, this pattern does not cover all possible values
coverage.as:5.8-5.14: warning, this pattern does not cover all possible values
coverage.as:5.7-5.15: warning, this pattern does not cover all possible values
coverage.as:9.7-9.9: warning, this pattern does not cover all possible values
coverage.as:10.7-10.9: warning, this pattern does not cover all possible values
coverage.as:11.7-11.9: warning, this pattern does not cover all possible values
coverage.as:15.11-15.12: warning, this pattern does not cover all possible values
coverage.as:16.11-16.17: warning, this pattern does not cover all possible values
coverage.as:15.10-15.13: warning, this pattern does not cover all possible values
coverage.as:16.10-16.18: warning, this pattern does not cover all possible values
coverage.as:23.3-23.25: warning, the cases in this switch do not cover all possible values
coverage.as:24.3-24.36: warning, the cases in this switch do not cover all possible values
coverage.as:32.3-32.50: warning, the cases in this switch do not cover all possible values
Expand Down
6 changes: 3 additions & 3 deletions test/run/ok/coverage.run-low.ok
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ coverage.as:32.43-32.44: warning, this pattern is never matched
coverage.as:33.35-33.49: warning, this case is never reached
coverage.as:34.42-34.51: warning, this case is never reached
coverage.as:4.7-4.8: warning, this pattern does not cover all possible values
coverage.as:5.8-5.14: warning, this pattern does not cover all possible values
coverage.as:5.7-5.15: warning, this pattern does not cover all possible values
coverage.as:9.7-9.9: warning, this pattern does not cover all possible values
coverage.as:10.7-10.9: warning, this pattern does not cover all possible values
coverage.as:11.7-11.9: warning, this pattern does not cover all possible values
coverage.as:15.11-15.12: warning, this pattern does not cover all possible values
coverage.as:16.11-16.17: warning, this pattern does not cover all possible values
coverage.as:15.10-15.13: warning, this pattern does not cover all possible values
coverage.as:16.10-16.18: warning, this pattern does not cover all possible values
coverage.as:23.3-23.25: warning, the cases in this switch do not cover all possible values
coverage.as:24.3-24.36: warning, the cases in this switch do not cover all possible values
coverage.as:32.3-32.50: warning, the cases in this switch do not cover all possible values
Expand Down
6 changes: 3 additions & 3 deletions test/run/ok/coverage.run.ok
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ coverage.as:32.43-32.44: warning, this pattern is never matched
coverage.as:33.35-33.49: warning, this case is never reached
coverage.as:34.42-34.51: warning, this case is never reached
coverage.as:4.7-4.8: warning, this pattern does not cover all possible values
coverage.as:5.8-5.14: warning, this pattern does not cover all possible values
coverage.as:5.7-5.15: warning, this pattern does not cover all possible values
coverage.as:9.7-9.9: warning, this pattern does not cover all possible values
coverage.as:10.7-10.9: warning, this pattern does not cover all possible values
coverage.as:11.7-11.9: warning, this pattern does not cover all possible values
coverage.as:15.11-15.12: warning, this pattern does not cover all possible values
coverage.as:16.11-16.17: warning, this pattern does not cover all possible values
coverage.as:15.10-15.13: warning, this pattern does not cover all possible values
coverage.as:16.10-16.18: warning, this pattern does not cover all possible values
coverage.as:23.3-23.25: warning, the cases in this switch do not cover all possible values
coverage.as:24.3-24.36: warning, the cases in this switch do not cover all possible values
coverage.as:32.3-32.50: warning, the cases in this switch do not cover all possible values
Expand Down
6 changes: 3 additions & 3 deletions test/run/ok/coverage.tc.ok
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ coverage.as:32.43-32.44: warning, this pattern is never matched
coverage.as:33.35-33.49: warning, this case is never reached
coverage.as:34.42-34.51: warning, this case is never reached
coverage.as:4.7-4.8: warning, this pattern does not cover all possible values
coverage.as:5.8-5.14: warning, this pattern does not cover all possible values
coverage.as:5.7-5.15: warning, this pattern does not cover all possible values
coverage.as:9.7-9.9: warning, this pattern does not cover all possible values
coverage.as:10.7-10.9: warning, this pattern does not cover all possible values
coverage.as:11.7-11.9: warning, this pattern does not cover all possible values
coverage.as:15.11-15.12: warning, this pattern does not cover all possible values
coverage.as:16.11-16.17: warning, this pattern does not cover all possible values
coverage.as:15.10-15.13: warning, this pattern does not cover all possible values
coverage.as:16.10-16.18: warning, this pattern does not cover all possible values
coverage.as:23.3-23.25: warning, the cases in this switch do not cover all possible values
coverage.as:24.3-24.36: warning, the cases in this switch do not cover all possible values
coverage.as:32.3-32.50: warning, the cases in this switch do not cover all possible values
Expand Down
6 changes: 3 additions & 3 deletions test/run/ok/coverage.wasm.stderr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ coverage.as:32.43-32.44: warning, this pattern is never matched
coverage.as:33.35-33.49: warning, this case is never reached
coverage.as:34.42-34.51: warning, this case is never reached
coverage.as:4.7-4.8: warning, this pattern does not cover all possible values
coverage.as:5.8-5.14: warning, this pattern does not cover all possible values
coverage.as:5.7-5.15: warning, this pattern does not cover all possible values
coverage.as:9.7-9.9: warning, this pattern does not cover all possible values
coverage.as:10.7-10.9: warning, this pattern does not cover all possible values
coverage.as:11.7-11.9: warning, this pattern does not cover all possible values
coverage.as:15.11-15.12: warning, this pattern does not cover all possible values
coverage.as:16.11-16.17: warning, this pattern does not cover all possible values
coverage.as:15.10-15.13: warning, this pattern does not cover all possible values
coverage.as:16.10-16.18: warning, this pattern does not cover all possible values
coverage.as:23.3-23.25: warning, the cases in this switch do not cover all possible values
coverage.as:24.3-24.36: warning, the cases in this switch do not cover all possible values
coverage.as:32.3-32.50: warning, the cases in this switch do not cover all possible values
Expand Down