Skip to content

[QoI] improve diagnostics for contextual members with argument mismatch #4540

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
Sep 6, 2016

Conversation

jtbandes
Copy link
Contributor

@jtbandes jtbandes commented Aug 28, 2016

Improves the quality of diagnostics when a contextual member is used with the wrong number of arguments — specifically, when the expected/actual argument types are none and Void.

Also replaces "contextual member" with just "member" in the diagnostics, because "contextual member" isn't a phrase most Swift programmers will be familiar with.

Before

error: contextual member 'black' has no associated value
let color: NSColor = .black()
                      ^

error: contextual member 'general' expects argument of type '()'
let pb: NSPasteboard = .general
                        ^

After

error: member 'black' is not a function
let color: NSColor = .black()
                      ^    ~~

error: member 'general' is a function; did you mean to call it?
let pb: NSPasteboard = .general
                        ^
                               ()

@jtbandes jtbandes force-pushed the qoi-contextual-member branch from c437fd9 to bc3a7d1 Compare August 28, 2016 22:59
@jtbandes jtbandes assigned jtbandes and DougGregor and unassigned jtbandes Sep 2, 2016
@jtbandes
Copy link
Contributor Author

jtbandes commented Sep 2, 2016

I think @DougGregor is the right person to review this.

@DougGregor
Copy link
Member

Looks great, thanks!

@DougGregor DougGregor merged commit db5f8c3 into swiftlang:master Sep 6, 2016
@jtbandes jtbandes deleted the qoi-contextual-member branch September 6, 2016 15:52
aaditya-chandrasekhar pushed a commit to val-verde/swift that referenced this pull request Sep 30, 2022
[pull] swiftwasm-release/5.7 from release/5.7
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.

2 participants