Skip to content

fix(ui): resolve 'ambiguous use of cos' build failure under Swift 6.2 / latest Xcode - #69

Merged
sp80808 merged 1 commit into
sp80808:mainfrom
wiradifit:fix/ambiguous-cos-xcode62
Oct 13, 2026
Merged

sp80808 merged 1 commit into
sp80808:mainfrom
wiradifit:fix/ambiguous-cos-xcode62

Conversation

@wiradifit

@wiradifit wiradifit commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

main currently fails to compile with latest-stable Xcode (Swift 6.2):

Sources/XPadUI/HarmonicWheelView.swift:201:41: error: ambiguous use of 'cos'
Sources/XPadUI/HarmonicWheelView.swift:202:? : error: ambiguous use of 'sin'

Swift 6.2 tightened overload resolution; cos(CGFloat(angle)) now matches multiple Foundation/Darwin declarations.

Fix

Pin both trig calls to the unambiguous Double overload and convert back:

let tx = center.x + CGFloat(cos(angle as Double)) * trailRadius
let ty = center.y - CGFloat(sin(angle as Double)) * trailRadius

Math is unchanged (angle is already numeric).

Verification

Built on macOS 15 / Xcode latest-stable via a clean CI run (public workflow run):

  • With this patch applied, swift build reports zero errors in Sources/.
  • The only remaining package error is unrelated pre-existing test-code isolation (Tests/XPadPracticeTests.swift:118), filed separately so this PR stays minimal.

Happy to adjust if you'd prefer Foundation.cos qualification or a different resolution style.

Summary by Sourcery

Bug Fixes:

  • Resolve Swift 6.2/Xcode build failures caused by ambiguous trigonometric overloads in the harmonic wheel view.

HarmonicWheelView.swift:201-202 fails to compile with latest-stable Xcode
('ambiguous use of cos'). Pin the trig calls to the unambiguous Double
overload and wrap back to CGFloat; math unchanged.
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@sourcery-ai

sourcery-ai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the harmonic wheel’s trail-dot coordinate calculations to explicitly use Double-based cos/sin overloads, resolving the latest Xcode/Swift 6.2 build failure without changing the math or visual behavior. Verification confirms zero errors in Sources/; an unrelated pre-existing test isolation error remains.

File-Level Changes

Change Details Files
Disambiguate harmonic-wheel trigonometric calculations for Swift 6.2 while preserving the existing geometry.
  • Pass the angle to the Double overloads of cos and sin.
  • Convert the results back to CGFloat before applying trail-radius positioning.
Sources/XPadUI/HarmonicWheelView.swift

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@sp80808
sp80808 merged commit f5d3531 into sp80808:main Oct 13, 2026
2 checks passed
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