Add diagnostics for mismatched argument type and count#335
Open
out-of-phaze wants to merge 1 commit intoSpaceManiac:masterfrom
Open
Add diagnostics for mismatched argument type and count#335out-of-phaze wants to merge 1 commit intoSpaceManiac:masterfrom
out-of-phaze wants to merge 1 commit intoSpaceManiac:masterfrom
Conversation
ZeWaka
reviewed
Aug 23, 2022
| objtree.root().recurse(&mut |ty| { | ||
| for proc in ty.iter_self_procs() { | ||
| analyzer.check_kwargs(proc); | ||
| analyzer.check_arg_type(proc);//count(proc); |
Contributor
There was a problem hiding this comment.
Suggested change
| analyzer.check_arg_type(proc);//count(proc); | |
| analyzer.check_arg_type(proc); |
;)
Contributor
Author
There was a problem hiding this comment.
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 */ |
Contributor
There was a problem hiding this comment.
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 */ |
Contributor
Author
There was a problem hiding this comment.
Only the is_root needs to be removed when #334 is solved. The varargs check is fine.
Contributor
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.