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

Handle not-nullable parameters in Kotlin constructors correctly #1336 #1352

Merged

Conversation

volivan239
Copy link
Collaborator

Description

If constructor in Kotlin code has not-nullable reference parameter, compiler adds instructions calling kotlin/jvm/internal/Intrinsics.checkNotNullParameter. But in constructor analyzer we accept constructors iff they "contain only statements matching pattern this.a = something where a is an argument of the constructor". Therefore, we need to add exception for calls to the function above. Also, these calls may reorder local variables, so minor changes in indexToField were needed

Fixes #1336

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Manual Scenario

Checked on example from #1336 -- works as expected (but only when settings are Fuzzer 100%, engine creates only tests where parameter is null, which do not pass concrete executor -- see #1257)

Checklist (remove irrelevant options):

This is the author self-check list

  • The change followed the style guidelines of the UTBot project
  • Self-review of the code is passed
  • The change contains enough commentaries, particularly in hard-to-understand areas
  • New documentation is provided or existed one is altered
  • No new warnings
  • New tests have been added
  • All tests pass locally with my changes

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@volivan239 volivan239 changed the title Handle not-nullable parameters in Kotlin constructors correctly Handle not-nullable parameters in Kotlin constructors correctly #1336 Nov 11, 2022
@volivan239 volivan239 marked this pull request as ready for review November 11, 2022 09:02
@volivan239 volivan239 merged commit 30499ad into main Nov 15, 2022
@volivan239 volivan239 deleted the volivan239/fix_not_nullable_parameters_in_constructors branch November 15, 2022 12:09
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.

AssembleModel unable to analyze Kotlin constructors with not nullable reference parameters
2 participants