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-7044] Possible incorrect ordering of arguments in CSApply.cpp #49592

Open
alblue opened this issue Feb 20, 2018 · 4 comments
Open

[SR-7044] Possible incorrect ordering of arguments in CSApply.cpp #49592

alblue opened this issue Feb 20, 2018 · 4 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@alblue
Copy link
Contributor

alblue commented Feb 20, 2018

Previous ID SR-7044
Radar None
Original Reporter @alblue
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, TypeChecker
Assignee @nkcsgexi
Priority Medium

md5: 13238fec5380e13855245c65d819d174

Issue Description:

In

swift/lib/Sema/CSApply.cpp

Lines 4869 to 4870 in d8d7edf

shouldApplyAddingLabelFixit(TuplePattern *tuplePattern, TupleType *fromTuple,
TupleType *toTuple,

the function is defined as:

shouldApplyAddingLabelFixit(TuplePattern *tuplePattern, TupleType *fromTuple,
TupleType *toTuple,

However, when it is called later on in

swift/lib/Sema/CSApply.cpp

Lines 5124 to 5125 in d8d7edf

if (tupleP && shouldApplyAddingLabelFixit(tupleP, toTuple, fromTuple,
locInsertPairs)) {

the argument to 'fromTuple' and 'toTuple' appear to be the wrong way around:

if (tupleP && shouldApplyAddingLabelFixit(tupleP, toTuple, fromTuple,
locInsertPairs)) {

It's not clear if this is a real bug that needs to be fixed, or merely an incorrect variable name.

@alblue
Copy link
Contributor Author

alblue commented Feb 20, 2018

Xi, you added this code in 0b50648263c - can you advise to the right course of action?

@belkadan
Copy link
Contributor

cc @xedin too

@xedin
Copy link
Member

xedin commented Feb 21, 2018

It seems like an oversight with the consequence that it's going to suggest inserting labels incorrectly...

@xedin
Copy link
Member

xedin commented Feb 21, 2018

Makes we wonder though, why do we even produce a solution if it's not going to be expressible in the AST? It seems like this should be removed and logic should go into solver to prevent forming solutions with tuple conversions which can't be expressed...

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants