-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from wieslawsoltes/FixTypeConstrains
Fix type constrains
- Loading branch information
Showing
10 changed files
with
727 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 169 additions & 0 deletions
169
ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.AllPossibleConstraints.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
{ | ||
Sources: [ | ||
{ | ||
FileName: ConstraintsTest.INPC.g.cs, | ||
Source: | ||
// <auto-generated/> | ||
#nullable enable | ||
|
||
using System.ComponentModel; | ||
using System.Runtime.CompilerServices; | ||
|
||
public partial class ConstraintsTest<T1, T2, T3, T4, T5, T6, T7> : INotifyPropertyChanged where T1 : class, global::ITestInterface, new() where T2 : struct, IComparable<T2> where T3 : notnull where T4 : unmanaged, struct where T5 : global::BaseClass where T6 : T1 where T7 : class? | ||
{ | ||
public event PropertyChangedEventHandler? PropertyChanged; | ||
|
||
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) | ||
{ | ||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); | ||
} | ||
|
||
protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) | ||
{ | ||
PropertyChanged?.Invoke(this, args); | ||
} | ||
} | ||
|
||
}, | ||
{ | ||
FileName: ConstraintsTest.ReactiveProperties.g.cs, | ||
Source: | ||
// <auto-generated/> | ||
#nullable enable | ||
|
||
using System.ComponentModel; | ||
using System.Runtime.CompilerServices; | ||
|
||
/// <summary> | ||
/// A partial class implementation for ConstraintsTest{T1, T2, T3, T4, T5, T6, T7}. | ||
/// </summary> | ||
public partial class ConstraintsTest<T1, T2, T3, T4, T5, T6, T7> where T1 : class, global::ITestInterface, new() where T2 : struct, IComparable<T2> where T3 : notnull where T4 : unmanaged, struct where T5 : global::BaseClass where T6 : T1 where T7 : class? | ||
{ | ||
private static readonly PropertyChangedEventArgs _property1ChangedEventArgs = new PropertyChangedEventArgs(nameof(Property1)); | ||
private static readonly PropertyChangedEventArgs _property2ChangedEventArgs = new PropertyChangedEventArgs(nameof(Property2)); | ||
private static readonly PropertyChangedEventArgs _property3ChangedEventArgs = new PropertyChangedEventArgs(nameof(Property3)); | ||
private static readonly PropertyChangedEventArgs _property4ChangedEventArgs = new PropertyChangedEventArgs(nameof(Property4)); | ||
private static readonly PropertyChangedEventArgs _property5ChangedEventArgs = new PropertyChangedEventArgs(nameof(Property5)); | ||
private static readonly PropertyChangedEventArgs _property6ChangedEventArgs = new PropertyChangedEventArgs(nameof(Property6)); | ||
private static readonly PropertyChangedEventArgs _property7ChangedEventArgs = new PropertyChangedEventArgs(nameof(Property7)); | ||
|
||
public partial T1? Property1 | ||
{ | ||
get => field; | ||
set | ||
{ | ||
if (!Equals(field, value)) | ||
{ | ||
field = value; | ||
OnPropertyChanged(_property1ChangedEventArgs); | ||
} | ||
} | ||
} | ||
|
||
public partial T2 Property2 | ||
{ | ||
get => field; | ||
set | ||
{ | ||
if (!Equals(field, value)) | ||
{ | ||
field = value; | ||
OnPropertyChanged(_property2ChangedEventArgs); | ||
} | ||
} | ||
} | ||
|
||
public partial T3 Property3 | ||
{ | ||
get => field; | ||
set | ||
{ | ||
if (!Equals(field, value)) | ||
{ | ||
field = value; | ||
OnPropertyChanged(_property3ChangedEventArgs); | ||
} | ||
} | ||
} | ||
|
||
public partial T4 Property4 | ||
{ | ||
get => field; | ||
set | ||
{ | ||
if (!Equals(field, value)) | ||
{ | ||
field = value; | ||
OnPropertyChanged(_property4ChangedEventArgs); | ||
} | ||
} | ||
} | ||
|
||
public partial T5? Property5 | ||
{ | ||
get => field; | ||
set | ||
{ | ||
if (!Equals(field, value)) | ||
{ | ||
field = value; | ||
OnPropertyChanged(_property5ChangedEventArgs); | ||
} | ||
} | ||
} | ||
|
||
public partial T6? Property6 | ||
{ | ||
get => field; | ||
set | ||
{ | ||
if (!Equals(field, value)) | ||
{ | ||
field = value; | ||
OnPropertyChanged(_property6ChangedEventArgs); | ||
} | ||
} | ||
} | ||
|
||
public partial T7? Property7 | ||
{ | ||
get => field; | ||
set | ||
{ | ||
if (!Equals(field, value)) | ||
{ | ||
field = value; | ||
OnPropertyChanged(_property7ChangedEventArgs); | ||
} | ||
} | ||
} | ||
} | ||
|
||
}, | ||
{ | ||
FileName: IgnoreReactiveAttribute.g.cs, | ||
Source: | ||
// <auto-generated/> | ||
using System; | ||
|
||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] | ||
sealed class IgnoreReactiveAttribute : Attribute | ||
{ | ||
public IgnoreReactiveAttribute() { } | ||
} | ||
}, | ||
{ | ||
FileName: ReactiveAttribute.g.cs, | ||
Source: | ||
// <auto-generated/> | ||
using System; | ||
|
||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] | ||
sealed class ReactiveAttribute : Attribute | ||
{ | ||
public ReactiveAttribute() { } | ||
} | ||
} | ||
], | ||
Diagnostics: null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.