tera
January 28, 2026, 11:15pm
21
I bet the ultimate reason is CGFloat being a separate type and all the sleight of hand needed for it to co-play with doubles.
func test(angle: Angle) {
let a: CGFloat = 0
CGPoint(x: a + cos(angle.radians), y: a + cos(angle.radians))
// Ambiguous use of 'cos'
}
Change the above a little bit one way or another – and it compiles fine.
Hacksaw
January 28, 2026, 11:41pm
23
I feel like there’s a lot of little gotchas waiting for someone to find the right combo of stuff, what with all the various wrappers, call backs to Obj-C, funky protocol shenanigans…
That it works as well as it does says something positive about the people involved.
Could you post the reports on Open Feedback Assistant?
Open collection of Apple Feedback Assistant reports
1 Like
Hacksaw:
Trying to produce one, but now compilation is crashing.
Here’s the code that is freaking it out:
import SwiftUI
struct TestView: View {
@State var angle: Angle = Angle(radians: Double.pi/1.5)
let size = CGSize(width: 800, height: 600)
var body: some View {
Path { path in
path.move(to: CGPoint(x: size.width/cos(angle.radians) , y: size.height/cos(angle.radians)))
path.addLine(to: CGPoint(x: 100, y: 100))
}.stroke(Color.red)
}
}
#Preview {
TestView()
}
For what it's worth, I can reproduce a crash with 6.2, but it no longer crashes for me with the latest 6.3 snapshot, or a compiler I built myself from main.
Thank you for your contribution to the test suite ;-) Sema: Add regression test for fixed crasher by slavapestov · Pull Request #86864 · swiftlang/swift · GitHub
5 Likes
Hacksaw
January 29, 2026, 12:21am
26
File type .swift not supported? Really?
Hacksaw
January 29, 2026, 4:34pm
28
The saga gets weirder:
In trying to narrow down the problem, I decided to remove a style configuration.
In the example I sent to Apple, there is this code:
//Cosecant Line indicator
Path { path in
path.move(to: pt(qdt.qx * -20, 0))
// DIV BY ZERO
path.addLine(to: pt(qdt.qx * -20, qdt.qy * sH/cos(angle.radians)))
}
.stroke(Color.orange, style: dashStyle)
.transformEffect(.init(1, 0, 0, -1, ctr.x, ctr.y))
I removed the “style: dashStyle” part of the stroke call, and suddenly it works.
Or if I put that back, and change the starting angle to be something other than tau*3.0/4.0 or tau/4.0, no crash.
See FB21792467: Kill The Window Server with MATH · Issue #761 · feedback-assistant/reports · GitHub for the full example.
ksluder
(Kyle Sluder)
January 29, 2026, 4:58pm
29
Thanks for the additional investigation. I’ve made sure the WindowServer team is aware of your report.
4 Likes