-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Nullable annotations for AvaloniaObject/AvaloniaProperty etc. #7078
Conversation
...to `AvaloniaObject`/`AvaloniaProperty`-related classes and a few other uncontroversial files.
@@ -279,14 +273,14 @@ public abstract class AvaloniaProperty : IEquatable<AvaloniaProperty>, IProperty | |||
/// <returns>A <see cref="AvaloniaProperty{TValue}"/></returns> | |||
public static AttachedProperty<TValue> RegisterAttached<TOwner, THost, TValue>( | |||
string name, | |||
TValue defaultValue = default(TValue), | |||
TValue defaultValue = default!, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This, and the other default!
expressions in this file isn't great. Problem is that default
is an invalid value if TValue
is not nullable and there's not really any way to fix this without breaking changes.
For 11.0 we probably need to supply separate class
and struct
property registration overloads and only provide a default value for the struct
overloads, but this would be a (pretty big) breaking change.
* Add nullable annotations... ...to `AvaloniaObject`/`AvaloniaProperty`-related classes and a few other uncontroversial files. * Check for null before first use. * Don't need this check as base class does it. # Conflicts: # src/Avalonia.Styling/Styling/Activators/PropertyEqualsActivator.cs # src/Avalonia.Styling/Styling/PropertyEqualsSelector.cs
What does the pull request do?
Adds nullable annotations to
AvaloniaObject
/AvaloniaProperty
-related classes and a few other uncontroversial files.