-
Notifications
You must be signed in to change notification settings - Fork 83
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 diagnostics for mismatched argument type and count #335
base: master
Are you sure you want to change the base?
Add diagnostics for mismatched argument type and count #335
Conversation
@@ -354,11 +354,13 @@ fn run_inner(context: &Context, objtree: &ObjectTree, cli: bool) { | |||
objtree.root().recurse(&mut |ty| { | |||
for proc in ty.iter_self_procs() { | |||
analyzer.check_kwargs(proc); | |||
analyzer.check_arg_type(proc);//count(proc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
analyzer.check_arg_type(proc);//count(proc); | |
analyzer.check_arg_type(proc); |
;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops. yeah I can probably remove the check_arg_count method entirely since I replaced it with check_arg_type, and I can rename it to check_args
} | ||
if let Some(parent) = proc.parent_proc() | ||
{ | ||
if parent.is_varargs() /* remove this later, it's a hack for objtree proc parents including root */ || parent.ty().get().is_root() /* seriously remove it */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line length
if parent.is_varargs() /* remove this later, it's a hack for objtree proc parents including root */ || parent.ty().get().is_root() /* seriously remove it */ | |
/* remove this later, it's a hack for objtree proc parents including root */ | |
if parent.is_varargs() || parent.ty().get().is_root() | |
/* seriously remove it */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the is_root needs to be removed when #334 is solved. The varargs check is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if parent.is_varargs() /* remove this later, it's a hack for objtree proc parents including root */ || parent.ty().get().is_root() /* seriously remove it */ | |
if parent.is_varargs() | |
/* remove this later, it's a hack for objtree proc parents including root */ | |
|| parent.ty().get().is_root() | |
/* seriously remove it */ |
this then, or just say that - it's wrong to have incredibly long lines with functionality hidden
I don't know what I'm doiiiing!
A hacky first attempt at adding two diagnostics:
override_changed_type
: Raised for procs whose non-keyword arguments don't match (subtype/supertype) the argument with the same index on the parent.override_fewer_arguments
: Raised for procs which have fewer non-keyword arguments than their parent. This is mainly useful for ensuring the langserver passes the arguments to later types, but can sometimes reveal issues linked with parent calls that manually specify arguments. (If I could have it report those, that'd be a dream.)Also, it has a hacky override to get around #334.