summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlasdair Armstrong2020-01-16 18:36:35 +0000
committerAlasdair Armstrong2020-01-16 18:37:04 +0000
commitbc55a2c25d0f2f630acf457420d5b868d2855ebc (patch)
treed34d38101a878dd1d6743246736bd8a9292bf954 /test
parent5c3bf1c0ecaadacdee1888778dde64df99f62e39 (diff)
Cleanup type-checking rule for LEXP_field
Was being overly conservative with nested structs and used an incorrect location for the error message
Diffstat (limited to 'test')
-rw-r--r--test/c/nested_fields.expect1
-rw-r--r--test/c/nested_fields.sail20
2 files changed, 21 insertions, 0 deletions
diff --git a/test/c/nested_fields.expect b/test/c/nested_fields.expect
new file mode 100644
index 00000000..0cfbf088
--- /dev/null
+++ b/test/c/nested_fields.expect
@@ -0,0 +1 @@
+2
diff --git a/test/c/nested_fields.sail b/test/c/nested_fields.sail
new file mode 100644
index 00000000..1e26dac9
--- /dev/null
+++ b/test/c/nested_fields.sail
@@ -0,0 +1,20 @@
+default Order dec
+
+$include <prelude.sail>
+
+struct B = {
+ f3: int,
+ f4: int,
+}
+
+struct A = {
+ f1: B,
+ f2: int,
+}
+
+register R : A
+
+function main() -> unit = {
+ R.f1.f3 = 2;
+ print_int("", R.f1.f3)
+} \ No newline at end of file