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

opt_type_constraint_case getting stuck #2

Closed
jrmbchtl opened this issue Jan 10, 2022 · 4 comments
Closed

opt_type_constraint_case getting stuck #2

jrmbchtl opened this issue Jan 10, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@jrmbchtl
Copy link

the function opt_type_constraint_case(ast) is getting stuck at "Fix typename case from 'string' to 'String'"
It looks like the Element isn't getting replaced properly

@thewhiteninja
Copy link
Owner

Do you have a sample?

@thewhiteninja thewhiteninja added the bug Something isn't working label Mar 2, 2022
@thewhiteninja thewhiteninja self-assigned this Mar 2, 2022
@joeavanzato
Copy link

joeavanzato commented Feb 17, 2023

Here is a sample - I am having the same issue.

I have taken your code and basically merged certain sections with my own - I am first converting .ps1 into raw AST, then calling optimizer in same way as yourself - I am getting infinite messages like below;

'[02-17-2023 11:52:51] [DEBUG] Fix typename case from 'string' to 'String''

This happens on a few files and I'm not sure why but it is getting stuck in a loop - I am trying to debug as well.

@thewhiteninja
Copy link
Owner

There was a problem with opt_type_constraint_case which change string to String and opt_type_constraint_from_convert which replace the type of TypeConstraintAst nodes with the static type of ConvertExpressionAst, in this case String to string.

fixed with 67e713c

@joeavanzato
Copy link

joeavanzato commented Feb 17, 2023

You are a boss - really, fixing a bug within 4 hours of having a sample is amazing (especially since this was opened a year ago lol), props to you!

I am using your tool in a combined ML workflow to analyze suspicious PowerShell files with both text classification and DNN learning - thank you very much for such an interesting approach to AST simplification/analysis.

(I confirmed that your patch mitigates the issue I was experiencing and this bug can probably be closed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants