Translation: "You screwed up somewhere in this entire file. Figure it out yourself. Good luck! 🤷”

It's the "Segmentation fault” of the modern era.

i’m unable to type-check YOUR expression in reasonable time
(The actual problem, 67 lines below the error message: .disabled() needs to be applied to the Button, not the ToolbarItem, which I had to figure out by just commenting out random stuff until it compiled.)
Maybe some of these new "intelligences" can be used to make SwiftUI's error messages useful
@marcoarment AI can do a lot of things, but this may be an impossible task.
@marcoarment “Here's what I found on the web for ‘The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions’”
@marcoarment tbh why can’t apple intelligence be used to give better error messages? Can’t it suck in your code, whatever it can from the compiler and give a probabilistic idea of what’s going wrong?
@tomjacob @marcoarment Maybe, but it may get the answer wrong - would that help?
@spitfire @marcoarment perfect is the enemy of good, I agree.
@tomjacob @marcoarment I am using LLMs from time to time. Sometimes they help me do something, sometimes they lead me down some crazy path and waste my time by inventing stuff that does not exist and confidently giving me the wrong answer which ultimately wastes my time:/
@marcoarment I actually have had a surprising amount of success when these errors happen just copying the entire file into ChatGPT or CoPilot and asking it to find the error for me.
@marcoarment OK! Playing “She’s My Type” by Kurt Reston
@marcoarment I’d rather have useless messages than “confidently wrong” messages
@marcoarment Oof, you don’t want an LLM in your compiler.
@marcoarment If you just dropped the file with the error into Claude, does it detect the error? Having it diagnose an error automatically could quite possibly be great.
@marcoarment equally frustrating is when it can’t correct simple syntax errors in imperative code blocks inside a view builder. I’ve been bit by simple things like a missing colon in a switch statement.
@marcoarment I'm glad I'm not the only one who debugs that error this way 🤦‍♂️
@marcoarment sadly, that seems to be the only way to debug the error. I’ve had to do that too many times to count.
@marcoarment I feel randomly commenting out code helps a lot with SwiftUI ;)
@marcoarment this is all very much plausible and warranted for.
@marcoarment the hard lesson I’ve been learning from this (particularly with toolbar) is to put anything non-trivial into a separate computed property so Xcode can figure it out
@marcoarment For a simple API-typo issue like this, in an IDE like Cursor.sh in a language like Python or TypeScript, nowadays you would get an underline "fix this" that would indeed fix it (or maybe even a tab-complete suggestion to fix it)
Why Swift’s Type Checker Is So Slow

How a 10 year old design choice for Swift’s type checker still haunts us to this day