Skip to content

Commit 9d22ef0

Browse files
committed
[Sema] The property wrapper missing wrappedValue check should add fixit on a new line
1 parent baeb988 commit 9d22ef0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/Sema/TypeCheckPropertyWrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static VarDecl *findValueProperty(ASTContext &ctx, NominalTypeDecl *nominal,
5858
auto fixitLocation = nominal->getBraces().Start;
5959
nominal->diagnose(diag::property_wrapper_no_value_property,
6060
nominal->getDeclaredType(), name)
61-
.fixItInsertAfter(fixitLocation, fixIt);
61+
.fixItInsertAfter(fixitLocation, "\n"+fixIt);
6262
}
6363

6464
return nullptr;

test/decl/var/property_wrappers.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ struct WrapperAcceptingAutoclosure<T> {
5858

5959
@propertyWrapper
6060
struct MissingValue<T> { }
61-
// expected-error@-1{{property wrapper type 'MissingValue' does not contain a non-static property named 'wrappedValue'}} {{educational-notes=property-wrapper-requirements}}{{25-25=var wrappedValue: <#Value#>}}
61+
// expected-error@-1{{property wrapper type 'MissingValue' does not contain a non-static property named 'wrappedValue'}} {{educational-notes=property-wrapper-requirements}}{{25-25=\nvar wrappedValue: <#Value#>}}
6262

6363
@propertyWrapper
6464
struct StaticValue {
6565
static var wrappedValue: Int = 17
6666
}
67-
// expected-error@-3{{property wrapper type 'StaticValue' does not contain a non-static property named 'wrappedValue'}}{{21-21=var wrappedValue: <#Value#>}}
67+
// expected-error@-3{{property wrapper type 'StaticValue' does not contain a non-static property named 'wrappedValue'}}{{21-21=\nvar wrappedValue: <#Value#>}}
6868

6969

7070
// expected-error@+1{{'@propertyWrapper' attribute cannot be applied to this declaration}}

0 commit comments

Comments
 (0)