Skip to content

Commit 19f4ee7

Browse files
committed
[GSB] Don't crash when substitution fails to produce a type.
Fixes two more recently-found GSB crashers.
1 parent f72fec0 commit 19f4ee7

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3704,7 +3704,7 @@ ConstraintResult GenericSignatureBuilder::addRequirement(
37043704
ModuleDecl *inferForModule) {
37053705
auto subst = [&](Type t) {
37063706
if (subMap)
3707-
return t.subst(*subMap);
3707+
return t.subst(*subMap, SubstFlags::UseErrorType);
37083708

37093709
return t;
37103710
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This source file is part of the Swift.org open source project
2+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
3+
// Licensed under Apache License v2.0 with Runtime Library Exception
4+
//
5+
// See https://swift.org/LICENSE.txt for license information
6+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7+
8+
// REQUIRES: asserts
9+
// RUN: not %target-swift-frontend %s -emit-ir
10+
class a<a{protocol A{protocol A{}typealias e where f:A
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This source file is part of the Swift.org open source project
2+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
3+
// Licensed under Apache License v2.0 with Runtime Library Exception
4+
//
5+
// See https://swift.org/LICENSE.txt for license information
6+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7+
8+
// REQUIRES: asserts
9+
// RUN: not %target-swift-frontend %s -emit-ir
10+
class a<a{
11+
protocol A{{}typealias e where f=A
12+
protocol A

0 commit comments

Comments
 (0)