File tree Expand file tree Collapse file tree 2 files changed +67
-1
lines changed Expand file tree Collapse file tree 2 files changed +67
-1
lines changed Original file line number Diff line number Diff line change @@ -2957,7 +2957,7 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
29572957 }
29582958
29592959 case DAK_StorageRestrictions: {
2960- auto abbrCode = S.DeclTypeAbbrCodes [AccessesDeclAttrLayout ::Code];
2960+ auto abbrCode = S.DeclTypeAbbrCodes [StorageRestrictionsDeclAttrLayout ::Code];
29612961 auto attr = cast<StorageRestrictionsAttr>(DA);
29622962
29632963 SmallVector<IdentifierID, 4 > properties;
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+ // RUN: %empty-directory(%t/src)
3+ // RUN: %empty-directory(%t/sdk)
4+ // RUN: split-file %s %t/src
5+
6+ // REQUIRES: asserts
7+
8+ // RUN: %target-swift-frontend -emit-module %t/src/PublicModule.swift \
9+ // RUN: -module-name PublicModule -swift-version 5 \
10+ // RUN: -emit-module-path %t/sdk/PublicModule.swiftmodule \
11+ // RUN: -enable-experimental-feature InitAccessors
12+
13+ // RUN: %target-swift-frontend -typecheck %t/src/Client.swift \
14+ // RUN: -enable-experimental-feature InitAccessors \
15+ // RUN: -module-name Client -I %t/sdk
16+
17+ //--- PublicModule.swift
18+ public struct Test < T> {
19+ private var _x : T
20+
21+ public var x : T {
22+ @storageRestrictions ( initializes: _x)
23+ init {
24+ _x = newValue
25+ }
26+
27+ get { _x }
28+ set { _x = newValue }
29+ }
30+
31+ public init ( data: T ) {
32+ self . x = data
33+ }
34+ }
35+
36+ public struct TestMulti < T, U> {
37+ private var _a : T
38+ private var _c : U
39+
40+ public var b : Int
41+
42+ public var data : ( T , U ) {
43+ @storageRestrictions ( initializes: _a, _c, accesses: b)
44+ init {
45+ _a = newValue. 0
46+ _c = newValue. 1
47+ b = 0
48+ }
49+
50+ get { ( _a, _c) }
51+ }
52+
53+ public init ( data: ( T , U ) , b: Int ) {
54+ self . b = b
55+ self . data = data
56+ }
57+ }
58+
59+ //--- Client.swift
60+ import PublicModule
61+
62+ let test1 = Test < [ Int ] > ( data: [ 1 , 2 , 3 ] )
63+ _ = test1. x
64+
65+ let test2 = TestMulti ( data: ( " Question " , 42 ) , b: - 1 )
66+ _ = print ( " \( test2. data) , \( test2. b) " )
You can’t perform that action at this time.
0 commit comments