Skip to content

Commit e0bec70

Browse files
authored
Merge pull request #6090 from bitjammer/guard-null-generic-env
2 parents b4d30b7 + 25e623a commit e0bec70

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

lib/Sema/TypeCheckGeneric.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ Type GenericTypeToArchetypeResolver::resolveGenericTypeParamType(
9090
if (gpDecl->isInvalid())
9191
return ErrorType::get(gpDecl->getASTContext());
9292

93-
return GenericEnv->mapTypeIntoContext(gp);
93+
if (auto *Env = GenericEnv)
94+
return Env->mapTypeIntoContext(gp);
95+
96+
return ErrorType::get(gpDecl->getASTContext());
9497
}
9598

9699
Type GenericTypeToArchetypeResolver::resolveDependentMemberType(

validation-test/IDE/crashers/099-swift-genericenvironment-maptypeintocontext.swift

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s
2+
a{
3+
protocol e{
4+
typealias e
5+
extension{
6+
let b{let a={
7+
#^A^#func f:e

validation-test/compiler_crashers/28466-segfault-0xc27624-0xc2741f-0xc25bb5-0xbcdbbb.swift renamed to validation-test/compiler_crashers_fixed/28466-segfault-0xc27624-0xc2741f-0xc25bb5-0xbcdbbb.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
// See https://swift.org/LICENSE.txt for license information
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// RUN: not --crash %target-swift-frontend %s -emit-ir
8+
// RUN: not %target-swift-frontend %s -emit-ir
99
{associatedtype b<T>func c:[T

0 commit comments

Comments
 (0)