-
Notifications
You must be signed in to change notification settings - Fork 19
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 #37 from ssttgg/top-level-stmts
Top level statement support
- Loading branch information
Showing
26 changed files
with
944 additions
and
303 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
35 changes: 35 additions & 0 deletions
35
Generator.Equals.SnapshotTests/TopLevel/Program.cs.00Animal.Generator.Equals.g.verified.cs
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,35 @@ | ||
//HintName: Animal.Generator.Equals.g.cs | ||
|
||
#nullable enable | ||
#pragma warning disable CS0612,CS0618 | ||
|
||
partial record Animal | ||
{ | ||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public virtual bool Equals(global::Animal? other) | ||
{ | ||
return | ||
!ReferenceEquals(other, null) && EqualityContract == other.EqualityContract | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.String>.Default.Equals(this.Name!, other.Name!) | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default.Equals(this.Age!, other.Age!) | ||
; | ||
} | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public override int GetHashCode() | ||
{ | ||
var hashCode = new global::System.HashCode(); | ||
|
||
hashCode.Add(this.EqualityContract); | ||
hashCode.Add( | ||
this.Name!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.String>.Default); | ||
hashCode.Add( | ||
this.Age!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default); | ||
|
||
return hashCode.ToHashCode(); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...tor.Equals.SnapshotTests/TopLevel/Program.cs.00ClassSample.Generator.Equals.g.verified.cs
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,63 @@ | ||
//HintName: ClassSample.Generator.Equals.g.cs | ||
|
||
#nullable enable | ||
#pragma warning disable CS0612,CS0618 | ||
|
||
partial class ClassSample : global::System.IEquatable<ClassSample> | ||
{ | ||
/// <summary> | ||
/// Indicates whether the object on the left is equal to the object on the right. | ||
/// </summary> | ||
/// <param name="left">The left object</param> | ||
/// <param name="right">The right object</param> | ||
/// <returns>true if the objects are equal; otherwise, false.</returns> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public static bool operator ==( | ||
global::ClassSample? left, | ||
global::ClassSample? right) => | ||
global::System.Collections.Generic.EqualityComparer<global::ClassSample?>.Default | ||
.Equals(left, right); | ||
|
||
/// <summary> | ||
/// Indicates whether the object on the left is not equal to the object on the right. | ||
/// </summary> | ||
/// <param name="left">The left object</param> | ||
/// <param name="right">The right object</param> | ||
/// <returns>true if the objects are not equal; otherwise, false.</returns> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public static bool operator !=(global::ClassSample? left, global::ClassSample? right) => | ||
!(left == right); | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public override bool Equals(object? obj) => | ||
Equals(obj as global::ClassSample); | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public bool Equals(global::ClassSample? other) | ||
{ | ||
return | ||
!ReferenceEquals(other, null) && this.GetType() == other.GetType() | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.String>.Default.Equals(this.Name!, other.Name!) | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default.Equals(this.Age!, other.Age!) | ||
; | ||
} | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public override int GetHashCode() | ||
{ | ||
var hashCode = new global::System.HashCode(); | ||
|
||
hashCode.Add(this.GetType()); | ||
hashCode.Add( | ||
this.Name!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.String>.Default); | ||
hashCode.Add( | ||
this.Age!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default); | ||
|
||
return hashCode.ToHashCode(); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
Generator.Equals.SnapshotTests/TopLevel/Program.cs.01Person.Generator.Equals.g.verified.cs
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,63 @@ | ||
//HintName: Person.Generator.Equals.g.cs | ||
|
||
#nullable enable | ||
#pragma warning disable CS0612,CS0618 | ||
|
||
partial class Person : global::System.IEquatable<Person> | ||
{ | ||
/// <summary> | ||
/// Indicates whether the object on the left is equal to the object on the right. | ||
/// </summary> | ||
/// <param name="left">The left object</param> | ||
/// <param name="right">The right object</param> | ||
/// <returns>true if the objects are equal; otherwise, false.</returns> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public static bool operator ==( | ||
global::Person? left, | ||
global::Person? right) => | ||
global::System.Collections.Generic.EqualityComparer<global::Person?>.Default | ||
.Equals(left, right); | ||
|
||
/// <summary> | ||
/// Indicates whether the object on the left is not equal to the object on the right. | ||
/// </summary> | ||
/// <param name="left">The left object</param> | ||
/// <param name="right">The right object</param> | ||
/// <returns>true if the objects are not equal; otherwise, false.</returns> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public static bool operator !=(global::Person? left, global::Person? right) => | ||
!(left == right); | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public override bool Equals(object? obj) => | ||
Equals(obj as global::Person); | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public bool Equals(global::Person? other) | ||
{ | ||
return | ||
!ReferenceEquals(other, null) && this.GetType() == other.GetType() | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.String>.Default.Equals(this.Name!, other.Name!) | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default.Equals(this.Age!, other.Age!) | ||
; | ||
} | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public override int GetHashCode() | ||
{ | ||
var hashCode = new global::System.HashCode(); | ||
|
||
hashCode.Add(this.GetType()); | ||
hashCode.Add( | ||
this.Name!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.String>.Default); | ||
hashCode.Add( | ||
this.Age!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default); | ||
|
||
return hashCode.ToHashCode(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...or.Equals.SnapshotTests/TopLevel/Program.cs.01RecordSample.Generator.Equals.g.verified.cs
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,35 @@ | ||
//HintName: RecordSample.Generator.Equals.g.cs | ||
|
||
#nullable enable | ||
#pragma warning disable CS0612,CS0618 | ||
|
||
partial record RecordSample | ||
{ | ||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public virtual bool Equals(global::RecordSample? other) | ||
{ | ||
return | ||
!ReferenceEquals(other, null) && EqualityContract == other.EqualityContract | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.String>.Default.Equals(this.Name!, other.Name!) | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default.Equals(this.Age!, other.Age!) | ||
; | ||
} | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public override int GetHashCode() | ||
{ | ||
var hashCode = new global::System.HashCode(); | ||
|
||
hashCode.Add(this.EqualityContract); | ||
hashCode.Add( | ||
this.Name!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.String>.Default); | ||
hashCode.Add( | ||
this.Age!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default); | ||
|
||
return hashCode.ToHashCode(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...als.SnapshotTests/TopLevel/Program.cs.02RecordStructSample.Generator.Equals.g.verified.cs
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,33 @@ | ||
//HintName: RecordStructSample.Generator.Equals.g.cs | ||
|
||
#nullable enable | ||
#pragma warning disable CS0612,CS0618 | ||
|
||
partial record struct RecordStructSample | ||
{ | ||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public bool Equals(global::RecordStructSample other) | ||
{ | ||
return true | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.String>.Default.Equals(this.Name!, other.Name!) | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default.Equals(this.Age!, other.Age!) | ||
; | ||
} | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public override int GetHashCode() | ||
{ | ||
var hashCode = new global::System.HashCode(); | ||
|
||
hashCode.Add( | ||
this.Name!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.String>.Default); | ||
hashCode.Add( | ||
this.Age!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default); | ||
|
||
return hashCode.ToHashCode(); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
...or.Equals.SnapshotTests/TopLevel/Program.cs.03StructSample.Generator.Equals.g.verified.cs
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,61 @@ | ||
//HintName: StructSample.Generator.Equals.g.cs | ||
|
||
#nullable enable | ||
#pragma warning disable CS0612,CS0618 | ||
|
||
partial struct StructSample : global::System.IEquatable<StructSample> | ||
{ | ||
/// <summary> | ||
/// Indicates whether the object on the left is equal to the object on the right. | ||
/// </summary> | ||
/// <param name="left">The left object</param> | ||
/// <param name="right">The right object</param> | ||
/// <returns>true if the objects are equal; otherwise, false.</returns> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public static bool operator ==( | ||
global::StructSample left, | ||
global::StructSample right) => | ||
global::System.Collections.Generic.EqualityComparer<global::StructSample>.Default | ||
.Equals(left, right); | ||
|
||
/// <summary> | ||
/// Indicates whether the object on the left is not equal to the object on the right. | ||
/// </summary> | ||
/// <param name="left">The left object</param> | ||
/// <param name="right">The right object</param> | ||
/// <returns>true if the objects are not equal; otherwise, false.</returns> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public static bool operator !=(global::StructSample left, global::StructSample right) => | ||
!(left == right); | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public override bool Equals(object? obj) => | ||
obj is global::StructSample o && Equals(o); | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public bool Equals(global::StructSample other) | ||
{ | ||
return true | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.String>.Default.Equals(this.Name!, other.Name!) | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default.Equals(this.Age!, other.Age!) | ||
; | ||
} | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public override int GetHashCode() | ||
{ | ||
var hashCode = new global::System.HashCode(); | ||
|
||
hashCode.Add( | ||
this.Name!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.String>.Default); | ||
hashCode.Add( | ||
this.Age!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default); | ||
|
||
return hashCode.ToHashCode(); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
Generator.Equals.SnapshotTests/TopLevel/Program.cs.Diagnostics.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 @@ | ||
[] |
35 changes: 35 additions & 0 deletions
35
...quals.SnapshotTests/TopLevel/Program.cs.DotNet6_0.00Animal.Generator.Equals.g.received.cs
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,35 @@ | ||
//HintName: Animal.Generator.Equals.g.cs | ||
|
||
#nullable enable | ||
#pragma warning disable CS0612,CS0618 | ||
|
||
partial record Animal | ||
{ | ||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public virtual bool Equals(global::Animal? other) | ||
{ | ||
return | ||
!ReferenceEquals(other, null) && EqualityContract == other.EqualityContract | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.String>.Default.Equals(this.Name!, other.Name!) | ||
&& global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default.Equals(this.Age!, other.Age!) | ||
; | ||
} | ||
|
||
/// <inheritdoc/> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Generator.Equals", "1.0.0.0")] | ||
public override int GetHashCode() | ||
{ | ||
var hashCode = new global::System.HashCode(); | ||
|
||
hashCode.Add(this.EqualityContract); | ||
hashCode.Add( | ||
this.Name!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.String>.Default); | ||
hashCode.Add( | ||
this.Age!, | ||
global::System.Collections.Generic.EqualityComparer<global::System.Int32>.Default); | ||
|
||
return hashCode.ToHashCode(); | ||
} | ||
} |
Oops, something went wrong.