Skip to content

Commit 8bd68b3

Browse files
authored
Merge pull request #1276 from swiftwasm/master
[pull] swiftwasm from master
2 parents 6067452 + dc39fc9 commit 8bd68b3

File tree

5 files changed

+81
-3
lines changed

5 files changed

+81
-3
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,11 @@ const RequirementSource *RequirementSource::getMinimalConformanceSource(
845845

846846
if (parentEquivClass->concreteType)
847847
derivedViaConcrete = true;
848+
else if (parentEquivClass->superclass &&
849+
builder.lookupConformance(parentType->getCanonicalType(),
850+
parentEquivClass->superclass,
851+
source->getProtocolDecl()))
852+
derivedViaConcrete = true;
848853

849854
// The parent potential archetype must conform to the protocol in which
850855
// this requirement resides. Add this constraint.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
protocol P {
4+
associatedtype T : Q
5+
}
6+
7+
protocol Q {
8+
associatedtype T : R
9+
10+
var t: T { get }
11+
}
12+
13+
protocol R {}
14+
15+
func takesR<T : R>(_: T) {}
16+
17+
class C<T : Q> : P {}
18+
19+
struct Outer<T : P> {
20+
struct Inner<U> where T : C<U> {
21+
func doStuff(_ u: U) {
22+
takesR(u.t)
23+
}
24+
}
25+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
2+
3+
protocol P {
4+
associatedtype T : Q
5+
func foo()
6+
}
7+
8+
extension P {
9+
func foo() {}
10+
}
11+
12+
protocol Q {}
13+
14+
class C<T : Q> : P {}
15+
16+
protocol PP {
17+
associatedtype T : QQ
18+
func foo()
19+
}
20+
21+
extension PP {
22+
func foo() {}
23+
}
24+
25+
class QQ {}
26+
27+
class CC<T : QQ> : PP {}
28+
29+
// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s42class_conforms_with_default_implementation1CCyqd__GAA1PA2aEP3fooyyFTW : $@convention(witness_method: P) <τ_0_0><τ_1_0 where τ_0_0 : C<τ_1_0>, τ_1_0 : Q> (@in_guaranteed τ_0_0) -> () {
30+
// CHECK: [[WITNESS:%.*]] = function_ref @$s42class_conforms_with_default_implementation1PPAAE3fooyyF : $@convention(method) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> ()
31+
// CHECK: apply [[WITNESS]]<τ_0_0>(%0) : $@convention(method) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> ()
32+
// CHECK: return
33+
34+
// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s42class_conforms_with_default_implementation2CCCyqd__GAA2PPA2aEP3fooyyFTW : $@convention(witness_method: PP) <τ_0_0><τ_1_0 where τ_0_0 : CC<τ_1_0>, τ_1_0 : QQ> (@in_guaranteed τ_0_0) -> () {
35+
// CHECK: [[WITNESS:%.*]] = function_ref @$s42class_conforms_with_default_implementation2PPPAAE3fooyyF : $@convention(method) <τ_0_0 where τ_0_0 : PP> (@in_guaranteed τ_0_0) -> ()
36+
// CHECK: apply [[WITNESS]]<τ_0_0>(%0) : $@convention(method) <τ_0_0 where τ_0_0 : PP> (@in_guaranteed τ_0_0) -> ()
37+
// CHECK: return
38+
39+
// CHECK-LABEL: sil_witness_table hidden <T where T : Q> C<T>: P module class_conforms_with_default_implementation {
40+
// CHECK-NEXT: associated_type_protocol (T: Q): dependent
41+
// CHECK-NEXT: associated_type T: T
42+
// CHECK-NEXT: method #P.foo: <Self where Self : P> (Self) -> () -> () : @$s42class_conforms_with_default_implementation1CCyqd__GAA1PA2aEP3fooyyFTW
43+
// CHECK-NEXT: }
44+
45+
// CHECK-LABEL: sil_witness_table hidden <T where T : QQ> CC<T>: PP module class_conforms_with_default_implementation {
46+
// CHECK-NEXT: associated_type T: T
47+
// CHECK-NEXT: method #PP.foo: <Self where Self : PP> (Self) -> () -> () : @$s42class_conforms_with_default_implementation2CCCyqd__GAA2PPA2aEP3fooyyFTW
48+
// CHECK-NEXT: }

test/SymbolGraph/Symbols/Mixins/Availability/UnconditionallyUnavailable.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// RUN: %target-swift-symbolgraph-extract -module-name UnconditionallyUnavailable -I %t -pretty-print -output-dir %t
44
// RUN: %FileCheck %s --input-file %t/UnconditionallyUnavailable.symbols.json
55

6+
// REQUIRES: OS=macosx
7+
68
@available(iOS, unavailable)
79
public struct UnconditionallyUnavailable {}
810

validation-test/compiler_crashers_2/sr11108.swift renamed to validation-test/compiler_crashers_2_fixed/sr11108.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// RUN: not --crash %target-swift-emit-silgen %s
2-
3-
// REQUIRES: asserts
1+
// RUN: %target-swift-emit-silgen %s
42

53
protocol Example {
64
associatedtype Signed: SignedInteger

0 commit comments

Comments
 (0)