diff --git a/vlib/v/tests/aliased_field_access_test.v b/vlib/v/tests/aliased_field_access_test.v new file mode 100644 index 0000000000..94364ccea7 --- /dev/null +++ b/vlib/v/tests/aliased_field_access_test.v @@ -0,0 +1,12 @@ +struct Data { + field int +} + +type AliasWithPtr = &Data + +fn test_aliased_field_access_test() { + data_with_ptr := AliasWithPtr(&Data{ + field: 1 + }) + assert data_with_ptr.field == 1 +} diff --git a/vlib/v/tests/known_errors/testdata/shared_in_alias_test.vv b/vlib/v/tests/known_errors/testdata/shared_in_alias_test.vv new file mode 100644 index 0000000000..eecb6e496d --- /dev/null +++ b/vlib/v/tests/known_errors/testdata/shared_in_alias_test.vv @@ -0,0 +1,12 @@ +struct Data { + field int +} + +type AliasWithShared = shared Data + +fn test_shared_in_alias() { + data_with_shared := AliasWithShared(&Data{ + field: 1 + }) + assert data_with_shared.field == 1 +}