diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-01-06 18:39:09 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-01-11 16:30:08 +0100 |
| commit | 7ba329bce27b51ace8fe549772399aaee8695e33 (patch) | |
| tree | 2640fca62d6814dcf2ff696458bd3b735bfa58d6 /pkg | |
| parent | f9379c776e786ca412b32d6f2bcd81015bba47c4 (diff) | |
pkg/compiler: prohibit use of len/flags/const/proc types in out fields
These types in explict out fields is either unnecessary details or bugs in descriptions.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/compiler/check.go | 2 | ||||
| -rw-r--r-- | pkg/compiler/testdata/errors2.txt | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/pkg/compiler/check.go b/pkg/compiler/check.go index 9f74f8a4b..4fb90b631 100644 --- a/pkg/compiler/check.go +++ b/pkg/compiler/check.go @@ -332,6 +332,8 @@ func (comp *compiler) checkAttributeValues() { switch attr.Ident { case attrOutOverlay.Name: hasOutOverlay = true + fallthrough + case attrOut.Name, attrInOut.Name: isOut = true } } diff --git a/pkg/compiler/testdata/errors2.txt b/pkg/compiler/testdata/errors2.txt index c07e6a8a1..75c202fba 100644 --- a/pkg/compiler/testdata/errors2.txt +++ b/pkg/compiler/testdata/errors2.txt @@ -383,7 +383,7 @@ s405 { # Field attributes. -foo$overlay(a ptr[in, struct$overlay0]) +foo$overlay(a ptr[in, struct$overlay0], b ptr[in, struct$out0]) struct$overlay0 { f0 int32 @@ -392,3 +392,10 @@ struct$overlay0 { f3 proc[0, 1, int32] ### proc type must not be used as output f4 bytesize[f1, int32] ### bytesize type must not be used as output } + +struct$out0 { + f0 const[0, int32] (out) ### const type must not be used as output + f1 ptr[in, int32] (out) ### ptr type must not be used as output + f2 proc[0, 1, int32] (out) ### proc type must not be used as output + f3 bytesize[f1, int32] (out) ### bytesize type must not be used as output +} |
