swift-syntax icon indicating copy to clipboard operation
swift-syntax copied to clipboard

Provide a public API to compare precedence groups

Open allevato opened this issue 2 years ago • 3 comments

Description

I had a small use case in swift-format where I wanted to check the precedence of an operator relative to another one (https://github.com/apple/swift-format/pull/647).

Unfortunately there's no public API to do this from OperatorTable; the logic is inside PrecedenceGraph, which is internal. Can we have this API or something like it in public form?

allevato avatar Oct 03 '23 19:10 allevato

Tracked in Apple’s issue tracker as rdar://116416740

ahoppen avatar Oct 03 '23 20:10 ahoppen

I wouldn’t be opposed to adding a public function to perform this comparison on OperatorTable.

ahoppen avatar Oct 04 '23 17:10 ahoppen

Thanks! It's not an urgent need but I'll tinker with it and put up a PR.

allevato avatar Oct 05 '23 14:10 allevato