Skip to content

Reorder cases to avoid skipping#1022

Draft
elharo wants to merge 1 commit intomasterfrom
dep
Draft

Reorder cases to avoid skipping#1022
elharo wants to merge 1 commit intomasterfrom
dep

Conversation

@elharo
Copy link
Contributor

@elharo elharo commented Jan 27, 2026

No description provided.

@elharo elharo requested a review from slachiewicz January 27, 2026 13:04
warning = null;
return true;
} else if (expected < 1) {
} else if (expected == 0) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might still be wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

We just need to replace if (expected < 1) by if (expected < 0). This is the only correction needed (no need to change order or add another if condition).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The original code looks like this:

        } else if (expected < 1) {
            if (checker instanceof ForkedCompiler) {
                return true; // That implementation actually knows nothing about which options are supported.
            }
            warning = "The '" + option + "' option is not supported.";
        } else if (expected == 0) {
            warning = "The '" + option + "' option does not expect any argument.";
        } 

So if expected == 0 do we still need to check if checker instanceof ForkedCompiler?

Copy link
Contributor

Choose a reason for hiding this comment

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

So if expected == 0 do we still need to check if checker instanceof ForkedCompiler?

No, ForkedCompiler unconditionally returns -1 because it has no information about which options are supported by external tool.

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