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
Such a stated conformance is always redundant. This patch purposefully ignores conformance constraints that are parsed as inheritance clauses, such as with protocols and generic placeholders (e.g '<T : Any>'). These are best diagnosed in the generic signature builder.
// expected-warning@+2 {{redundant conformance of 'X0' to 'Any'}} {{13-18=}}
55
+
// expected-note@+1 {{all types implicitly conform to 'Any'}}
54
56
structX0:Any,CustomStringConvertible{
55
57
func print(){}
56
58
}
57
59
60
+
// expected-warning@+2 {{redundant conformance of 'X1' to 'Any'}} {{12-17=}}
61
+
// expected-note@+1 {{all types implicitly conform to 'Any'}}
58
62
classX1:Any,CustomStringConvertible{
59
63
func print(){}
60
64
}
61
65
66
+
// expected-warning@+2 {{redundant conformance of 'X2' to 'Any'}} {{8-14=}}
67
+
// expected-note@+1 {{all types implicitly conform to 'Any'}}
62
68
enumX2:Any{}
63
69
64
70
extensionX2:CustomStringConvertible{
65
71
func print(){}
66
72
}
67
73
74
+
structX5{
75
+
func print(){}
76
+
}
77
+
extensionX5:Any{} // expected-warning {{redundant conformance of 'X5' to 'Any'}} {{13-19=}}
78
+
// expected-note@-1 {{all types implicitly conform to 'Any'}}
79
+
80
+
extensionX5:Any,CustomStringConvertible{} // expected-warning {{redundant conformance of 'X5' to 'Any'}} {{16-21=}}
81
+
// expected-note@-1 {{all types implicitly conform to 'Any'}}
82
+
83
+
structX6{
84
+
func print(){}
85
+
}
86
+
extensionX6:CustomStringConvertible,Any{} // expected-warning {{redundant conformance of 'X6' to 'Any'}} {{39-44=}}
87
+
// expected-note@-1 {{all types implicitly conform to 'Any'}}
88
+
89
+
structX7<T>:Any{} // expected-warning {{redundant conformance of 'X7<T>' to 'Any'}} {{13-19=}}
90
+
// expected-note@-1 {{all types implicitly conform to 'Any'}}
91
+
92
+
structX8<T>{
93
+
func print(){}
94
+
}
95
+
extensionX8:Anywhere T :CustomStringConvertible{} // expected-warning {{redundant conformance of 'X8<T>' to 'Any'}} {{13-19=}}
96
+
// expected-note@-1 {{all types implicitly conform to 'Any'}}
97
+
98
+
typealiasAnyAlias=Any
99
+
classX9:AnyAlias{} // expected-warning {{redundant conformance of 'X9' to 'AnyAlias' (aka 'Any')}} {{9-20=}}
100
+
// expected-note@-1 {{all types implicitly conform to 'AnyAlias' (aka 'Any')}}
101
+
102
+
structX10:Any&Any{} // expected-warning {{redundant conformance of 'X10' to 'Any'}} {{11-23=}}
103
+
// expected-note@-1 {{all types implicitly conform to 'Any'}}
104
+
105
+
// FIX-ME(SR-8009): Handle these cases.
106
+
protocolP5:Any{}
107
+
func foo<T :Any>(_ x:T){}
108
+
68
109
// Explicit conformance checks (unsuccessful)
69
110
111
+
// expected-warning@+2 {{redundant conformance of 'NotPrintableS' to 'Any'}} {{24-29=}}
112
+
// expected-note@+1 {{all types implicitly conform to 'Any'}}
70
113
structNotPrintableS:Any,CustomStringConvertible{} // expected-error{{type 'NotPrintableS' does not conform to protocol 'CustomStringConvertible'}}
71
114
115
+
// expected-warning@+2 {{redundant conformance of 'NotPrintableC' to 'Any'}} {{46-51=}}
116
+
// expected-note@+1 {{all types implicitly conform to 'Any'}}
72
117
classNotPrintableC:CustomStringConvertible,Any{} // expected-error{{type 'NotPrintableC' does not conform to protocol 'CustomStringConvertible'}}
73
118
119
+
// expected-warning@+2 {{redundant conformance of 'NotPrintableO' to 'Any'}} {{22-27=}}
120
+
// expected-note@+1 {{all types implicitly conform to 'Any'}}
74
121
enumNotPrintableO:Any,CustomStringConvertible{} // expected-error{{type 'NotPrintableO' does not conform to protocol 'CustomStringConvertible'}}
75
122
76
123
structNotFormattedPrintable:FormattedPrintable{ // expected-error{{type 'NotFormattedPrintable' does not conform to protocol 'CustomStringConvertible'}}
0 commit comments