You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling a method on a type that is unavailable due to an unmatched conformance does provide a diagnostic that leads the user in the right direction.
For example:
structA<B>{varc:Int{fatalError()}
subscript(position:Int)->B{fatalError()}}extensionAwhere B:Equatable{varc:Int{get{fatalError()}set{fatalError()}}
subscript(position:Int)->B{get{fatalError()}set{fatalError()}}func f()->Int{fatalError()}}func f(){leta=A<()>()
a.c =42// 👎 Cannot assign to property: 'c' is a get-only propertya[0]=()// 👎 Cannot assign through subscript: subscript is get-only
a.f()// 👍 Type '()' cannot conform to 'Equatable'}
Proposed solution
I think it would be nice to provide a diagnostic that includes this kind of hint. For example:
a.c =42// 👍 Cannot assign to property: '()' does not conform to 'Equatable'a[0]=()// 👍 Cannot assign through subscript: '()' does not conform to 'Equatable'
a.f()// 👍 Type '()' cannot conform to 'Equatable'
Alternatives considered
No response
Additional information
No response
The text was updated successfully, but these errors were encountered:
Motivation
Calling a method on a type that is unavailable due to an unmatched conformance does provide a diagnostic that leads the user in the right direction.
For example:
Proposed solution
I think it would be nice to provide a diagnostic that includes this kind of hint. For example:
Alternatives considered
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: