rojo-rbx / remodel

Scriptable Roblox multitool: Manipulate instances, model files, places, and assets on Roblox.com
MIT License
169 stars 38 forks source link

Add detailed error for swapping two arguments #85

Open Kampfkarren opened 2 years ago

Kampfkarren commented 2 years ago

This supports the recent breaking change to swap filename and path by giving a clear error on how to fix it.

LPGhatguy commented 2 years ago

I like having diagnostics that are this good. However, this feels like kind of a lot of code to cover just a couple APIs. Is there anything we can do to make all of our APIs report better errors when there's a type mismatch?

In theory, it feels like we should be able to know the type of the parameters to functions. If there's some way that we can leverage that information to make every API have a good type mismatch error, it feels like that'd be a big win.

Kampfkarren commented 2 years ago

It might be straight forward to have this for <T, U>, but anything larger than that sounds unwieldy. I can do that though.

Kampfkarren commented 2 years ago

It would also prevent being able to write "filename" rather than just type_name() (string), at least without more ceremony.

Kampfkarren commented 2 years ago

Hmm, it doesn't even let me write out "string" for stuff like f(x) (where you forgot to add y). Do you see any way around that? Only way I can think of is some more complicated code like a trait that would require setting up a custom struct anyway.