Open Kampfkarren opened 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.
It might be straight forward to have this for <T, U>, but anything larger than that sounds unwieldy. I can do that though.
It would also prevent being able to write "filename" rather than just type_name()
(string), at least without more ceremony.
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.
This supports the recent breaking change to swap filename and path by giving a clear error on how to fix it.