Skip to content

Commit 9a345d6

Browse files
authored
Merge pull request #1249 from swiftwasm/release/5.3
[pull] swiftwasm-release/5.3 from release/5.3
2 parents 81e6039 + bc5c85c commit 9a345d6

File tree

8 files changed

+130
-143
lines changed

8 files changed

+130
-143
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 103 additions & 137 deletions
Large diffs are not rendered by default.

test/Constraints/same_types.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,14 @@ func test6<T: Barrable>(_ t: T) -> (Y, X) where T.Bar == Y {
8989
}
9090

9191
func test7<T: Barrable>(_ t: T) -> (Y, X) where T.Bar == Y, T.Bar.Foo == X {
92-
// expected-warning@-1{{redundant same-type constraint 'T.Bar.Foo' == 'X'}}
93-
// expected-note@-2{{same-type constraint 'T.Bar.Foo' == 'Y.Foo' (aka 'X') implied here}}
92+
// expected-warning@-1{{neither type in same-type constraint ('Y.Foo' (aka 'X') or 'X') refers to a generic parameter or associated type}}
9493
return (t.bar, t.bar.foo)
9594
}
9695

9796
func fail4<T: Barrable>(_ t: T) -> (Y, Z)
9897
where
99-
T.Bar == Y, // expected-note{{same-type constraint 'T.Bar.Foo' == 'Y.Foo' (aka 'X') implied here}}
100-
T.Bar.Foo == Z { // expected-error{{'T.Bar.Foo' cannot be equal to both 'Z' and 'Y.Foo' (aka 'X')}}
98+
T.Bar == Y,
99+
T.Bar.Foo == Z { // expected-error{{generic signature requires types 'Y.Foo' (aka 'X') and 'Z' to be the same}}
101100
return (t.bar, t.bar.foo) // expected-error{{cannot convert return expression of type '(Y, X)' to return type '(Y, Z)'}}
102101
}
103102

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public protocol P {
2+
associatedtype T
3+
}

test/Generics/sr8945.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -emit-module %S/Inputs/sr8945-other.swift -emit-module-path %t/other.swiftmodule -module-name other
3+
// RUN: %target-swift-frontend -emit-silgen %s -I%t
4+
5+
import other
6+
7+
public class C : P {
8+
public typealias T = Int
9+
}
10+
11+
public func takesInt(_: Int) {}
12+
13+
public func foo<T : C, S : Sequence>(_: T, _ xs: S) where S.Element == T.T {
14+
for x in xs {
15+
takesInt(x)
16+
}
17+
}

test/IDE/print_ast_tc_decls_errors.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ protocol AssociatedType1 {
192192
// TYREPR: {{^}} associatedtype AssociatedTypeDecl4 : FooNonExistentProtocol, BarNonExistentProtocol{{$}}
193193

194194
associatedtype AssociatedTypeDecl5 : FooClass
195-
// CHECK: {{^}} associatedtype AssociatedTypeDecl5 : FooClass{{$}}
195+
// CHECK: {{^}} associatedtype AssociatedTypeDecl5{{$}}
196196
}
197197

198198
//===---

test/decl/protocol/req/recursion.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public struct S<A: P> where A.T == S<A> { // expected-error {{circular reference
4848
// expected-error@-2 {{generic struct 'S' references itself}}
4949
func f(a: A.T) {
5050
g(a: id(t: a))
51-
// expected-error@-1 {{cannot convert value of type 'A.T' to expected argument type 'S<A>'}}
51+
// expected-error@-1 {{type of expression is ambiguous without more context}}
5252
_ = A.T.self
5353
}
5454

validation-test/compiler_crashers_2_fixed/0159-rdar40009245.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
protocol P {
44
associatedtype A : P where A.X == Self
5+
// expected-error@-1{{'X' is not a member type of 'Self.A}}
56
associatedtype X : P where P.A == Self
67
// expected-error@-1{{associated type 'A' can only be used with a concrete type or generic parameter base}}
78
}

validation-test/compiler_crashers_2_fixed/0163-sr8033.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ protocol P1 {
77
}
88
extension Foo: P1 where A : P1 {} // expected-error {{unsupported recursion for reference to associated type 'A' of type 'Foo<T>'}}
99
// expected-error@-1 {{type 'Foo<T>' does not conform to protocol 'P1'}}
10+
// expected-error@-2 {{type 'Foo<T>' in conformance requirement does not refer to a generic parameter or associated type}}

0 commit comments

Comments
 (0)