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

Enable nullable reference types #190

Open
sbergen opened this issue May 1, 2022 · 1 comment
Open

Enable nullable reference types #190

sbergen opened this issue May 1, 2022 · 1 comment

Comments

@sbergen
Copy link
Owner

sbergen commented May 1, 2022

It would be nice to enable nullable reference types, especially since most of the internals of Responsible use very few nullable values. However, there are some technical issues and non-trivial changes to solve.

Technical issues:

  • Unity doesn't have an official way to enable nullability in a package, so we'd need to put #nullable enable everywhere.
  • Unity 2019 doesn't support C# 8, so support would need to be dropped
  • Unity 2020 doesn't support C# 9, which might make generics handling a bit more complicated, but this might not be an issue.
  • The NUnit FixtureLifeCycleAttribute is not available in any Unity Test Framework version released to date (2.0.1-pre18), which means that everything assigned in a SetUp or OneTimeSetUp test would need to be initialized with = null!.

Non-trivial changes:

  • IOptionalTestResponder currently uses "type erasure" using object and instruction boxing internally. It's not immediately clear to me how this should be handled if some instructions use nullable types as the responder results.
  • BoxResult shares some internal code with optional responders, making things a bit more complicated. It might make sense to just separate the public functionality from the internal functionality, once/while we solve what to do with optional responders.
@sbergen
Copy link
Owner Author

sbergen commented Jul 7, 2023

Update on technical issues:

  • Adding -nullable:enable to csc.rsp works for enabling NRT in an assembly in Unity
  • We no longer support Unity 2019 or 2020
  • Still no FixtureLifeCycleAttribute

No updates for the non-trivial changes.

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

No branches or pull requests

1 participant