Skip to content

Fix the fixit for specialized non-generic types #6944

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
Jan 20, 2017

Conversation

JaSpa
Copy link
Contributor

@JaSpa JaSpa commented Jan 20, 2017

If a non-generic type is specialized, a fixit is provided to remove the
generic arguments. The DiagnosticEngine turns a SourceRange into a
CharSourceRange by re-lexing the token at SourceRange::End.

The problem solved by this change occurs, if the non-generic type is
nested in an other generic type like this:

let a: GenericType<NongenericType<NongenericType>>

The lexer doesn't know that the closing angle brackets are individual
tokens leading to the removal of both of them. We can work around this
by directly specifying the start and end locations.

If a non-generic type is specialized a fixit is provided to remove the
generic arguments. The DiagnosticEngine turns a SourceRange into a
CharSourceRange by re-lexing the token at `SourceRange::End`.

The problem solved by this change occurs, if the non-generic type is
nested in an other generic type like this:

let a: GenericType<NongenericType<NongenericType>>

The lexer doesn't know that the closing angle brackets are individual
tokens leading to the removal of both of them. We can work around this
by directly specifying the start and end locations.
@CodaFi
Copy link
Contributor

CodaFi commented Jan 20, 2017

@swift-ci please smoke test.

@slavapestov slavapestov merged commit f154b6a into swiftlang:master Jan 20, 2017
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