From 1fc4e9fcc623df313dcaaf541f08fc7a8415c67f Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 3 Aug 2010 12:20:29 -0700 Subject: [PATCH] Add tests and fix pexp bug. Closes #141. --- src/Makefile | 6 +++++- src/boot/fe/pexp.ml | 2 +- src/test/run-pass/child-outlives-parent.rs | 8 ++++++++ src/test/run-pass/constrained-type.rs | 14 ++++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 src/test/run-pass/child-outlives-parent.rs create mode 100644 src/test/run-pass/constrained-type.rs diff --git a/src/Makefile b/src/Makefile index a5e97152026..3d31fad3bc2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -381,11 +381,13 @@ TASK_XFAILS := test/run-pass/acyclic-unwind.rs \ test/run-pass/task-comm-9.rs \ test/run-pass/task-comm.rs \ test/run-pass/threads.rs \ - test/run-pass/yield.rs + test/run-pass/yield.rs TEST_XFAILS_X86 := $(TASK_XFAILS) \ test/run-pass/bind-obj-ctor.rs \ + test/run-pass/child-outlives-parent.rs \ test/run-pass/clone-with-exterior.rs \ + test/run-pass/constrained-type.rs \ test/run-pass/obj-as.rs \ test/run-pass/vec-slice.rs \ test/run-pass/fn-lval.rs \ @@ -424,10 +426,12 @@ TEST_XFAILS_LLVM := $(TASK_XFAILS) \ box-in-tup.rs \ box-unbox.rs \ cast.rs \ + child-outlives-parent.rs \ clone-with-exterior.rs \ comm.rs \ command-line-args.rs \ complex.rs \ + constrained-type.rs \ deep.rs \ deref.rs \ destructor-ordering.rs \ diff --git a/src/boot/fe/pexp.ml b/src/boot/fe/pexp.ml index 1532a47a612..9b870639f52 100644 --- a/src/boot/fe/pexp.ml +++ b/src/boot/fe/pexp.ml @@ -121,7 +121,7 @@ and parse_carg_base (ps:pstate) : Ast.carg_base = and parse_carg (ps:pstate) : Ast.carg = match peek ps with - IDENT _ -> + IDENT _ | STAR -> begin let base = Ast.CARG_base (parse_carg_base ps) in let path = diff --git a/src/test/run-pass/child-outlives-parent.rs b/src/test/run-pass/child-outlives-parent.rs new file mode 100644 index 00000000000..d7d7c344302 --- /dev/null +++ b/src/test/run-pass/child-outlives-parent.rs @@ -0,0 +1,8 @@ +// Reported as issue #126, child leaks the string. + +fn child2(str s) { +} + +fn main() { + auto x = spawn child2("hi"); +} \ No newline at end of file diff --git a/src/test/run-pass/constrained-type.rs b/src/test/run-pass/constrained-type.rs new file mode 100644 index 00000000000..88a39ec8c1d --- /dev/null +++ b/src/test/run-pass/constrained-type.rs @@ -0,0 +1,14 @@ +// -*- rust -*- + +// Reported as issue #141, as a parse error. Ought to work in full though. + +type list = tag(cons(int,@list), nil()); +type bubu = rec(int x, int y); + + +fn less_than(int x, int y) -> bool { ret x < y; } + +type ordered_range = rec(int low, int high) : less_than(*.low, *.high); + +fn main() { +}