Translation: "You screwed up somewhere in this entire file. Figure it out yourself. Good luck! 🤷”
It's the "Segmentation fault” of the modern era.

Translation: "You screwed up somewhere in this entire file. Figure it out yourself. Good luck! 🤷”
It's the "Segmentation fault” of the modern era.

@marcoarment Oh cool, now I get to comment out portions of my code bit by bit until the error goes away, and hopefully that actually narrows down the cause of the problem.
SwiftUI continues to be fun and infuriating in seemingly equal measure.
(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 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 “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 I feel randomly commenting out code helps a lot with SwiftUI ;)
@marcoarment Not just “this file.” I lost a day to a missing optional symbol (typo) in a model file that showed up as this error on the app’s main view.
@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?
@marcoarment Not even that. Also happens with complex but correct code ¯\_(ツ)_/¯
@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 does this mean it’s @siracusa’s turn tomorrow
@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)
@marcoarment I’d rather have useless messages than “confidently wrong” messages
@marcoarment Definitely annoying. Our team found that we can defend against this by breaking up Views into smaller pieces. We end up with code that is better organized and more readable too.
@marcoarment
compilers trying to type check it in a reasonable time: <10 seconds
Humans trying to type check it mentally it in a reasonable time: <30 minutes
@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.
@meaningful_jan @marcoarment or put a comma after something where you’re supposed to leave it out
@marcoarment i’ve gotten to the point with my project where I’m really hesitant to make too many changes without checking them in because I worry that I’ll hit this error and have no idea what caused it in all the changes I made.
@marcoarment this blog explains the problem well. https://danielchasehooper.com/posts/why-swift-is-slow/
@caseyliss @marcoarment @siracusa Will someone please complain about this so that I don't feel so alone.

@marcoarment If one invokes a method from say, a button and add/remove/modify a parameter from that method you’ll also be greeted with this nonsense. I never understood why it’s so difficult to get a “yo, a parameter is missing right here”. No one is curious enough to fix this?
@marcoarment not only we designed a language that has a really hard time inferring all the types, but we decided to write code in the hardest possible way for the compiler to figure out.
And then we added function builders to make it harder to actually break the expression into subexpressions 🤷🏻♂️