mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen: Fix silly mistake in MetadataPath::followComponent()
This fixes a regression from a00157ec43.
My change made it so that sourceKey.Kind was checked after being
overwritten with an abstract conformance, so we would never take
the if statement. Incredibly, it almost worked.
Fixes rdar://problem/148698142.
This commit is contained in:
@@ -3390,16 +3390,15 @@ MetadataResponse MetadataPath::followComponent(IRGenFunction &IGF,
|
||||
assert(entry.isOutOfLineBase());
|
||||
auto inheritedProtocol = entry.getBase();
|
||||
|
||||
sourceKey.Kind =
|
||||
LocalTypeDataKind::forAbstractProtocolWitnessTable(inheritedProtocol);
|
||||
if (sourceKey.Kind.isConcreteProtocolConformance()) {
|
||||
auto inheritedConformance =
|
||||
sourceKey.Kind.getConcreteProtocolConformance()
|
||||
->getInheritedConformance(inheritedProtocol);
|
||||
if (inheritedConformance) {
|
||||
sourceKey.Kind = LocalTypeDataKind::forConcreteProtocolWitnessTable(
|
||||
inheritedConformance);
|
||||
}
|
||||
sourceKey.Kind = LocalTypeDataKind::forConcreteProtocolWitnessTable(
|
||||
inheritedConformance);
|
||||
} else {
|
||||
sourceKey.Kind =
|
||||
LocalTypeDataKind::forAbstractProtocolWitnessTable(inheritedProtocol);
|
||||
}
|
||||
|
||||
if (!source) return MetadataResponse();
|
||||
|
||||
29
test/IRGen/conformance_path_with_concrete_steps.swift
Normal file
29
test/IRGen/conformance_path_with_concrete_steps.swift
Normal file
@@ -0,0 +1,29 @@
|
||||
// RUN: %target-swift-frontend -emit-ir %s
|
||||
|
||||
public protocol P1 {
|
||||
associatedtype A: P3
|
||||
}
|
||||
|
||||
public protocol P2: P1 where A.B == G<C> {
|
||||
associatedtype C where C == A.B.C
|
||||
}
|
||||
|
||||
public protocol P3 {
|
||||
associatedtype B: P4
|
||||
}
|
||||
|
||||
public protocol P4: P5 {}
|
||||
|
||||
public protocol P5 {
|
||||
associatedtype C: P6
|
||||
}
|
||||
|
||||
public protocol P6 {
|
||||
func foo()
|
||||
}
|
||||
|
||||
public struct G<C: P6>: P4 {}
|
||||
|
||||
public func f<T: P2>(_: T, c: T.C) {
|
||||
return c.foo()
|
||||
}
|
||||
Reference in New Issue
Block a user