Skip to content
This repository has been archived by the owner on Jul 22, 2023. It is now read-only.

Add detailed error for swapping two arguments #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kampfkarren
Copy link
Member

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

@LPGhatguy
Copy link
Contributor

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
Copy link
Member Author

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

@Kampfkarren
Copy link
Member Author

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

@Kampfkarren
Copy link
Member Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants