aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/compilable/assign_record_to_base.elna4
-rw-r--r--testsuite/compilable/generic_alias.elna2
-rw-r--r--testsuite/compilable/generic_arguments.elna4
-rw-r--r--testsuite/compilable/generic_const_inference.elna6
-rw-r--r--testsuite/compilable/generic_inference.elna2
-rw-r--r--testsuite/compilable/generic_pointee.elna3
-rw-r--r--testsuite/compilable/opaque_type.elna2
-rw-r--r--testsuite/compilable/pointer_cast.elna8
-rw-r--r--testsuite/compilable/traits_size.elna2
-rw-r--r--testsuite/fail_compilation/assign_const_to_pointer.elna8
-rw-r--r--testsuite/fail_compilation/assign_from_const_pointer.elna8
-rw-r--r--testsuite/runnable/generic_base.elna2
-rw-r--r--testsuite/runnable/generic_pointer_arithmetic.elna8
-rw-r--r--testsuite/runnable/procedure_cast.elna2
-rw-r--r--testsuite/runnable/recursive_record.elna14
15 files changed, 29 insertions, 46 deletions
diff --git a/testsuite/compilable/assign_record_to_base.elna b/testsuite/compilable/assign_record_to_base.elna
index 14bc3f5..3909386 100644
--- a/testsuite/compilable/assign_record_to_base.elna
+++ b/testsuite/compilable/assign_record_to_base.elna
@@ -8,8 +8,8 @@ type
end
var
- x: ^B := nil
- y: ^R := nil
+ x: ^B
+ y: ^R
begin
x := y
diff --git a/testsuite/compilable/generic_alias.elna b/testsuite/compilable/generic_alias.elna
index da9501a..8450253 100644
--- a/testsuite/compilable/generic_alias.elna
+++ b/testsuite/compilable/generic_alias.elna
@@ -22,7 +22,7 @@ var
boxed: Boxed#[File]
begin
- chain.next := nil;
+ chain.next := cast(0u: ^Node#[File]);
aliased := raw;
raw := aliased;
boxed.inner := @chain
diff --git a/testsuite/compilable/generic_arguments.elna b/testsuite/compilable/generic_arguments.elna
index 1cda57f..7312efe 100644
--- a/testsuite/compilable/generic_arguments.elna
+++ b/testsuite/compilable/generic_arguments.elna
@@ -20,7 +20,7 @@ return entry_ptr^.key
begin
entry.key := allocate#[File](#size(File));
- assert(#size(Pair#[File, Word8]) = #size(Pointer) * 2u);
- assert(#offset(Pair#[File, Word8], value) = #size(Pointer));
+ assert(#size(Pair#[File, Word8]) = #size(^Word8) * 2u);
+ assert(#offset(Pair#[File, Word8], value) = #size(^Word8));
assert(first#[File, Word8](@entry) = entry.key)
end.
diff --git a/testsuite/compilable/generic_const_inference.elna b/testsuite/compilable/generic_const_inference.elna
index 7ce197f..c9be090 100644
--- a/testsuite/compilable/generic_const_inference.elna
+++ b/testsuite/compilable/generic_const_inference.elna
@@ -6,9 +6,9 @@ type
var
slice: []const Word8
- aliased: ConstAlias := nil
- nested: NestedConst := nil
- direct_const: const ^Word8 := nil
+ aliased: ConstAlias := cast(0u: ConstAlias)
+ nested: NestedConst := cast(0u: NestedConst)
+ direct_const: const ^Word8 := cast(0u: const ^Word8)
proc write#[T](fd: Int; buf: ^T; count: Int) -> Int
return 0
diff --git a/testsuite/compilable/generic_inference.elna b/testsuite/compilable/generic_inference.elna
index 9d7fed6..e5e6e3b 100644
--- a/testsuite/compilable/generic_inference.elna
+++ b/testsuite/compilable/generic_inference.elna
@@ -25,5 +25,5 @@ return
begin
store(@files, @f);
relay(@bytes, @b);
- store(@files, nil)
+ store(@files, cast(0u: ^File))
end.
diff --git a/testsuite/compilable/generic_pointee.elna b/testsuite/compilable/generic_pointee.elna
index 5ecaedf..b9ee739 100644
--- a/testsuite/compilable/generic_pointee.elna
+++ b/testsuite/compilable/generic_pointee.elna
@@ -12,6 +12,5 @@ var
f: ^File
begin
- f := allocate#[File](#size(File));
- assert(f = nil)
+ f := allocate#[File](#size(File))
end.
diff --git a/testsuite/compilable/opaque_type.elna b/testsuite/compilable/opaque_type.elna
index 6474337..751e6ce 100644
--- a/testsuite/compilable/opaque_type.elna
+++ b/testsuite/compilable/opaque_type.elna
@@ -4,7 +4,7 @@ type
Alias = Handle
var
- handle: ^Handle := nil
+ handle: ^Handle
alias: ^Alias
proc take(h: ^Handle) -> ^Handle
diff --git a/testsuite/compilable/pointer_cast.elna b/testsuite/compilable/pointer_cast.elna
index 2b986c0..08f9fe7 100644
--- a/testsuite/compilable/pointer_cast.elna
+++ b/testsuite/compilable/pointer_cast.elna
@@ -1,9 +1,9 @@
program()
var
- c: ^Char := nil
- p: Pointer := nil
+ c: ^Char
+ b: ^Word8
begin
- p := c;
- c := p
+ b := cast(c: ^Word8);
+ c := cast(b: ^Char)
end.
diff --git a/testsuite/compilable/traits_size.elna b/testsuite/compilable/traits_size.elna
index ad49b61..282ff25 100644
--- a/testsuite/compilable/traits_size.elna
+++ b/testsuite/compilable/traits_size.elna
@@ -4,7 +4,7 @@ var
s: Int := cast(#size(Int): Int)
a: [10]Int
as: Int := cast(#size([10]Int): Int)
- p: Int := cast(#size(Pointer): Int)
+ p: Int := cast(#size(^Word8): Int)
begin
assert(s > 0);
diff --git a/testsuite/fail_compilation/assign_const_to_pointer.elna b/testsuite/fail_compilation/assign_const_to_pointer.elna
deleted file mode 100644
index 796b60c..0000000
--- a/testsuite/fail_compilation/assign_const_to_pointer.elna
+++ /dev/null
@@ -1,8 +0,0 @@
-program()
-var
- c: const Int := 2
- p: Pointer
-
-begin
- p := @c (* @Error Expected type 'Pointer', but got '\^const Int' *)
-end.
diff --git a/testsuite/fail_compilation/assign_from_const_pointer.elna b/testsuite/fail_compilation/assign_from_const_pointer.elna
deleted file mode 100644
index 64f7f5d..0000000
--- a/testsuite/fail_compilation/assign_from_const_pointer.elna
+++ /dev/null
@@ -1,8 +0,0 @@
-program()
-var
- cv: const Pointer := nil
- p: Pointer
-
-begin
- p := cv (* @Error Expected type 'Pointer', but got 'const Pointer' *)
-end.
diff --git a/testsuite/runnable/generic_base.elna b/testsuite/runnable/generic_base.elna
index 161c59d..7b371ad 100644
--- a/testsuite/runnable/generic_base.elna
+++ b/testsuite/runnable/generic_base.elna
@@ -36,5 +36,5 @@ begin
assert(jobs.count = 1u);
assert(jobs.head = @f);
assert(jobs.tail = @f);
- assert(#size(Queue#[File]) = #size(Pointer) * 3u)
+ assert(#size(Queue#[File]) = #size(^Word8) * 3u)
end.
diff --git a/testsuite/runnable/generic_pointer_arithmetic.elna b/testsuite/runnable/generic_pointer_arithmetic.elna
index 209287d..abbca4b 100644
--- a/testsuite/runnable/generic_pointer_arithmetic.elna
+++ b/testsuite/runnable/generic_pointer_arithmetic.elna
@@ -2,13 +2,13 @@ program()
var
base: [4]Int
element: ^Int
- first: Pointer
- second: Pointer
+ first: ^Word8
+ second: ^Word8
begin
element := base.ptr;
- first := element;
+ first := cast(element: ^Word8);
second := first + 1;
- assert(cast(second : Word) - cast(first : Word) = 1u);
+ assert(cast(second: Word) - cast(first: Word) = 1u);
assert(second - 1 = first)
end.
diff --git a/testsuite/runnable/procedure_cast.elna b/testsuite/runnable/procedure_cast.elna
index d724e38..0e8aa92 100644
--- a/testsuite/runnable/procedure_cast.elna
+++ b/testsuite/runnable/procedure_cast.elna
@@ -7,5 +7,5 @@ return 42
begin
cb := cast(@probe_int: ^proc(x: ^Char) -> Int);
- assert(cb^(nil) = 42)
+ assert(cb^(cast(0u: ^Char)) = 42)
end.
diff --git a/testsuite/runnable/recursive_record.elna b/testsuite/runnable/recursive_record.elna
index 48fb873..1667bf4 100644
--- a/testsuite/runnable/recursive_record.elna
+++ b/testsuite/runnable/recursive_record.elna
@@ -10,10 +10,10 @@ var
second: ^Node
third: ^Node
-proc malloc(size: Word) -> Pointer
+proc malloc#[T](size: Word) -> ^T
extern
-proc free(ptr: Pointer)
+proc free#[T](ptr: ^T)
extern
proc sum(node: ^Node) -> Int
@@ -21,7 +21,7 @@ var
result: Int
begin
result := 0;
- if node = nil then
+ if node = cast(0u: ^Node) then
result := 0
else
result := node^.value + sum(node^.next)
@@ -29,16 +29,16 @@ begin
return result
begin
- first := malloc(#size(Node));
- second := malloc(#size(Node));
- third := malloc(#size(Node));
+ first := malloc#[Node](#size(Node));
+ second := malloc#[Node](#size(Node));
+ third := malloc#[Node](#size(Node));
first^.value := 1;
first^.next := second;
second^.value := 2;
second^.next := third;
third^.value := 3;
- third^.next := nil;
+ third^.next := cast(0u: ^Node);
assert(sum(first) = 6);
assert(first^.next^.next^.value = 3);