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 diagnostics for mismatched argument type and count #335

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

Conversation

out-of-phaze
Copy link
Contributor

@out-of-phaze out-of-phaze commented Aug 23, 2022

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.

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
analyzer.check_arg_type(proc);//count(proc);
analyzer.check_arg_type(proc);

;)

Copy link
Contributor Author

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 */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line length

Suggested change
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 */

Copy link
Contributor Author

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.

Copy link
Contributor

@ZeWaka ZeWaka Aug 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

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

Successfully merging this pull request may close these issues.

None yet

2 participants