diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-10-03 10:08:05 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-10-03 10:08:05 +0200 |
| commit | 5d808dd4c4003968bbdf180e1e1193231db5d43b (patch) | |
| tree | 6391fc8990790288e76dc8eb6ff7b1a6872dab26 /testsuite | |
| parent | 2ea84997ae37517729c3c8ed3af8a000bdc632df (diff) | |
| download | elna-5d808dd4c4003968bbdf180e1e1193231db5d43b.tar.gz | |
Strip outmost constness on infered arguments
Diffstat (limited to 'testsuite')
| -rw-r--r-- | testsuite/compilable/generic_const_inference.elna | 28 | ||||
| -rw-r--r-- | testsuite/compilable/generic_inference.elna | 2 |
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 |
