aboutsummaryrefslogtreecommitdiff
path: root/testsuite/compilable
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/compilable')
-rw-r--r--testsuite/compilable/generic_const_inference.elna28
-rw-r--r--testsuite/compilable/generic_inference.elna2
2 files changed, 28 insertions, 2 deletions
diff --git a/testsuite/compilable/generic_const_inference.elna b/testsuite/compilable/generic_const_inference.elna
new file mode 100644
index 0000000..a9fc41f
--- /dev/null
+++ b/testsuite/compilable/generic_const_inference.elna
@@ -0,0 +1,28 @@
+program()
+type
+ ConstAlias = const ^Word8
+ BasePtr = ^Word8
+ NestedConst = const BasePtr
+
+var
+ slice: []const Word8
+ aliased: ConstAlias := nil
+ nested: NestedConst := nil
+ direct_const: const ^Word8 := nil
+
+proc write#[T](fd: Int; buf: T; count: Int) -> Int
+return 0
+
+proc write_const#[T](fd: Int; buf: const T; count: Int) -> Int
+return 0
+
+begin
+ write(1, slice.ptr, cast(slice.length: Int));
+ write(1, aliased, 0);
+ write(1, nested, 0);
+ write(1, direct_const, 0);
+ write_const(1, slice.ptr, cast(slice.length: Int));
+ write_const(1, aliased, 0);
+ write_const(1, nested, 0);
+ write_const(1, direct_const, 0)
+end.
diff --git a/testsuite/compilable/generic_inference.elna b/testsuite/compilable/generic_inference.elna
index ab1ff3a..860eab1 100644
--- a/testsuite/compilable/generic_inference.elna
+++ b/testsuite/compilable/generic_inference.elna
@@ -15,12 +15,10 @@ var
b: Word8
proc store#[T](target: ^Cell#[T]; value: T)
-begin
target^.held := value
return
proc relay#[T](target: ^Cell#[T]; value: T)
-begin
store(target, value)
return