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 @@ -2692,6 +2692,15 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
26922692 if (!PBD->isInitialized (i))
26932693 continue ;
26942694
2695+ if (PBD->isInitializerSubsumed (i)) {
2696+ auto *var = PBD->getSingleVar ();
2697+ // The initializer of a property wrapped variable gets transferred
2698+ // the synthesized backing storage property, let have it contextualized
2699+ // there.
2700+ if (var && var->hasAttachedPropertyWrapper ())
2701+ continue ;
2702+ }
2703+
26952704 if (!PBD->isInitializerChecked (i)) {
26962705 TypeCheckExprOptions options;
26972706
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