Skip to content

Commit 890dbf1

Browse files
authored
Merge pull request #8957 from slavapestov/fix-the-build-mostly
Fix the build mostly
2 parents b0a4318 + b4aaaee commit 890dbf1

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

lib/AST/SubstitutionMap.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ addSubstitution(CanSubstitutableType type, Type replacement) {
7676
}
7777

7878
Optional<ProtocolConformanceRef>
79-
SubstitutionMap::lookupConformance(CanType type, ProtocolDecl *proto) const {
79+
SubstitutionMap::lookupConformance(CanType origType, ProtocolDecl *proto) const {
80+
CanType type = origType;
81+
8082
// If we have an archetype, map out of the context so we can compute a
8183
// conformance access path.
8284
GenericEnvironment *genericEnv = nullptr;
@@ -146,7 +148,7 @@ SubstitutionMap::lookupConformance(CanType type, ProtocolDecl *proto) const {
146148
// FIXME: Rip this out once we can get a concrete conformance from
147149
// an archetype.
148150
auto *M = proto->getParentModule();
149-
auto substType = type.subst(*this);
151+
auto substType = origType.subst(*this);
150152
if (substType &&
151153
!substType->is<ArchetypeType>() &&
152154
!substType->isTypeParameter() &&
@@ -396,8 +398,13 @@ void SubstitutionMap::verify() const {
396398
}
397399

398400
void SubstitutionMap::dump(llvm::raw_ostream &out) const {
401+
auto *genericSig = getGenericSignature();
402+
if (genericSig == nullptr) {
403+
out << "Empty substitution map\n";
404+
return;
405+
}
399406
out << "Generic signature: ";
400-
getGenericSignature()->print(out);
407+
genericSig->print(out);
401408
out << "\n";
402409
out << "Substitutions:\n";
403410
for (const auto &sub : subMap) {

validation-test/execution/crashers/rdar18157434.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,12 @@ struct X<T> {
1717
var a: S
1818
}
1919

20-
X<()>()
20+
func generic<T>(_: T) {}
2121

22+
// We don't want the metadata allocation to be optimized away
23+
@_semantics("optimize.sil.never")
24+
func main() {
25+
generic(X<()>())
26+
}
27+
28+
main()

0 commit comments

Comments
 (0)