Skip to content

Commit 2c05750

Browse files
author
David Ungar
authored
Merge pull request #38467 from davidungar/again
Use `getOriginalInit` instead of `PatternBindingEntry::hasInitStringRepresentation`
2 parents a5732dd + fc0eca5 commit 2c05750

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,7 @@ SourceRange PatternBindingEntry::getSourceRange(bool omitAccessors) const {
15761576
bool PatternBindingEntry::hasInitStringRepresentation() const {
15771577
if (InitContextAndFlags.getInt().contains(PatternFlags::IsText))
15781578
return !InitStringRepresentation.empty();
1579-
return getInit() && getInit()->getSourceRange().isValid();
1579+
return getOriginalInit() && getOriginalInit()->getSourceRange().isValid();
15801580
}
15811581

15821582
StringRef PatternBindingEntry::getInitStringRepresentation(
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -emit-module %s
3+
4+
@propertyWrapper
5+
public struct TestWrapper {
6+
public var wrappedValue: Int
7+
public init(wrappedValue: Int) { self.wrappedValue = wrappedValue }
8+
}
9+
10+
@frozen public struct Test {
11+
@TestWrapper public var x: Int = 42
12+
}
13+

0 commit comments

Comments
 (0)