Skip to content

[Diagnostics] Introduce extraneous call fix #27976

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
Oct 31, 2019

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Oct 30, 2019

Detect and diagnose attempts to call variables and/or properties
which don't have a function type, so can't really support
invocation.

@xedin xedin requested a review from hborla October 30, 2019 23:15
@xedin
Copy link
Contributor Author

xedin commented Oct 30, 2019

One of the last steps on the way to remove diagnoseGeneral*Failure from CSDiag.

@xedin
Copy link
Contributor Author

xedin commented Oct 30, 2019

@swift-ci please smoke test

// Let's make this fix as high impact so if there is a function or member
// overload with e.g. argument-to-parameter type mismatches it would take
// a higher priority.
return recordFix(fix, /*impact=*/10) ? SolutionKind::Error
Copy link
Member

Choose a reason for hiding this comment

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

Do you think we're developing the need for more a principled priority mechanism among fixes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that's something we need to think about for the long term, but logic involved there would be even more complicated than CSRanking, so I'm postponing that as much as possible. So far "weight" such as what impact really is seems to be doing the job well enough.

// Let's make this fix as high impact so if there is a function or member
// overload with e.g. argument-to-parameter type mismatches it would take
// a higher priority.
return recordFix(fix, /*impact=*/10) ? SolutionKind::Error
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't specific to this change or something that needs to be addressed now, but what do you think about making impact a method on ConstraintFix that subclasses could override as needed? I think it would make it easier to determine the relative importance of fixes by just scanning the CSFix header.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, didn't see @hborla's comment before posting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking about doing that as well, but some far most of the impact changes where contextual in nature. Although maybe that's a nice long-hanging fruit to tackle for clarity...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My hope is once we finish porting majority of diagnostics we would become more clear whether we can stick to weight or need something more comprehensive than that...

Detect and diagnose attempts to call variables and/or properties
which don't have a function type, so can't really support
invocation.
@xedin
Copy link
Contributor Author

xedin commented Oct 30, 2019

@swift-ci please smoke test

@xedin
Copy link
Contributor Author

xedin commented Oct 31, 2019

@swift-ci please smoke test Linux platform

@xedin
Copy link
Contributor Author

xedin commented Oct 31, 2019

Please test with following PR:
swiftlang/swift-package-manager#2393

@swift-ci please smoke test Linux platform

@xedin
Copy link
Contributor Author

xedin commented Oct 31, 2019

@swift-ci please test Linux platform

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.

3 participants