@@ -86,12 +86,16 @@ func test_invalid_refs_in_init_attrs() {
8686 // expected-error@-2 {{find type 'b' in scope}}
8787 // expected-error@-3 {{init accessor cannot refer to property 'c'; init accessors can refer only to stored properties}}
8888 init( initialValue) { }
89+
90+ get { 0 }
8991 }
9092
9193 var y : String {
9294 @storageRestrictions ( initializes: test)
9395 // expected-error@-1 {{ambiguous reference to member 'test'}}
9496 init( initialValue) { }
97+
98+ get { " " }
9599 }
96100
97101 func test( _: Int ) { } // expected-note {{'test' declared here}}
@@ -110,6 +114,8 @@ func test_assignment_to_let_properties() {
110114 self . x = initialValue // Ok
111115 self . y = 42 // expected-error {{cannot assign to property: 'y' is a 'let' constant}}
112116 }
117+
118+ get { x }
113119 }
114120
115121 var point : ( Int , Int ) {
@@ -157,6 +163,8 @@ func test_duplicate_and_computed_lazy_properties() {
157163 // expected-error@-2 {{init accessor cannot refer to property 'b'; init accessors can refer only to stored properties}}
158164 // expected-error@-3 {{init accessor cannot refer to property 'c'; init accessors can refer only to stored properties}}
159165 init( initialValue) { }
166+
167+ get { _a }
160168 }
161169
162170 var b : Int {
@@ -475,11 +483,15 @@ func test_default_arguments_are_analyzed() {
475483 struct Test {
476484 var pair : ( Int , Int ) = ( 0 , 1 ) { // Ok
477485 init { }
486+
487+ get { ( 0 , 1 ) }
478488 }
479489
480490 var other : ( Int , String ) = ( " " , 42 ) {
481491 // expected-error@-1 {{cannot convert value of type '(String, Int)' to specified type '(Int, String)'}}
482492 init ( initialValue) { }
493+
494+ get { ( 0 , " " ) }
483495 }
484496
485497 var otherPair = ( 0 , 1 ) {
@@ -558,36 +570,47 @@ func test_invalid_storage_restrictions() {
558570 @storageRestrictions ( )
559571 // expected-error@-1 {{missing label in @storageRestrictions attribute}}
560572 init { }
573+
574+ get { _a }
561575 }
562576
563577 var b : Int {
564578 @storageRestrictions ( initializes: )
565579 // expected-error@-1 {{expected property name in @storageRestrictions list}}
566580 init { }
581+
582+ get { _b }
567583 }
568584
569585 var c : Int {
570586 @storageRestrictions ( initializes: a, initializes: b)
571587 // expected-error@-1 {{duplicate label 'initializes' in @storageRestrictions attribute}}
572588 init { }
589+
590+ get { 0 }
573591 }
574592
575593 var d : Int {
576594 @storageRestrictions ( accesses: a, accesses: c)
577595 // expected-error@-1 {{duplicate label 'accesses' in @storageRestrictions attribute}}
578596 init { }
597+
598+ get { 0 }
579599 }
580600
581601 var e : Int {
582602 @storageRestrictions ( initialize: a, b, accesses: c, d)
583603 // expected-error@-1 {{unexpected label 'initialize' in @storageRestrictions attribute}}
584604 init { }
605+
606+ get { 0 }
585607 }
586608
587609 var f : Int {
588610 @storageRestrictions ( initializes: _a, accesses: _b, _a)
589611 // expected-error@-1 {{property '_a' cannot be both initialized and accessed}}
590612 init { }
613+ // expected-error@-1 {{variable with an init accessor must also have a getter}}
591614 }
592615
593616 var g : Int {
0 commit comments