Hacker News new | ask | show | jobs
by stirner 2433 days ago
I’ve noticed that when editing the ContentView in SwiftUI, errors will sometimes be attached to a totally unrelated line (OTOH, forgetting to unwrap an optional returned by NumberFormatter.string() showed

    type of expression is ambiguous without more context
on a straightforward Text() expression halfway up the file). The only way to find the actual source of the error is to undo every change until the error disappears, and coupled with sluggish compilation times this becomes a real pain. I hope they address this issue as part of their improvements.
1 comments

This is literally given as an example in the article. No hope required.
Oh wow, you’re right, at the very top. Skimmed right over that. Thanks for pointing it out.

I guess SwiftUI exacerbates the problem since expressions are necessarily very deeply nested.

The last example in the SwiftUI section is also an “ambiguous type expression” example with a fairly complex nested view.

It seems to be a problematic diagnostic they have particularly focused on resolving.