Skip to content

Conversation

@nan01ab
Copy link
Contributor

@nan01ab nan01ab commented Jan 31, 2025

#3702 not works.

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@nan01ab nan01ab added the Easy-to-Review a simple edit; just a few lines label Jan 31, 2025
#if NET5_0_OR_GREATER
[return: NotNullIfNotNull(nameof(factory))]
#endif
public StorageItem? GetAndChange(StorageKey key, Func<StorageItem>? factory = null)
Copy link
Member

Choose a reason for hiding this comment

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

factory variable can be still be null

Take for example

var nullValue = GetAndChange(key, () => null);

Copy link
Contributor Author

@nan01ab nan01ab Jan 31, 2025

Choose a reason for hiding this comment

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

factory variable can be still be null

Take for example

var nullValue = GetAndChange(key, () => null);

The factory definition is Func<StorageItem>
StorageItem, not StorageItem?

Copy link
Member

@cschuchardt88 cschuchardt88 Jan 31, 2025

Choose a reason for hiding this comment

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

neo is not a nullable project. So it can still be null.

Copy link
Contributor Author

@nan01ab nan01ab Jan 31, 2025

Choose a reason for hiding this comment

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

Copy link
Member

@cschuchardt88 cschuchardt88 Jan 31, 2025

Choose a reason for hiding this comment

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

That doesnt matter. If the project importing the library isnt nullable it doesnt care. nullable is only for the analyzers for the IDE to not have red line under variable.

with no nullable enabled
image

with nullable enabled
image

Copy link
Member

Choose a reason for hiding this comment

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

They just need to enable nullable in devpack

@shargon shargon merged commit 84a9fd5 into neo-project:master Jan 31, 2025
7 checks passed
@nan01ab nan01ab deleted the fix.return-NotNullIfNotNull branch February 5, 2025 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Easy-to-Review a simple edit; just a few lines Ready to Merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants