-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25821 from DougGregor/property-wrappers-multifile…
…-rdar51725203-5.1
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@propertyWrapper | ||
struct Wrapper<Value> { | ||
var wrappedValue: Value | ||
|
||
var projectedValue: Wrapper<Value> { | ||
get { self } | ||
set { self = newValue } | ||
} | ||
|
||
init(initialValue: Value) { | ||
wrappedValue = initialValue | ||
} | ||
} | ||
|
||
struct StructModel { | ||
@Wrapper var foo: Int | ||
@Wrapper var bar: Int // expected-note{{'_bar' declared here}} | ||
} | ||
|
||
class ClassModel { | ||
@Wrapper var foo = 17 | ||
@Wrapper var bar = 17 // expected-note{{'_bar' declared here}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// RUN: %target-swift-frontend -typecheck -verify -primary-file %s %S/Inputs/rdar51725203.swift | ||
|
||
func test(sm: StructModel, cm: ClassModel) { | ||
_ = sm.$foo | ||
_ = cm.$foo | ||
|
||
_ = sm._bar // expected-error{{'_bar' is inaccessible due to 'private' protection level}} | ||
_ = cm._bar // expected-error{{'_bar' is inaccessible due to 'private' protection level}} | ||
} |