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
[Archetype builder] Simplify handling of typealiases in protocols.
PotentialArchetype::getNestedType() was effectively reimplementing a
simplified form of mapTypeOutOfContext(), missing some cases in the
process. Just use mapTypeOutOfContext() and resolveArchetype(). While
here, stop re-implementing the addSameType* operations; just call them
directly. With these changes, we no longer need the "typealias in
protocol is too complex" diagnostic.
Eliminates another use of getSelfTypeInContext().
Copy file name to clipboardExpand all lines: test/decl/typealias/protocol.swift
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -110,7 +110,7 @@ protocol P2 {
110
110
associatedtypeB
111
111
}
112
112
113
-
func go3<T :P1, U :P2>(_ x:T)->Uwhere T.F ==U.B{ // expected-error {{typealias 'F' is too complex to be used as a generic constraint; use an associatedtype instead}} expected-error {{'F' is not a member type of 'T'}}
113
+
func go3<T :P1, U :P2>(_ x:T)->Uwhere T.F ==U.B{
114
114
}
115
115
116
116
// Specific diagnosis for things that look like Swift 2.x typealiases
@@ -179,3 +179,12 @@ struct S7 : P7 {
179
179
_ =Y.self
180
180
}
181
181
}
182
+
183
+
protocolP8{
184
+
associatedtypeB
185
+
186
+
@available(*, unavailable, renamed:"B")
187
+
typealiasA=B // expected-note{{'A' has been explicitly marked unavailable here}}
188
+
}
189
+
190
+
func testP8<T:P8>(_:T)where T.A ==Int{} // expected-error{{'A' has been renamed to 'B'}}{{34-35=B}}
Copy file name to clipboardExpand all lines: test/stdlib/Renames.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,7 @@ func _Collection() {
59
59
}
60
60
61
61
func _Collection<C :Collection>(c:C){
62
-
func fn<T :Collection, U>(_:T, _:U)where T.Generator ==U{} // expected-error {{'T' does not have a member type named 'Generator'; did you mean 'Iterator'?}} {{50-59=Iterator}} {{none}}
62
+
func fn<T :Collection, U>(_:T, _:U)where T.Generator ==U{} // expected-error {{'Generator' has been renamed to 'Iterator'}} {{50-59=Iterator}} {{none}}
63
63
_ = c.generate() // expected-error {{'generate()' has been renamed to 'makeIterator()'}} {{9-17=makeIterator}} {{none}}
64
64
_ = c.underestimateCount() // expected-error {{'underestimateCount()' has been replaced by 'underestimatedCount'}} {{9-27=underestimatedCount}} {{27-29=}} {{none}}
Copy file name to clipboardExpand all lines: validation-test/compiler_crashers_fixed/28448-dist-nested-type-should-have-matched-associated-type-failed.swift
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,5 @@
5
5
// See https://swift.org/LICENSE.txt for license information
6
6
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7
7
8
-
// RUN: not --crash %target-swift-frontend %s -emit-ir
9
-
// REQUIRES: asserts
8
+
// RUN: not %target-swift-frontend %s -emit-ir
10
9
extensionA{func c:f.c:typealias e:A{}}protocol A{typealias f{}typealias e
0 commit comments