Skip to content

[Typechecker] Fix an issue with @escaping when used with a generic function #22231

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

Merged
merged 1 commit into from
Jan 31, 2019
Merged

[Typechecker] Fix an issue with @escaping when used with a generic function #22231

merged 1 commit into from
Jan 31, 2019

Conversation

theblixguy
Copy link
Collaborator

This PR resolves an issue where using a type alias as an argument to @escaping on a generic function inside a protocol would trigger an error diagnostic. This is a regression in Swift 5.0, which is now fixed.

public protocol FooProtocol {
  typealias CompletionHandler = (Int) -> ()
  func doSomething<T>(with thing: T, then: @escaping CompletionHandler) // ok
}

Resolves SR-9760.
Resolves rdar://problem/47550733

@theblixguy
Copy link
Collaborator Author

cc @xedin

@slavapestov slavapestov self-assigned this Jan 30, 2019
Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, +1 on the Slava's remark about comment.

I'll look into refactoring @autoclosure handling a bit here, it has the same problem even after these changes since everything is based on representative.

@xedin
Copy link
Contributor

xedin commented Jan 30, 2019

@swift-ci please test

@xedin
Copy link
Contributor

xedin commented Jan 30, 2019

@swift-ci please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 24e2966c27b20a367199b4ccf824d7706dca0242

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 24e2966c27b20a367199b4ccf824d7706dca0242

@theblixguy
Copy link
Collaborator Author

theblixguy commented Jan 30, 2019

@xedin Seems like the both tests are failing (on macOS) due to unrelated issues:

DVTDownloadable: Failed to get authorization with error Error Domain=DVTDownloadableErrors Code=3 "The authorization was denied since no user interaction was possible." UserInfo={AuthorizationErrorCode=-60007, NSLocalizedDescription=The authorization was denied since no user interaction was possible.}
xcodebuild: error: The authorization was denied since no user interaction was possible.

15:16:19 Traceback (most recent call last):
15:16:19 File "./swift-source-compat-suite/run", line 277, in
15:16:19 sys.exit(main())
15:16:19 File "./swift-source-compat-suite/run", line 44, in main
15:16:19 execute_runner(workspace, args)
15:16:19 File "./swift-source-compat-suite/run", line 185, in execute_runner
15:16:19 common.check_execute(runner_command, timeout=9999999)
15:16:19 File "/Users/buildnode/jenkins/workspace/swift-PR-source-compat-suite-debug/swift-source-compat-suite/common.py", line 378, in check_execute
15:16:19 raise ExecuteCommandFailure(command, returncode)
15:16:19 common.ExecuteCommandFailure: ExecuteCommandFailure(command="./runner.py --swiftc /Users/buildnode/jenkins/workspace-private/swift-PR-source-compat-suite-debug/build/compat_macos/install/toolchain/usr/bin/swiftc --projects projects.json --include-actions 'action.startswith("Build")' --swift-branch master --sandbox-profile-xcodebuild ../../../workspace-private/swift-source-compat-suite-sandbox/sandbox_xcodebuild.sb --sandbox-profile-package ../../../workspace-private/swift-source-compat-suite-sandbox/sandbox_package.sb --build-config=debug", returncode=1)

@xedin
Copy link
Contributor

xedin commented Jan 30, 2019

@shahmishal FYI, build failure was:

2019-01-30 12:44:38.176 xcodebuild[23646:2149351]  DVTDownloadable: Failed to get authorization with error Error Domain=DVTDownloadableErrors Code=3 "The authorization was denied since no user interaction was possible." UserInfo={AuthorizationErrorCode=-60007, NSLocalizedDescription=The authorization was denied since no user interaction was possible.}
xcodebuild: error: The authorization was denied since no user interaction was possible.

@xedin
Copy link
Contributor

xedin commented Jan 30, 2019

I also opened a PR to Un-XFAIL GRDB

@xedin
Copy link
Contributor

xedin commented Jan 30, 2019

@swift-ci please test macOS platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - be6dc7c

@xedin
Copy link
Contributor

xedin commented Jan 31, 2019

It seems like we'll just have to wait to get this resolved.

@theblixguy
Copy link
Collaborator Author

@xedin oh, okay!

@slavapestov
Copy link
Contributor

@swift-ci Please smoke test macOS

@xedin
Copy link
Contributor

xedin commented Jan 31, 2019

@swift-ci please test source compatibility

@xedin
Copy link
Contributor

xedin commented Jan 31, 2019

@swift-ci please test macOS platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - be6dc7c

@theblixguy
Copy link
Collaborator Author

theblixguy commented Jan 31, 2019

@xedin @slavapestov Source compat is now passing, but macOS test is still failing due to unrelated reason (in test/stdlib/KVOKeyPaths.swift):

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x79673140 of class _TtCC4main7Target25Dummy was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x796733d0> (
<NSKeyValueObservance 0x796734b0: Observer: 0x79673200, Key path: name, Options: <New: NO, Old: NO, Prior: NO> Context: 0x0, Property: 0x796733b0>

@xedin
Copy link
Contributor

xedin commented Jan 31, 2019

@swift-ci please test macOS platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - be6dc7c

@theblixguy
Copy link
Collaborator Author

theblixguy commented Jan 31, 2019

macOS test still failing because of the same unrelated issue 🤔

@xedin
Copy link
Contributor

xedin commented Jan 31, 2019

@swift-ci please smoke test

@xedin
Copy link
Contributor

xedin commented Jan 31, 2019

maybe smoke test is going to pass...

@theblixguy
Copy link
Collaborator Author

@xedin smoke test has passed 🎉 😅

@xedin
Copy link
Contributor

xedin commented Jan 31, 2019

Looks like the test is failing because of #20103

@xedin xedin merged commit 6449e47 into swiftlang:master Jan 31, 2019
@theblixguy
Copy link
Collaborator Author

@xedin Ah ok! Since this PR fixed a regression, can this be cherry picked to the 5.0 branch?

@xedin
Copy link
Contributor

xedin commented Jan 31, 2019

@theblixguy Done - #22278

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants