Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

XMLNodeType declares ~= infix operator with wrong precedence #119

Open
1 task
sepw opened this issue Mar 17, 2022 · 0 comments
Open
1 task

XMLNodeType declares ~= infix operator with wrong precedence #119

sepw opened this issue Mar 17, 2022 · 0 comments

Comments

@sepw
Copy link

sepw commented Mar 17, 2022

Description:

  • Expected behaviour:

The ~= infix operator declaration should use the same precedence (ComparisonPrecedence) as Swift's built-in operator.

  • Actual behaviour:

Node.swift defines the ~= infix operator as follows:

infix operator ~=

This causes the operator to have DefaultPrecedence resulting in the following build error whenever the ~= operator is used with other types in a Swift file that imports Fuzi:

Ambiguous operator declarations found for operator

This can be resolved by re-defining the ~= operator as follows at the point of use:

infix operator ~= : ComparisonPrecedence

However this should not be necessary.

Suggested Solution

Change the operator definition in Node.swift to:

infix operator ~= : ComparisonPrecedence

Environment

  • Package Manager:

    • SPM, version 5.5
  • Fuzi version: 3.1.3

  • Xcode version: 13.2.1

How to reproduce:

  1. Open the attached project
  2. Build
  3. Xcode will emit a build error
  4. Comment out operator definition in Sources/FuziTest/FuziTest.swift to fix error.

FuziTest.zip

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant