Skip to content

Commit 79e173e

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 8c318cf commit 79e173e

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
@@ -5838,7 +5838,8 @@ Expr *swift::findOriginalPropertyWrapperInitialValue(VarDecl *var,
58385838

58395839
// ... producing a value of the same nominal type as the innermost
58405840
// property wrapper.
5841-
if (call->getType()->getAnyNominal() != innermostNominal)
5841+
if (!call->getType() ||
5842+
call->getType()->getAnyNominal() != innermostNominal)
58425843
return { true, E };
58435844

58445845
// 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)