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-13970] return( nil ) <- Fails : Succeeds -> return nil #56217

Closed
swift-ci opened this issue Nov 3, 2020 · 6 comments
Closed

[SR-13970] return( nil ) <- Fails : Succeeds -> return nil #56217

swift-ci opened this issue Nov 3, 2020 · 6 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. parser Area → compiler: The legacy C++ parser

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Nov 3, 2020

Previous ID SR-13970
Radar None
Original Reporter antony.newman (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

Mac Pro

Xcode 12.0

MacOs 10.15.7

Swift : All Versions

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug, Parser
Assignee antony.newman (JIRA)
Priority Medium

md5: 81ae772acc3ce5634cf3e42c95da0da7

Issue Description:

All swift routines that returned optionals used to be able to return(nil).
This is a now a compiler error : 'nil' requires a contextual type
This requires that all code has to be modified to remote parentheses around 'nil'.

I am presuming this is a bug.

func TEST1() -> Int?
{
return( nil ) // Fails to compile with : 'nil' requires a contextual type
}

func TEST2() -> Int?
{
return nil // Will Compile
}

@typesanitizer
Copy link

Hi! This bug report isn't Swift for Tensorflow specific, so it would be more appropriate to file it under "Swift" and not "Swift for Tensorflow". That said, this seems to be fixed on the main branch; you can double-check this by downloading a recent toolchain snapshot from https://swift.org/download/#snapshots .

@swift-ci
Copy link
Collaborator Author

swift-ci commented Nov 3, 2020

Comment by ANTONY NEWMAN (JIRA)

Thanks Varun - Sorry for posting this in the wrong place.

(I'm a relative newbie to raising bugs here / and had not seen a similar error message reported here).

I may also shy away from downloaded at toolchain at the present time.

/Antony

@typesanitizer
Copy link

Sure, it's not a big deal. Just something to keep in mind for your next bug report. 🙂

@LucianoPAlmeida
Copy link
Collaborator

This was resolved by #34046
antony.newman (JIRA User) can you please verify it and close? Since it made it to 5.3 I think this could be on the lastest Xcode release =]

cc @xedin

@swift-ci
Copy link
Collaborator Author

Comment by ANTONY NEWMAN (JIRA)

Thankyou all - your fix works perfectly.

I will now close this issue.

@swift-ci
Copy link
Collaborator Author

Comment by ANTONY NEWMAN (JIRA)

Tested : I can confirm that the fix resolved the issue.

Antony.

@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
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

3 participants