diff options
| author | Alasdair Armstrong | 2017-07-27 15:45:31 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2017-07-27 15:45:31 +0100 |
| commit | a83fc8ac56687858fbf4f35091f8a51f626f98db (patch) | |
| tree | 27cb28635db7d8c8fefcfcf7e651c41f4c13095c | |
| parent | a83a8594e21b1e8e5361cd339d30b5e71e58ded3 (diff) | |
Add test cases for overlapping record field names
| -rw-r--r-- | test/typecheck/fail/overlap_field_wreg.sail | 13 | ||||
| -rw-r--r-- | test/typecheck/pass/overlap_field.sail | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/test/typecheck/fail/overlap_field_wreg.sail b/test/typecheck/fail/overlap_field_wreg.sail new file mode 100644 index 00000000..4c4d858d --- /dev/null +++ b/test/typecheck/fail/overlap_field_wreg.sail @@ -0,0 +1,13 @@ + +typedef A = const struct {bool field_A; int shared} +typedef B = const struct {bool field_B; int shared} + +val (bool, int) -> A effect {undef, wreg} makeA + +function makeA (x, y) = +{ + (A) record := undefined; + record.field_A := x; + record.shared := y; + record +} diff --git a/test/typecheck/pass/overlap_field.sail b/test/typecheck/pass/overlap_field.sail new file mode 100644 index 00000000..82e685ee --- /dev/null +++ b/test/typecheck/pass/overlap_field.sail @@ -0,0 +1,13 @@ + +typedef A = const struct {bool field_A; int shared} +typedef B = const struct {bool field_B; int shared} + +val (bool, int) -> A effect {undef} makeA + +function makeA (x, y) = +{ + (A) record := undefined; + record.field_A := x; + record.shared := y; + record +} |
