Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RawType property to FunctionParameter type #687

Open
suaviloquence opened this issue Dec 23, 2024 · 3 comments
Open

Add RawType property to FunctionParameter type #687

suaviloquence opened this issue Dec 23, 2024 · 3 comments

Comments

@suaviloquence
Copy link
Contributor

I think in order to write correct witness functions in c-s-c we need to be able query the function signature more granularly than just the signature property. Adding the ability to query the type of each parameter, in addition to the already-existing GenericParameter property, should be enough to do this (but I'm not 100% sure). I can implement this, just opening an issue to make sure this is the right direction to go in.

@obi1kenobi
Copy link
Owner

obi1kenobi commented Dec 23, 2024 via email

@suaviloquence
Copy link
Contributor Author

Current problem: we need to construct a witness function header (e.g., for function_missing, it needs to take parameters that have the same arguments/generics/generic bounds as the removed function). We can use signature, but it's kind of hacky, as the name of the removed function is hardcoded in the function signature, so we would have to print out a function like:

fn removed_function<'a, T>(x: &'a t, y: Cow<'static, str>) -> T::Item
where T: 'a + Iterator
{
    path::to::removed_function(x, y)
} 

which works, but may be confusing (the name of the witness function is the same as the removed function, and the return value is not technically necessary for a minimized withess?) -- another idea is to allow specifying a function name with signature, maybe?

Future problems: writing witnesses for functions that change arity/parameter types?

I was also under the assumption that RawType would eventually become (or be superseded by) a Type class that has the stringified name but also supports other queries (equality, satisfies trait bound, etc. - but this is for the future)

@obi1kenobi
Copy link
Owner

All sounds good to me, go for it! Also, if you have opinions or ideas on how to design a better Type vertex type, I'd love to chat about that sometime :)

I'd be very curious to see what the witness query and template would look like for function arity change / parameter type change lints! I wonder if we might run into more issues there.

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

No branches or pull requests

2 participants