summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-12-16 16:48:38 -0500
committerOri Bernstein <ori@eigenstate.org>2013-12-16 16:48:38 -0500
commit6db6735df5f0e8d44c591c0ff8130c47f94c5d37 (patch)
tree0f0109e5d1d57918f4d679a2062a19965605916a
parent10b54e590ef8bfd54c5dc9712d0864db4be4e1ce (diff)
downloadmc-6db6735df5f0e8d44c591c0ff8130c47f94c5d37.tar.gz
Convert main() to effectively return void.
Now, if we exit thorugh the end of main, we will ignore the return value, and call exit(0) from the start stub. If you want to exit with a different return value, you need to call std.exit(val)
-rw-r--r--libstd/start-linux.s4
-rw-r--r--libstd/start-osx.s2
-rw-r--r--test/add.myr2
-rw-r--r--test/arityhigh.myr4
-rw-r--r--test/aritylow.myr4
-rw-r--r--test/array.myr2
-rw-r--r--test/arrayaddr.myr2
-rw-r--r--test/arraylen.myr2
-rw-r--r--test/arraylit-ni.myr2
-rw-r--r--test/basicfloat.myr2
-rw-r--r--test/bigliteral.myr1
-rw-r--r--test/bsr.myr2
-rw-r--r--test/call.myr2
-rw-r--r--test/callbig.myr2
-rw-r--r--test/condiffalse.myr8
-rw-r--r--test/condifrel.myr8
-rw-r--r--test/condiftrue.myr8
-rw-r--r--test/derefassign.myr2
-rw-r--r--test/div.myr2
-rw-r--r--test/exportcycle.myr1
-rw-r--r--test/exportmain.myr2
-rw-r--r--test/fib.myr2
-rw-r--r--test/generic.myr2
-rw-r--r--test/genericcall.myr2
-rw-r--r--test/genericmatch.myr4
-rw-r--r--test/genericrec.myr1
-rw-r--r--test/genericret.myr4
-rw-r--r--test/generictype.myr6
-rw-r--r--test/genericval.myr4
-rw-r--r--test/global-arrayvar.myr2
-rw-r--r--test/gsizeof.myr2
-rw-r--r--test/helloworld.myr1
-rw-r--r--test/import-type.myr2
-rw-r--r--test/infer-named.myr6
-rw-r--r--test/livearraylit.myr2
-rw-r--r--test/livestructlit.myr2
-rw-r--r--test/local-labels.myr4
-rw-r--r--test/log-and.myr2
-rw-r--r--test/log-or.myr2
-rw-r--r--test/loop.myr2
-rw-r--r--test/main.myr2
-rw-r--r--test/match-badtypes.myr1
-rw-r--r--test/matchargunion.myr8
-rw-r--r--test/matcharray.myr4
-rw-r--r--test/matchbind.myr8
-rw-r--r--test/matchconst.myr6
-rw-r--r--test/matchint.myr12
-rw-r--r--test/matchmixed.myr2
-rw-r--r--test/matchstruct.myr4
-rw-r--r--test/matchtup.myr4
-rw-r--r--test/matchunion.myr8
-rw-r--r--test/matchunion_sl.myr3
-rw-r--r--test/mkunion.myr2
-rw-r--r--test/mod.myr2
-rw-r--r--test/mul.myr2
-rw-r--r--test/nestfn.myr2
-rw-r--r--test/neststruct.myr2
-rw-r--r--test/occur.myr4
-rw-r--r--test/outparam-sl.myr2
-rw-r--r--test/outparam.myr2
-rw-r--r--test/overlappingif.myr2
-rw-r--r--test/ptrpreinc.myr2
-rw-r--r--test/sizeof.myr2
-rw-r--r--test/slalloc.myr2
-rw-r--r--test/slgrow.myr2
-rw-r--r--test/slice.myr2
-rw-r--r--test/slicelen.myr2
-rw-r--r--test/splitline.myr4
-rw-r--r--test/sqrt.myr2
-rw-r--r--test/stdopt-mk.myr4
-rw-r--r--test/stdopt-none.myr4
-rw-r--r--test/stdopt-some.myr4
-rw-r--r--test/stdopt-struct.myr2
-rw-r--r--test/str.myr2
-rw-r--r--test/strsplit.myr1
-rw-r--r--test/strstrip.myr1
-rw-r--r--test/strtab.myr2
-rw-r--r--test/struct.myr2
-rw-r--r--test/struct1.myr2
-rw-r--r--test/structarray.myr2
-rw-r--r--test/structasn.myr2
-rw-r--r--test/structlit.myr2
-rw-r--r--test/structptr.myr2
-rw-r--r--test/structret.myr2
-rw-r--r--test/swidencast.myr2
-rw-r--r--test/trait-builtin.myr5
-rw-r--r--test/trunccast.myr2
-rw-r--r--test/tuple.myr2
-rw-r--r--test/tyrec.myr2
-rw-r--r--test/usedef.myr2
-rw-r--r--test/voidcall.myr2
-rw-r--r--test/zwidencast.myr2
92 files changed, 131 insertions, 138 deletions
diff --git a/libstd/start-linux.s b/libstd/start-linux.s
index 63cb306..378b9bc 100644
--- a/libstd/start-linux.s
+++ b/libstd/start-linux.s
@@ -97,8 +97,8 @@ _start:
/* enter the main program */
call main
- /* exit */
- movq %rax,%rdi
+ /* exit(0) */
+ xorq %rdi,%rdi
movq $60,%rax
syscall
diff --git a/libstd/start-osx.s b/libstd/start-osx.s
index d604951..4dd0a0e 100644
--- a/libstd/start-osx.s
+++ b/libstd/start-osx.s
@@ -98,7 +98,7 @@ start:
/* enter the main program */
call _main
/* exit */
- movq %rax,%rdi
+ xorq %rdi,%rdi
movq $0x2000001,%rax
syscall
diff --git a/test/add.myr b/test/add.myr
index cc85319..2761067 100644
--- a/test/add.myr
+++ b/test/add.myr
@@ -8,5 +8,5 @@ const main = {
a = 42
b = 11
c = 0_0
- -> a + b + c
+ std.exit(a + b + c)
}
diff --git a/test/arityhigh.myr b/test/arityhigh.myr
index 3cc4da1..35bbcb2 100644
--- a/test/arityhigh.myr
+++ b/test/arityhigh.myr
@@ -1,9 +1,9 @@
use std
/* should fail because we call f with too many args */
const f = {a:int
-
+ -> a
}
const main = {
- -> f(1, 2, 3)
+ std.exit(f(1, 2, 3))
}
diff --git a/test/aritylow.myr b/test/aritylow.myr
index 6405f79..9840b9f 100644
--- a/test/aritylow.myr
+++ b/test/aritylow.myr
@@ -1,9 +1,9 @@
use std
/* should fail because we call f with too few args */
const f = {a:int, b:int, c:int
-
+ -> a + b + c
}
const main = {
- -> f(1, 2)
+ std.exit(f(1, 2))
}
diff --git a/test/array.myr b/test/array.myr
index e27c611..92d6f83 100644
--- a/test/array.myr
+++ b/test/array.myr
@@ -5,5 +5,5 @@ const main = {
a[0] = 3
a[1] = 4
a[2] = a[0] + a[1]
- -> a[2]
+ std.exit(a[2])
}
diff --git a/test/arrayaddr.myr b/test/arrayaddr.myr
index 06035d4..ca9e1d0 100644
--- a/test/arrayaddr.myr
+++ b/test/arrayaddr.myr
@@ -6,6 +6,6 @@ const main = {
v[1] = 42
p = &v[1]
- -> p#
+ std.exit(p#)
}
diff --git a/test/arraylen.myr b/test/arraylen.myr
index 7ac3b95..19b6146 100644
--- a/test/arraylen.myr
+++ b/test/arraylen.myr
@@ -3,5 +3,5 @@ use std
const main = {
var a : int[12]
- -> a.len
+ std.exit(a.len)
}
diff --git a/test/arraylit-ni.myr b/test/arraylit-ni.myr
index 18835c3..1ff2253 100644
--- a/test/arraylit-ni.myr
+++ b/test/arraylit-ni.myr
@@ -2,5 +2,5 @@ use std
/* checks that we can create arrays without indexed initializers. exits with 2. */
const main = {
var a = [1, 3, 2]
- -> a[2]
+ std.exit(a[2])
}
diff --git a/test/basicfloat.myr b/test/basicfloat.myr
index 4cfae50..5243a67 100644
--- a/test/basicfloat.myr
+++ b/test/basicfloat.myr
@@ -6,5 +6,5 @@ const get42 = {
/* basic sanity check on floating point operations. should return 84. */
const main = {
- -> (42.0 + get42()) castto(int)
+ std.exit((42.0 + get42()) castto(int))
}
diff --git a/test/bigliteral.myr b/test/bigliteral.myr
index dbda2fe..64c307d 100644
--- a/test/bigliteral.myr
+++ b/test/bigliteral.myr
@@ -2,5 +2,4 @@ use std
const main = {
std.put("%l\n", 34359738368)
- -> 0
}
diff --git a/test/bsr.myr b/test/bsr.myr
index f7c738e..155f112 100644
--- a/test/bsr.myr
+++ b/test/bsr.myr
@@ -2,5 +2,5 @@ use std
/* should exit with status 5 */
const main = {
var a = 42
- -> a >> 3
+ std.exit(a >> 3)
}
diff --git a/test/call.myr b/test/call.myr
index 22e6fbf..a40cd62 100644
--- a/test/call.myr
+++ b/test/call.myr
@@ -5,5 +5,5 @@ const f = {
}
const main = {
- -> f() + f()
+ std.exit(f() + f())
}
diff --git a/test/callbig.myr b/test/callbig.myr
index aba34e2..5c623ec 100644
--- a/test/callbig.myr
+++ b/test/callbig.myr
@@ -14,5 +14,5 @@ const main = {
var s : pair
s.a = 12
s.b = 30
- -> f(s)
+ std.exit(f(s))
}
diff --git a/test/condiffalse.myr b/test/condiffalse.myr
index e379c33..a1c5e04 100644
--- a/test/condiffalse.myr
+++ b/test/condiffalse.myr
@@ -1,12 +1,12 @@
use std
/* checks that false conditions lead to the false branch of an if statement.
* should exit with 9. */
-var x = 5
-var y = 7
const main = {
+ var x = 5, y = 7
+
if x == 7 && y == 5
- -> 7
+ std.exit(7)
else
- -> 9
+ std.exit(9)
;;
}
diff --git a/test/condifrel.myr b/test/condifrel.myr
index 6ddb3ba..03f4222 100644
--- a/test/condifrel.myr
+++ b/test/condifrel.myr
@@ -1,11 +1,11 @@
use std
/* checks if relatonal operators work. should exit with 9. */
-var x = 3
-var y = 9
const main = {
+ var x = 3, y = 9
+
if x < 5 && y > 7
- -> 7
+ std.exit(7)
else
- -> 9
+ std.exit(9)
;;
}
diff --git a/test/condiftrue.myr b/test/condiftrue.myr
index 4a4beaf..b3ff13e 100644
--- a/test/condiftrue.myr
+++ b/test/condiftrue.myr
@@ -1,11 +1,11 @@
use std
/* checks that true complex boolean conditions work. exits with 7. */
-var x = 5
-var y = 7
const main = {
+ var x = 5, y = 7
+
if x == 5 && y == 7
- -> 7
+ std.exit(7)
else
- -> 9
+ std.exit(9)
;;
}
diff --git a/test/derefassign.myr b/test/derefassign.myr
index 0fc5c85..5a06335 100644
--- a/test/derefassign.myr
+++ b/test/derefassign.myr
@@ -6,5 +6,5 @@ const main = {
p = &v
p# = 123
- -> v
+ std.exit(v)
}
diff --git a/test/div.myr b/test/div.myr
index f85643d..e9d16ad 100644
--- a/test/div.myr
+++ b/test/div.myr
@@ -6,5 +6,5 @@ const main = {
a = 127
b = 3
- -> a / b
+ std.exit(a / b)
}
diff --git a/test/exportcycle.myr b/test/exportcycle.myr
index 1eba61d..d41e86b 100644
--- a/test/exportcycle.myr
+++ b/test/exportcycle.myr
@@ -9,5 +9,4 @@ pkg =
;;
const main = {
- -> 0
}
diff --git a/test/exportmain.myr b/test/exportmain.myr
index 36bd5c8..51dc559 100644
--- a/test/exportmain.myr
+++ b/test/exportmain.myr
@@ -10,5 +10,5 @@ const foo = {val
}
const main = {
- -> foo(42)
+ std.exit(foo(42))
}
diff --git a/test/fib.myr b/test/fib.myr
index ac0c874..979c379 100644
--- a/test/fib.myr
+++ b/test/fib.myr
@@ -11,6 +11,6 @@ const fib = {n
}
const main = {
- -> fib(8)
+ std.exit(fib(8))
}
diff --git a/test/generic.myr b/test/generic.myr
index f173034..ef69c39 100644
--- a/test/generic.myr
+++ b/test/generic.myr
@@ -6,6 +6,6 @@ generic id = {a:@a
const main = {
id("adsf")
- -> id(42)
+ std.exit(id(42))
}
diff --git a/test/genericcall.myr b/test/genericcall.myr
index 91cd3cc..5662f7d 100644
--- a/test/genericcall.myr
+++ b/test/genericcall.myr
@@ -10,6 +10,6 @@ generic id = {a:@a
const main = {
id("adsf")
- -> id(42)
+ std.exit(id(42))
}
diff --git a/test/genericmatch.myr b/test/genericmatch.myr
index 6d582e7..9a69b83 100644
--- a/test/genericmatch.myr
+++ b/test/genericmatch.myr
@@ -7,7 +7,7 @@ type t(@a) = union
const main = {
match `Foo 123
- | `Foo a: -> 0xf
- | `Bar: -> 0x0
+ | `Foo a: std.exit(0xf)
+ | `Bar: std.exit(0x0)
;;
}
diff --git a/test/genericrec.myr b/test/genericrec.myr
index 19a12cd..8dd4855 100644
--- a/test/genericrec.myr
+++ b/test/genericrec.myr
@@ -8,5 +8,4 @@ type list(@t) = struct
const main = {
var v : list(int)
- -> 0
}
diff --git a/test/genericret.myr b/test/genericret.myr
index 7a597a7..d53de5d 100644
--- a/test/genericret.myr
+++ b/test/genericret.myr
@@ -11,7 +11,7 @@ const f = {-> t(int)
const main = {
match f()
- | `None: -> 42
+ | `None: std.exit(42)
;;
- -> 0
+ std.exit(0)
}
diff --git a/test/generictype.myr b/test/generictype.myr
index ae3c148..c19c096 100644
--- a/test/generictype.myr
+++ b/test/generictype.myr
@@ -11,8 +11,8 @@ const main = {
v = `Some 123
match v
- | `None: -> 1
- | `Some 123: -> 0
+ | `None: std.exit(1)
+ | `Some 123: std.exit(0)
;;
- -> 60
+ std.exit(60)
}
diff --git a/test/genericval.myr b/test/genericval.myr
index 2c85271..c95817b 100644
--- a/test/genericval.myr
+++ b/test/genericval.myr
@@ -2,7 +2,7 @@ use std
generic Foo : @a::(tctest,tcint,tcnum) = 42
-const main = {-> int
- -> Foo
+const main = {
+ std.exit(Foo)
}
diff --git a/test/global-arrayvar.myr b/test/global-arrayvar.myr
index ba42e05..c24c2d5 100644
--- a/test/global-arrayvar.myr
+++ b/test/global-arrayvar.myr
@@ -6,5 +6,5 @@ var a : int[10]
const main = {
a[0] = 3
a[1] = 4
- -> a[0] + a[1] + a[2] + a[3]
+ std.exit(a[0] + a[1] + a[2] + a[3])
}
diff --git a/test/gsizeof.myr b/test/gsizeof.myr
index 15675e4..db04015 100644
--- a/test/gsizeof.myr
+++ b/test/gsizeof.myr
@@ -5,5 +5,5 @@ generic sz = {a:@a
}
const main = {
- -> sz(123) + sz("asdf"[0])
+ std.exit(sz(123) + sz("asdf"[0]))
}
diff --git a/test/helloworld.myr b/test/helloworld.myr
index 602a8b0..acbfa1a 100644
--- a/test/helloworld.myr
+++ b/test/helloworld.myr
@@ -3,6 +3,5 @@ use std
const main = {args : byte[:][:]
std.write(1, "Hello-世界\n")
- -> 0
}
diff --git a/test/import-type.myr b/test/import-type.myr
index ab13d3b..893d950 100644
--- a/test/import-type.myr
+++ b/test/import-type.myr
@@ -4,6 +4,4 @@ const main = {
var x : std.size
var y : std.off
var z : std.statbuf
-
- -> 0
}
diff --git a/test/infer-named.myr b/test/infer-named.myr
index b2e517d..51b14d7 100644
--- a/test/infer-named.myr
+++ b/test/infer-named.myr
@@ -14,8 +14,8 @@ const main = {
v = f(99)
match v
- | `Foo: -> 1
- | `Bar x: -> x
+ | `Foo: std.exit(1)
+ | `Bar x: std.exit(x)
;;
- -> 2
+ std.exit(2)
}
diff --git a/test/livearraylit.myr b/test/livearraylit.myr
index fb0351b..dd647b5 100644
--- a/test/livearraylit.myr
+++ b/test/livearraylit.myr
@@ -4,7 +4,7 @@ const main = {
var v
v = [foo(), 42, 123]
- -> v[0]
+ std.exit(v[0])
}
const foo = {
diff --git a/test/livestructlit.myr b/test/livestructlit.myr
index dfe0386..f0beddb 100644
--- a/test/livestructlit.myr
+++ b/test/livestructlit.myr
@@ -12,7 +12,7 @@ const main = {
var v : t
v = [.a=foo(), .b=42, .c="foo"]
- -> v.a
+ std.exit(v.a)
}
const foo = {
diff --git a/test/local-labels.myr b/test/local-labels.myr
index 14ed601..66a8160 100644
--- a/test/local-labels.myr
+++ b/test/local-labels.myr
@@ -2,9 +2,9 @@ use std
const main = {
goto foo
- -> 123
+ std.exit(123)
:foo
- -> bar()
+ std.exit(bar())
}
const bar = {
diff --git a/test/log-and.myr b/test/log-and.myr
index 08c2ba6..694c380 100644
--- a/test/log-and.myr
+++ b/test/log-and.myr
@@ -1,5 +1,5 @@
use std
/* checks that evaluating a logical and to a bool works. should return 0. */
const main = {
- -> 0 && 1
+ std.exit((0 && 1) castto(int))
}
diff --git a/test/log-or.myr b/test/log-or.myr
index 25e1712..7adef8b 100644
--- a/test/log-or.myr
+++ b/test/log-or.myr
@@ -1,5 +1,5 @@
use std
/* checks that evaluating a logical or works. exits with 1. */
const main = {
- -> 0 || 1
+ std.exit((0 || 1) castto(int))
}
diff --git a/test/loop.myr b/test/loop.myr
index 6b8a18e..cbdfa2e 100644
--- a/test/loop.myr
+++ b/test/loop.myr
@@ -8,5 +8,5 @@ const main = {
for i = 0; i < 10; ++i
n += i
;;
- -> n
+ std.exit(n)
}
diff --git a/test/main.myr b/test/main.myr
index baf857b..3a6e54c 100644
--- a/test/main.myr
+++ b/test/main.myr
@@ -1,3 +1,3 @@
use std
/* should exit with status 0 */
-const main = {; -> 0 }
+const main = {;}
diff --git a/test/match-badtypes.myr b/test/match-badtypes.myr
index 564c960..1bc96b7 100644
--- a/test/match-badtypes.myr
+++ b/test/match-badtypes.myr
@@ -10,4 +10,5 @@ const foo = {
|"asdf": 123
|234567: 888
;;
+ std.exit(42)
}
diff --git a/test/matchargunion.myr b/test/matchargunion.myr
index 5d3ae53..7d12706 100644
--- a/test/matchargunion.myr
+++ b/test/matchargunion.myr
@@ -12,10 +12,10 @@ const main = {
v = `Int 123
match v
- | `Int 127: -> 42
- | `Int 123: -> 69
- | `Chr 'a': -> 4
- | `Nil: -> 6
+ | `Int 127: std.exit(42)
+ | `Int 123: std.exit(69)
+ | `Chr 'a': std.exit(4)
+ | `Nil: std.exit(6)
;;
}
diff --git a/test/matcharray.myr b/test/matcharray.myr
index 38e3688..7cb762a 100644
--- a/test/matcharray.myr
+++ b/test/matcharray.myr
@@ -5,8 +5,8 @@ const main = {
match v
| [x, y, 10]:
- -> x + y
+ std.exit(x + y)
| _: std.die("Wat")
;;
- -> 0
+ std.exit(0)
}
diff --git a/test/matchbind.myr b/test/matchbind.myr
index 9465d6c..2bcc780 100644
--- a/test/matchbind.myr
+++ b/test/matchbind.myr
@@ -12,10 +12,10 @@ const main = {
v = `Int 8
match v
- | `Int 127: -> 42
- | `Int x: -> x
- | `Chr 'a': -> 4
- | `Nil: -> 6
+ | `Int 127: std.exit(42)
+ | `Int x: std.exit(x)
+ | `Chr 'a': std.exit(4)
+ | `Nil: std.exit(6)
;;
}
diff --git a/test/matchconst.myr b/test/matchconst.myr
index fad888b..e076232 100644
--- a/test/matchconst.myr
+++ b/test/matchconst.myr
@@ -11,8 +11,8 @@ const main = {
v = 8
match v
- | Ca: -> 123
- | Cb: -> 88
- | Cc: -> 42
+ | Ca: std.exit(123)
+ | Cb: std.exit(88)
+ | Cc: std.exit(42)
;;
}
diff --git a/test/matchint.myr b/test/matchint.myr
index b198d9d..5fc3eb4 100644
--- a/test/matchint.myr
+++ b/test/matchint.myr
@@ -5,11 +5,11 @@ const main = {
v = 12
match 12
- | 1: -> 42
- | 2: -> 81
- | 3: -> 123
- | 4: -> 99
- | 12: -> 84
- | 6: -> 18
+ | 1: std.exit(42)
+ | 2: std.exit(81)
+ | 3: std.exit(123)
+ | 4: std.exit(99)
+ | 12: std.exit(84)
+ | 6: std.exit(18)
;;
}
diff --git a/test/matchmixed.myr b/test/matchmixed.myr
index 0887997..e69cb1f 100644
--- a/test/matchmixed.myr
+++ b/test/matchmixed.myr
@@ -10,5 +10,5 @@ const main = {
| `A: std.put("Got a\n")
| `B: std.put("Got b\n")
;;
- -> 42
+ std.exit(42)
}
diff --git a/test/matchstruct.myr b/test/matchstruct.myr
index e6bde0f..568013e 100644
--- a/test/matchstruct.myr
+++ b/test/matchstruct.myr
@@ -14,9 +14,9 @@ const main = {
v.v3 = 10
match v
| [.v1 = x, .v2 = y, .v3 = 10]:
- -> x + y
+ std.exit(x + y)
| _:
std.die("Wat")
;;
- -> 0
+ std.exit(0)
}
diff --git a/test/matchtup.myr b/test/matchtup.myr
index 85e3a10..95f9a1f 100644
--- a/test/matchtup.myr
+++ b/test/matchtup.myr
@@ -4,8 +4,8 @@ const main = {
var v = (1, 2)
match v
- | (1, x): -> 40 + x
+ | (1, x): std.exit(40 + x)
| _: std.die("Wat")
;;
- -> 0
+ std.exit(0)
}
diff --git a/test/matchunion.myr b/test/matchunion.myr
index 8eb1d77..f57b205 100644
--- a/test/matchunion.myr
+++ b/test/matchunion.myr
@@ -13,9 +13,9 @@ const main = {
v = `Foo
match v
- | `Bar: -> 42
- | `Baz: -> 81
- | `Foo: -> 84
- | `Quux: -> 123
+ | `Bar: std.exit(42)
+ | `Baz: std.exit(81)
+ | `Foo: std.exit(84)
+ | `Quux: std.exit(123)
;;
}
diff --git a/test/matchunion_sl.myr b/test/matchunion_sl.myr
index 54ba664..3a4ddb3 100644
--- a/test/matchunion_sl.myr
+++ b/test/matchunion_sl.myr
@@ -12,10 +12,9 @@ const main = {
v = `Str "foo"
match v
- | `Int 127: -> 42
+ | `Int 127: std.exit(42)
| `Str s: std.put("%s\n", s)
| `Nil:
;;
- -> 0
}
diff --git a/test/mkunion.myr b/test/mkunion.myr
index 159dc9f..bd268a8 100644
--- a/test/mkunion.myr
+++ b/test/mkunion.myr
@@ -9,5 +9,5 @@ const main = {
var v
v = `Some 123
- -> 0
+ std.exit(0)
}
diff --git a/test/mod.myr b/test/mod.myr
index 7d8a8bf..5347710 100644
--- a/test/mod.myr
+++ b/test/mod.myr
@@ -3,5 +3,5 @@ use std
const main = {
var a = 42
var b = 9
- -> a % b
+ std.exit(a % b)
}
diff --git a/test/mul.myr b/test/mul.myr
index ee93478..e63a5eb 100644
--- a/test/mul.myr
+++ b/test/mul.myr
@@ -4,5 +4,5 @@ const main = {
var a = 7
var b = 2
var c = 3
- -> a * b * c
+ std.exit(a * b * c)
}
diff --git a/test/nestfn.myr b/test/nestfn.myr
index bd75169..c0f34c5 100644
--- a/test/nestfn.myr
+++ b/test/nestfn.myr
@@ -5,5 +5,5 @@ const main = {
const ret42 = {
-> 42
}
- -> ret42()
+ std.exit(ret42())
}
diff --git a/test/neststruct.myr b/test/neststruct.myr
index 608e255..863b607 100644
--- a/test/neststruct.myr
+++ b/test/neststruct.myr
@@ -17,5 +17,5 @@ const main = {
s1.x.b = 2
s2 = s1.x
- -> s2.a + s2.b
+ std.exit(s2.a + s2.b)
}
diff --git a/test/occur.myr b/test/occur.myr
index 30d535b..06d7921 100644
--- a/test/occur.myr
+++ b/test/occur.myr
@@ -3,8 +3,8 @@ use std
doesn't exist within itself). If 'f' typechecked,
it's type would be:
-f : (-> (-> (-> ... ad infinitum ...)))
+f : (std.exit((-> (-> ... ad infinitum ...))))
*/
const f = {
- -> f
+ std.exit(f)
}
diff --git a/test/outparam-sl.myr b/test/outparam-sl.myr
index 78d7963..a1a8eb7 100644
--- a/test/outparam-sl.myr
+++ b/test/outparam-sl.myr
@@ -9,5 +9,5 @@ const main = {
var v
f(&v)
- -> v[0]
+ std.exit(v[0])
}
diff --git a/test/outparam.myr b/test/outparam.myr
index 8d9e790..654d65d 100644
--- a/test/outparam.myr
+++ b/test/outparam.myr
@@ -9,5 +9,5 @@ const main = {
v = 16
f(&v)
- -> v
+ std.exit(v)
}
diff --git a/test/overlappingif.myr b/test/overlappingif.myr
index fe4bd7f..0a2de56 100644
--- a/test/overlappingif.myr
+++ b/test/overlappingif.myr
@@ -14,5 +14,5 @@ const main = {
elif v & 0xffff != 0
x = 3
;;
- -> x
+ std.exit(x)
}
diff --git a/test/ptrpreinc.myr b/test/ptrpreinc.myr
index ac4fe1e..fef7715 100644
--- a/test/ptrpreinc.myr
+++ b/test/ptrpreinc.myr
@@ -7,6 +7,6 @@ const ppreinc = {p
const main = {
var x = 8
- -> ppreinc(&x)
+ std.exit(ppreinc(&x))
}
diff --git a/test/sizeof.myr b/test/sizeof.myr
index 69637c1..35d80ca 100644
--- a/test/sizeof.myr
+++ b/test/sizeof.myr
@@ -1,5 +1,5 @@
use std
/* checks that sizeof() works. exits with 4. */
const main = {
- -> sizeof(int)
+ std.exit(sizeof(int))
}
diff --git a/test/slalloc.myr b/test/slalloc.myr
index 21035e2..c019ec3 100644
--- a/test/slalloc.myr
+++ b/test/slalloc.myr
@@ -7,5 +7,5 @@ const main = {
sl = std.slalloc(123)
sl[0] = 42
sl[122] = 1
- -> sl.len
+ std.exit(sl.len)
}
diff --git a/test/slgrow.myr b/test/slgrow.myr
index 6b6ae3a..ab510a0 100644
--- a/test/slgrow.myr
+++ b/test/slgrow.myr
@@ -8,5 +8,5 @@ const main = {
sl[0] = 12
sl = std.slgrow(sl, 123)
sl[122] = 30
- -> sl[0] + sl[122]
+ std.exit(sl[0] + sl[122])
}
diff --git a/test/slice.myr b/test/slice.myr
index b8b1678..359182c 100644
--- a/test/slice.myr
+++ b/test/slice.myr
@@ -8,5 +8,5 @@ const main = {
s[0] = 3
s[1] = 4
s[2] = s[0] + s[1] + s.len
- -> s[2]
+ std.exit(s[2])
}
diff --git a/test/slicelen.myr b/test/slicelen.myr
index 9daed42..4a213ad 100644
--- a/test/slicelen.myr
+++ b/test/slicelen.myr
@@ -6,5 +6,5 @@ const main = {
var s
s = a[1:6]
- -> s.len
+ std.exit(s.len)
}
diff --git a/test/splitline.myr b/test/splitline.myr
index 13df1d8..edde6cf 100644
--- a/test/splitline.myr
+++ b/test/splitline.myr
@@ -1,6 +1,6 @@
use std
const main = {
- -> 1 + \ /* ignored crap */
- 2
+ std.exit(1 + \ /* ignored crap */
+ 2)
}
diff --git a/test/sqrt.myr b/test/sqrt.myr
index ce46cfb..0710580 100644
--- a/test/sqrt.myr
+++ b/test/sqrt.myr
@@ -27,6 +27,6 @@ const sqrt = {x : float64
}
const main = {
- -> sqrt(20.0) castto(int)
+ std.exit(sqrt(20.0) castto(int))
}
diff --git a/test/stdopt-mk.myr b/test/stdopt-mk.myr
index dc97f7f..4d576fa 100644
--- a/test/stdopt-mk.myr
+++ b/test/stdopt-mk.myr
@@ -13,8 +13,8 @@ const main = {
v = f(123)
match v
- | `std.Some x: -> x
- | `std.None: -> 123
+ | `std.Some x: std.exit(x)
+ | `std.None: std.exit(123)
;;
}
diff --git a/test/stdopt-none.myr b/test/stdopt-none.myr
index 62ec5e4..63f4d35 100644
--- a/test/stdopt-none.myr
+++ b/test/stdopt-none.myr
@@ -6,8 +6,8 @@ const f = {
const main = {
match f()
- | `std.Some x: -> x
- | `std.None: -> 42
+ | `std.Some x: std.exit(x)
+ | `std.None: std.exit(42)
;;
}
diff --git a/test/stdopt-some.myr b/test/stdopt-some.myr
index 179dc8e..714222e 100644
--- a/test/stdopt-some.myr
+++ b/test/stdopt-some.myr
@@ -2,8 +2,8 @@ use std
const main = {
match `std.Some 42
- | `std.Some x: -> x
- | `std.None: -> 1
+ | `std.Some x: std.exit(x)
+ | `std.None: std.exit(1)
;;
}
diff --git a/test/stdopt-struct.myr b/test/stdopt-struct.myr
index 3a558e5..cb02241 100644
--- a/test/stdopt-struct.myr
+++ b/test/stdopt-struct.myr
@@ -5,5 +5,5 @@ type t = struct
;;
const main = {
- -> 42
+ std.exit(42)
}
diff --git a/test/str.myr b/test/str.myr
index 4ec36b2..bcb8eff 100644
--- a/test/str.myr
+++ b/test/str.myr
@@ -5,5 +5,5 @@ const main = {
var str
str = "asdf"
- -> str[3]
+ std.exit(str[3] castto(int))
}
diff --git a/test/strsplit.myr b/test/strsplit.myr
index d6fec93..a035bf2 100644
--- a/test/strsplit.myr
+++ b/test/strsplit.myr
@@ -8,5 +8,4 @@ const main = {
for i = 0; i < sp.len; i++
std.put("%s\n", sp[i])
;;
- -> 0
}
diff --git a/test/strstrip.myr b/test/strstrip.myr
index c813013..d66373c 100644
--- a/test/strstrip.myr
+++ b/test/strstrip.myr
@@ -19,5 +19,4 @@ const main = {
std.put("\"%s\"\n", std.strstrip(""))
std.put("\"%s\"\n", std.strfstrip(""))
std.put("\"%s\"\n", std.strrstrip(""))
- -> 0
}
diff --git a/test/strtab.myr b/test/strtab.myr
index 6a99203..115efca 100644
--- a/test/strtab.myr
+++ b/test/strtab.myr
@@ -12,5 +12,5 @@ const main = {
for i = 0; i < strtab.len; i++
std.put("%i: %s\n", i, strtab[i])
;;
- -> 0
+ std.exit(0)
}
diff --git a/test/struct.myr b/test/struct.myr
index 2af3196..be324c0 100644
--- a/test/struct.myr
+++ b/test/struct.myr
@@ -9,5 +9,5 @@ const main = {
var s : pair
s.a = 12
s.b = 30
- -> s.a + s.b
+ std.exit(s.a + s.b)
}
diff --git a/test/struct1.myr b/test/struct1.myr
index c9c1880..58e822c 100644
--- a/test/struct1.myr
+++ b/test/struct1.myr
@@ -9,5 +9,5 @@ type val = struct
const main = {
var s : val
s.a = 12
- -> s.a
+ std.exit(s.a)
}
diff --git a/test/structarray.myr b/test/structarray.myr
index 594a706..f64e38e 100644
--- a/test/structarray.myr
+++ b/test/structarray.myr
@@ -10,5 +10,5 @@ const main = {
v.a[0] = 11
v.a[1] = 20
- -> 2*v.a[0] + v.a[1]
+ std.exit(2*v.a[0] + v.a[1])
}
diff --git a/test/structasn.myr b/test/structasn.myr
index 9a33304..1c23592 100644
--- a/test/structasn.myr
+++ b/test/structasn.myr
@@ -11,5 +11,5 @@ const main = {
x.a = 12
x.b = 30
y = x
- -> y.a + y.b
+ std.exit(y.a + y.b)
}
diff --git a/test/structlit.myr b/test/structlit.myr
index 3e6a77e..ce630d0 100644
--- a/test/structlit.myr
+++ b/test/structlit.myr
@@ -12,6 +12,6 @@ const main = {
var v : t
v = [.a=42, .b='x', .c="foo"]
- -> v.a
+ std.exit(v.a)
}
diff --git a/test/structptr.myr b/test/structptr.myr
index a5b389e..e49ccfb 100644
--- a/test/structptr.myr
+++ b/test/structptr.myr
@@ -13,5 +13,5 @@ const frob = {s
const main = {
var s : pair
frob(&s)
- -> s.a + s.b
+ std.exit(s.a + s.b)
}
diff --git a/test/structret.myr b/test/structret.myr
index dc61ee2..fb64fef 100644
--- a/test/structret.myr
+++ b/test/structret.myr
@@ -17,5 +17,5 @@ const main = {
var s : pair
s = f()
- -> s.a + s.b
+ std.exit(s.a + s.b)
}
diff --git a/test/swidencast.myr b/test/swidencast.myr
index 82e5ebd..4148540 100644
--- a/test/swidencast.myr
+++ b/test/swidencast.myr
@@ -6,5 +6,5 @@ const main = {
u = 99
v = u castto(int32)
- -> v
+ std.exit(v castto(int))
}
diff --git a/test/trait-builtin.myr b/test/trait-builtin.myr
index f6ab6b3..5df77ce 100644
--- a/test/trait-builtin.myr
+++ b/test/trait-builtin.myr
@@ -18,10 +18,11 @@ generic max = {a:@a::tcnum, b:@a::tcnum
generic intlike_is42 = {a : @a::(tcnum,tctest,tcint)
-> a == 42
}
+
const main = {
if intlike_is42(123)
- -> 16
+ std.exit(16)
else
- -> max(12, 42)
+ std.exit(max(12, 42))
;;
}
diff --git a/test/trunccast.myr b/test/trunccast.myr
index daffaa0..fa5c4d0 100644
--- a/test/trunccast.myr
+++ b/test/trunccast.myr
@@ -6,5 +6,5 @@ const main = {
y = 9999
x = y castto(int8)
- -> x % 73
+ std.exit((x % 73) castto(int))
}
diff --git a/test/tuple.myr b/test/tuple.myr
index 3402de0..1a12884 100644
--- a/test/tuple.myr
+++ b/test/tuple.myr
@@ -9,5 +9,5 @@ const main = {
x = 15
v = (x, x + 12)
(a, b) = v
- -> a + b
+ std.exit(a + b)
}
diff --git a/test/tyrec.myr b/test/tyrec.myr
index 2b29ae6..415e2da 100644
--- a/test/tyrec.myr
+++ b/test/tyrec.myr
@@ -6,5 +6,5 @@ type foo = struct
const main = {
var v : foo
- -> 42
+ std.exit(42)
}
diff --git a/test/usedef.myr b/test/usedef.myr
index 547a046..81c6434 100644
--- a/test/usedef.myr
+++ b/test/usedef.myr
@@ -4,5 +4,5 @@ before it is defined.
*/
const main = {
var a : int
- -> a
+ std.exit(a)
}
diff --git a/test/voidcall.myr b/test/voidcall.myr
index 6730ca1..03d487b 100644
--- a/test/voidcall.myr
+++ b/test/voidcall.myr
@@ -9,5 +9,5 @@ const f = {
const main = {
f()
- -> 12
+ std.exit(12)
}
diff --git a/test/zwidencast.myr b/test/zwidencast.myr
index b7bba3e..2b572da 100644
--- a/test/zwidencast.myr
+++ b/test/zwidencast.myr
@@ -6,5 +6,5 @@ const main = {
u = 99
v = u castto(uint32)
- -> v
+ std.exit(v castto(int))
}