Skip to content

Commit 118a557

Browse files
committed
[SE-0258] Check for a NULL type.
Within invalid code, we might encounter expressions without type information yet. Check for NULL here. Fixes crash from rdar://problem/53120878.
1 parent 0df2987 commit 118a557

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/AST/Decl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5905,7 +5905,8 @@ Expr *swift::findOriginalPropertyWrapperInitialValue(VarDecl *var,
59055905

59065906
// ... producing a value of the same nominal type as the innermost
59075907
// property wrapper.
5908-
if (call->getType()->getAnyNominal() != innermostNominal)
5908+
if (!call->getType() ||
5909+
call->getType()->getAnyNominal() != innermostNominal)
59095910
return { true, E };
59105911

59115912
// Find the implicit initialValue argument.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: not %target-swift-frontend -typecheck %s
2+
public struct Use { @Wrap var value: some Doubl = 1.0 }
3+
@propertyWrapper public struct Wrap { public var wrappedValue: Double }
4+

0 commit comments

Comments
 (0)