Skip to content
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

[SR-8740] I use Swift 4.2 & Xcode 10 GM, and got the error with below code: #51249

Closed
octree opened this issue Sep 13, 2018 · 8 comments
Closed

[SR-8740] I use Swift 4.2 & Xcode 10 GM, and got the error with below code: #51249

octree opened this issue Sep 13, 2018 · 8 comments

Comments

@octree
Copy link

@octree octree commented Sep 13, 2018

Previous ID SR-8740
Radar rdar://problem/44422139
Original Reporter @octree
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.2Regression, TypeChecker
Assignee @octree
Priority Medium

md5: 8af124a495901d0def2a35c0a8b017e8

Issue Description:

The error confused me.

can not convert type A to type A ?

my code works fine with Xcode 9

@belkadan
Copy link
Contributor

@belkadan belkadan commented Sep 13, 2018

Sounds like a bug, but I don't think we'll be able to help without seeing your project. If you're concerned about attaching it here, you can also send it just to Apple using https://bugreport.apple.com.

@octree
Copy link
Author

@octree octree commented Sep 13, 2018

I have uploaded a zip file containing some of the code in my project.

@belkadan
Copy link
Contributor

@belkadan belkadan commented Sep 13, 2018

Thanks! Reproduced, and still seems to occur on master.

@swift-ci create

@rudkx
Copy link
Member

@rudkx rudkx commented Sep 13, 2018

There's definitely something really strange going on here.

If I make delimiterItem a parameter of the appropriate type (Parser<Substring, ((TableDataAlignment) -> ([InlineNode]) -> BlockNode) -> ([InlineNode]) -> BlockNode>), I do not hit the error. If I use an explicit type on the local variable, I do still hit the error.

@rudkx
Copy link
Member

@rudkx rudkx commented Sep 14, 2018

I've attached a minimized reproducer.

The diagnostic here is not good, but I think the change in behavior here (of disallowing this) may be correct. I'll have to take a closer look to confirm.

The issue is that if the curry function is used in a context where U is a non-@escaping function type, we previously would allow that function to escape, but no longer do.

public func curry<T, U, V>(_ f: @escaping (T, U) -> V) -> (T) -> (U) -> V {
    return { x in { y in f(x, y) } }
}

@belkadan
Copy link
Contributor

@belkadan belkadan commented Sep 14, 2018

Ahh, so the diagnostics issue is SR-5184 about not printing @escaping when relevant. Good catch.

@xedin
Copy link
Member

@xedin xedin commented Apr 17, 2020

@octree Looks like we produce a much better message now in Xcode 11.4 which points to mismatch in result type of the `apply`:

error: cannot convert return expression of type '(Y, [(@escaping (W) -> ([X]) -> R) -> ([X]) -> R])' to return type '(Y, [((W) -> ([X]) -> R) -> ([X]) -> R])'
    return apply(
           ^

What do you think about that error message?

@xedin
Copy link
Member

@xedin xedin commented Oct 14, 2020

Since it's been a while I'm going to resolve this issue. Please feel free to re-open if the problem still persists.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants