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

Parse Swift operators as link components for operators with symbol diacritics #1125

Merged
merged 5 commits into from
Dec 12, 2024

Conversation

d-ronnqvist
Copy link
Contributor

@d-ronnqvist d-ronnqvist commented Dec 10, 2024

Bug/issue #, if applicable:

Summary

This fixes a very rare and unlikely bug where a Swift operator that contains both a symbol with a diacritic and a forward slash wouldn't parse as a symbol link correctly.

Dependencies

None.

Testing

Define a custom ☜⃩/ infix operator and link to it using ☜⃩/(_:_:). The link should resolve.

infix operator ☜⃩/ : DefaultPrecedence

/// This link should resolve ``☜⃩/(_:_:)``
public struct Something {
    public static func ☜⃩/ (lhs: Self, rhs: Self) -> Bool { 
        false
    }
}

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary Not applicable.

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist changed the title Parse Swift operators as link components slightly more strictly Parse Swift operators as link components for operators with symbol diacritics Dec 10, 2024
Copy link
Contributor

@patshaughnessy patshaughnessy left a comment

Choose a reason for hiding this comment

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

The code changes look good, and also the new table of unicode values inside of isValidSwiftOperatorCharacter.

But can you review the existing unicode values mentioned inside of isValidSwiftOperatorHead? The list looks different than what I see in the Operators discussion on docs.swift.org.

For example, docs.swift.org mentions:

operator-head → U+2190–U+23FF

...but I don't see those values in your existing code. Maybe we just need to update the code based on changes to Swift or the Swift docs?

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist dismissed patshaughnessy’s stale review December 12, 2024 12:32

This feedback has been addressed in ea05a92

@d-ronnqvist d-ronnqvist merged commit 4b12c49 into swiftlang:main Dec 12, 2024
2 checks passed
@d-ronnqvist d-ronnqvist deleted the more-strict-operator-parsing branch December 12, 2024 20:16
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