-
Notifications
You must be signed in to change notification settings - Fork 10.5k
CS: Handle unbound references to @objc optional methods #41849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please smoke test macOS |
CC @beccadax |
199f49d
to
5697adf
Compare
@swift-ci please smoke test macOS |
Awesome, I've been wanting to get rid of |
5697adf
to
0a36138
Compare
@swift-ci please smoke test macOS |
a19f4dd
to
f2d84c2
Compare
@swift-ci please smoke test macOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property wrapper changes look great, thank you!
lib/Sema/CSApply.cpp
Outdated
|
||
newCalleeParams.push_back(calleeParam.withType(paramRef->getType())); | ||
|
||
// FIXME: inout/vararg? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inout
wrapped parameters were intentionally left out of SE-0293: https://github.com/apple/swift-evolution/blob/main/proposals/0293-extend-property-wrappers-to-function-and-closure-parameters.md#support-inout-in-wrapped-function-parameters
Good point about variadics, presumably this should work and it doesn't today
@propertyWrapper struct Wrapper {
var wrappedValue: [Int]
}
func test(@Wrapper value: Int...) {
print(value)
}
let f = test(value:)
f(1, 2, 3) // error: extra arguments in call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, will mark inout
as a TODO:
then! Was it supposed to be an error to have an inout
wrapped parameter?
Good point about variadics, presumably this should work and it doesn't today
Interesting, I was expecting @Wrapper value: Int...
to mean [Wrapper<Int>]
rather than Wrapper<[Int]>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a variadic wrapped parameter would have to mean the wrapped value is an array type because of the restriction that the parameter to init(wrappedValue:)
must either exactly match the wrappedValue
type or be an autoclosure
returning the wrappedValue
type.
Was it supposed to be an error to have an inout wrapped parameter?
Oops, yeah I think that should be an error at the declaration. Hopefully no code is actually using an inout
wrapped parameter, because the synthesized accessors inside the body don't actually let you mutate the parameter anyway. I also suspect the compiler will crash in the case where the wrapper has init(projectedValue:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I misread your comment about variadics as Wrapper<Int>
, I understand what you're saying now. Interesting! My brain definitely interpreted @Wrapper value: Int...
as a single wrapper.
f2d84c2
to
7b65306
Compare
@swift-ci please smoke test |
7b65306
to
57941a0
Compare
@swift-ci please smoke test |
57941a0
to
f6eef62
Compare
f6eef62
to
1d6ed0a
Compare
@swift-ci please smoke test |
…lding single curry thunks
…re a double thunk is not needed
…le curry thunk from scratch
1d6ed0a
to
e2bde57
Compare
@swift-ci please smoke test |
@swift-ci please test source compatibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth adding an executable test as well, since there are so many moving parts here?
Just for UPD: Added some executable tests for |
e2bde57
to
2badb3b
Compare
2badb3b
to
77b3f24
Compare
@swift-ci please smoke test |
@swift-ci please test source compatibility |
@slavapestov Must've been tiring to even skim through all of this, thank you! |
Mostly a cleanup and refactoring so that the target change fits nicely. The dynamic lookup case needs more work.
Resolves rdar://69761566