mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
"unavoidable failure" path, along with Failure::DoesNotHaveNonMutatingMember and just doing some basic disambiguation in CSDiags. This provides some benefits: - Allows us to plug in much more specific diagnostics for the existing "only has mutating members" diagnostic, including producing notes for why the base expr isn't mutable (see e.g. test/Sema/immutability.swift diffs). - Corrects issues where we'd drop full decl name info for selector references. - Wordsmiths diagnostics to not complain about "values of type Foo.Type" instead complaining about "type Foo" - Where before we would diagnose all failures with "has no member named", we now distinguish between when there is no member, and when you can't use it. When you can't use it, you get a vauge "cannot use it" diagnostic, but... - This provides an infrastructure for diagnosing other kinds of problems (e.g. trying to use a private member or a static member from an instance). - Improves a number of cases where failed type member constraints would produce uglier diagnostics than a different constraint failure would. - Resolves a number of rdars, e.g. (and probably others): <rdar://problem/20294245> QoI: Error message mentions value rather than key for subscript Swift SVN r30715
24 lines
484 B
Swift
24 lines
484 B
Swift
// RUN: %target-parse-verify-swift
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
@objc protocol OP1 {
|
|
func reqOP1a() -> Bool
|
|
}
|
|
|
|
extension OP1 {
|
|
final func extOP1a() -> Bool { return !reqOP1a() }
|
|
}
|
|
|
|
class OC1 : OP1 {
|
|
@objc func reqOP1a() -> Bool { return true }
|
|
}
|
|
|
|
func testOP1(oc1: OC1, ao: AnyObject) {
|
|
oc1.extOP1a()
|
|
ao.reqOP1a!() // okay
|
|
|
|
// Extension of @objc protocol does not have @objc members.
|
|
ao.extOP1a!() // expected-error{{value of type 'AnyObject' has no member 'extOP1a'}}
|
|
}
|