File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
validation-test/Sema/type_checker_crashers_fixed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -2706,6 +2706,15 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
27062706 if (!PBD->isInitialized (i))
27072707 continue ;
27082708
2709+ if (PBD->isInitializerSubsumed (i)) {
2710+ auto *var = PBD->getSingleVar ();
2711+ // The initializer of a property wrapped variable gets transferred
2712+ // the synthesized backing storage property, let have it contextualized
2713+ // there.
2714+ if (var && var->hasAttachedPropertyWrapper ())
2715+ continue ;
2716+ }
2717+
27092718 if (!PBD->isInitializerChecked (i)) {
27102719 TypeCheckExprOptions options;
27112720
Original file line number Diff line number Diff line change 1+ // RUN: %target-typecheck-verify-swift
2+
3+ enum CustomError : Error {
4+ }
5+
6+ struct ValidationError : Error {
7+ }
8+
9+ func parseOption( _: String ) throws -> Int {
10+ 42
11+ }
12+
13+ @propertyWrapper
14+ public struct Option < Value> {
15+ public var wrappedValue : Value
16+
17+ public init (
18+ wrappedValue: Value ,
19+ transform: @Sendable @escaping ( String) throws -> Value
20+ ) {
21+ self . wrappedValue = wrappedValue
22+ }
23+ }
24+
25+ struct Test {
26+ @Option ( transform: {
27+ do {
28+ return try parseOption ( $0)
29+ } catch let error as CustomError {
30+ throw ValidationError ( )
31+ }
32+ } )
33+ var prop : Int = 0
34+ }
You can’t perform that action at this time.
0 commit comments