Skip to content

[Diagnostics] Allow column specification in verify mode #26997

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 2 commits into from
Sep 3, 2019

Conversation

owenv
Copy link
Contributor

@owenv owenv commented Sep 3, 2019

For example, expected-warning@-2:2 looks for the warning 2 lines above at the second column, and expected-warning@:4 looks at the fourth column of the current line.

Column indexing, especially compared to fix-its, can be a bit confusing, but it matches printed diagnostic output.

There are probably at least a few other tests that can be migrated off FileCheck now, but I haven't found a good way to discover them yet.

Resolves (SR-11320)[https://bugs.swift.org/browse/SR-11320]

To check the column a diagnostic is emitted at, use
expected-error@+x:y, or expected-error@:y to specify
a column without a line offset
llvm::SMFixIt fixIt(llvm::SMRange{StartLoc, EndLoc}, I->getMessage());
addError(expected.MessageRange.begin(), "incorrect message found", fixIt);
} else {
// The difference must be only in the column
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this something we can assert?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, good idea! I made this an if-elseif and made the last branch unreachable

@owenv owenv force-pushed the column_verification branch from 25c74ab to 0a239d5 Compare September 3, 2019 18:10
@jrose-apple jrose-apple self-assigned this Sep 3, 2019
@jrose-apple
Copy link
Contributor

@swift-ci smoke test

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