Repository: apple/swift
File: test/Parse/coroutine_accessors.swift (Swift)

Code before:
// Multiple reads
// =============================================================================

// If feature is disabled, this looks like an implicit
// getter that starts with an expression referring to
// symbols `yielding` and `borrow`
var iyb: Int {
  yielding borrow { // expected-disabled-error{{accessor_requires_coroutine_accessors}}
    fatalError()
  }
}

var ir: Int {
  read { // expected-enabled-warning{{old_coroutine_accessor}}
    // expected-disabled-error@-1{{cannot_find_in_scope}}
    fatalError()
  }
}

// enabled: conflicting accessors
// disabled: implicit getter
var iybr: Int {
  yielding borrow { // expected-disabled-error{{accessor_requires_coroutine_accessors}}
    fatalError()
  }
  read { // expected-warning{{old_coroutine_accessor}}
         // expected-error@-1{{duplicate_accessor}}
         // expected-note@-5{{previous_accessor}}
         // expected-disabled-error@-3{{accessor_requires_coroutine_accessors}}
    fatalError()
  }
}

// enabled: conflicting accessors
// disabled: implicit getter
var iryb: Int {
  read {  // expected-enabled-warning{{old_coroutine_accessor}}
    // expected-disabled-error@-1{{cannot_find_in_scope}}
    fatalError()
  }
  yielding borrow { // expected-enabled-error{{duplicate_accessor}}
      // expected-enabled-note@-5{{previous_accessor}}
      // expected-disabled-error@-2{{cannot_find_in_scope}}
      // expected-disabled-error@-3{{cannot_find_in_scope}}
      // expected-disabled-error@-4{{statement_same_line_without_semi}}
    fatalError()
  }
}

// enabled: conflicting accessors
// disabled: implicit getter.

Review comment (suggestion):
The test change here is because we no longer diagnose the use of `read`/`modify` when the experimental feature flag is not enabled.  When the experimental flag is enabled by default, we'll stop diagnosing even when it is enabled, in order to avoid breaking Swift Collections.

Code after:
// Multiple reads
// =============================================================================

// If feature is disabled, this looks like an implicit
// getter that starts with an expression referring to
// symbols `yielding` and `borrow`
var iyb: Int {
  yielding borrow { // expected-disabled-error{{accessor_requires_coroutine_accessors}}
    fatalError()
  }
}

var ir: Int {
  read { // expected-enabled-warning{{old_coroutine_accessor}}
    // expected-disabled-error@-1{{cannot_find_in_scope}}
    fatalError()
  }
}

// enabled: conflicting accessors
// disabled: implicit getter
var iybr: Int {
  yielding borrow { // expected-disabled-error{{accessor_requires_coroutine_accessors}}
    fatalError()
  }
  read { // expected-enabled-warning{{old_coroutine_accessor}}
         // expected-enabled-error@-1{{duplicate_accessor}}
         // expected-enabled-note@-5{{previous_accessor}}
         // expected-disabled-error@-3{{expected_accessor_kw}}
    fatalError()
  }
}

// enabled: conflicting accessors
// disabled: implicit getter
var iryb: Int {
  read {  // expected-enabled-warning{{old_coroutine_accessor}}
    // expected-disabled-error@-1{{cannot_find_in_scope}}
    fatalError()
  }
  yielding borrow { // expected-enabled-error{{duplicate_accessor}}
      // expected-enabled-note@-5{{previous_accessor}}
      // expected-disabled-error@-2{{cannot_find_in_scope}}
      // expected-disabled-error@-3{{cannot_find_in_scope}}
      // expected-disabled-error@-4{{statement_same_line_without_semi}}
    fatalError()
  }
}

// enabled: conflicting accessors
// disabled: implicit getter.