Skip to content

Commit 63dcdc4

Browse files
committed
MORE deterministic
1 parent 435b1ae commit 63dcdc4

File tree

2 files changed

+49
-49
lines changed

2 files changed

+49
-49
lines changed

crates/bindings-csharp/Codegen.Tests/Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static IEnumerable<Diagnostic> GetCompilationErrors(Compilation compilation)
124124
.Emit(Stream.Null)
125125
.Diagnostics.Where(diag => diag.Severity != DiagnosticSeverity.Hidden)
126126
// The order of diagnostics is not predictable, sort them by location & content to make the test deterministic.
127-
.OrderBy(diag => diag.ToString());
127+
.OrderBy(diag => diag.Location.SourceSpan.ToString());
128128
}
129129

130130
[Fact]

crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/ExtraCompilationErrors.verified.txt

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@
4646
}
4747
},
4848
{/*
49-
{
50-
internal static readonly TRW Field = new();
51-
^^^
52-
49+
SpacetimeDB.Internal.Module.RegisterTable<global::TestUniqueNotEquatable, SpacetimeDB.Internal.TableHandles.TestUniqueNotEquatable>();
50+
SpacetimeDB.Internal.Module.RegisterClientVisibilityFilter(global::Module.MY_FILTER);
51+
^^^^^^^^^
52+
SpacetimeDB.Internal.Module.RegisterClientVisibilityFilter(global::Module.MY_FOURTH_FILTER);
5353
*/
54-
Message: The type or namespace name 'TRW' could not be found (are you missing a using directive or an assembly reference?),
54+
Message: 'Module.MY_FILTER' is inaccessible due to its protection level,
5555
Severity: Error,
5656
Descriptor: {
57-
Id: CS0246,
57+
Id: CS0122,
5858
Title: ,
59-
HelpLink: https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0246),
60-
MessageFormat: The type or namespace name '{0}' could not be found (are you missing a using directive or an assembly reference?),
59+
HelpLink: https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0122),
60+
MessageFormat: '{0}' is inaccessible due to its protection level,
6161
Category: Compiler,
6262
DefaultSeverity: Error,
6363
IsEnabledByDefault: true,
@@ -69,18 +69,18 @@
6969
}
7070
},
7171
{/*
72-
73-
partial struct TestTypeParams<T> : System.IEquatable<TestTypeParams>, SpacetimeDB.BSATN.IStructuralReadWrite {
74-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75-
72+
SpacetimeDB.Internal.Module.RegisterClientVisibilityFilter(global::Module.MY_SECOND_FILTER);
73+
SpacetimeDB.Internal.Module.RegisterClientVisibilityFilter(global::Module.MY_THIRD_FILTER);
74+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75+
}
7676
*/
77-
Message: 'TestTypeParams<T>' does not implement interface member 'IEquatable<TestTypeParams>.Equals(TestTypeParams?)',
77+
Message: Argument 1: cannot convert from 'string' to 'SpacetimeDB.Filter',
7878
Severity: Error,
7979
Descriptor: {
80-
Id: CS0535,
80+
Id: CS1503,
8181
Title: ,
82-
HelpLink: https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0535),
83-
MessageFormat: '{0}' does not implement interface member '{1}',
82+
HelpLink: https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS1503),
83+
MessageFormat: Argument {0}: cannot convert from '{1}' to '{2}',
8484
Category: Compiler,
8585
DefaultSeverity: Error,
8686
IsEnabledByDefault: true,
@@ -92,18 +92,18 @@ partial struct TestTypeParams<T> : System.IEquatable<TestTypeParams>, Spacetime
9292
}
9393
},
9494
{/*
95-
96-
partial struct TestTypeParams<T> : System.IEquatable<TestTypeParams>, SpacetimeDB.BSATN.IStructuralReadWrite {
97-
^^^^^^^^^^^^^^
98-
95+
var hashUnsupportedSystemType = UnsupportedSystemType == null ? 0 : UnsupportedSystemType.GetHashCode();
96+
var hashUnresolvedType = UnresolvedType == null ? 0 : UnresolvedType.GetHashCode();
97+
^^^^^^^^^^^
98+
var hashUnsupportedEnum = UnsupportedEnum.GetHashCode();
9999
*/
100-
Message: Using the generic type 'TestTypeParams<T>' requires 1 type arguments,
100+
Message: 'UnresolvedType' does not contain a definition for 'GetHashCode' and no accessible extension method 'GetHashCode' accepting a first argument of type 'UnresolvedType' could be found (are you missing a using directive or an assembly reference?),
101101
Severity: Error,
102102
Descriptor: {
103-
Id: CS0305,
103+
Id: CS1061,
104104
Title: ,
105-
HelpLink: https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0305),
106-
MessageFormat: Using the generic {1} '{0}' requires {2} type arguments,
105+
HelpLink: https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS1061),
106+
MessageFormat: '{0}' does not contain a definition for '{1}' and no accessible extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?),
107107
Category: Compiler,
108108
DefaultSeverity: Error,
109109
IsEnabledByDefault: true,
@@ -115,18 +115,18 @@ partial struct TestTypeParams<T> : System.IEquatable<TestTypeParams>, Spacetime
115115
}
116116
},
117117
{/*
118-
var hashUnsupportedSystemType = UnsupportedSystemType == null ? 0 : UnsupportedSystemType.GetHashCode();
119-
var hashUnresolvedType = UnresolvedType == null ? 0 : UnresolvedType.GetHashCode();
120-
^^^^^^^^^^^
121-
var hashUnsupportedEnum = UnsupportedEnum.GetHashCode();
118+
{
119+
internal static readonly TRW Field = new();
120+
^^^
121+
122122
*/
123-
Message: 'UnresolvedType' does not contain a definition for 'GetHashCode' and no accessible extension method 'GetHashCode' accepting a first argument of type 'UnresolvedType' could be found (are you missing a using directive or an assembly reference?),
123+
Message: The type or namespace name 'TRW' could not be found (are you missing a using directive or an assembly reference?),
124124
Severity: Error,
125125
Descriptor: {
126-
Id: CS1061,
126+
Id: CS0246,
127127
Title: ,
128-
HelpLink: https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS1061),
129-
MessageFormat: '{0}' does not contain a definition for '{1}' and no accessible extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?),
128+
HelpLink: https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0246),
129+
MessageFormat: The type or namespace name '{0}' could not be found (are you missing a using directive or an assembly reference?),
130130
Category: Compiler,
131131
DefaultSeverity: Error,
132132
IsEnabledByDefault: true,
@@ -138,18 +138,18 @@ var hashUnsupportedEnum = UnsupportedEnum.GetHashCode();
138138
}
139139
},
140140
{/*
141-
SpacetimeDB.Internal.Module.RegisterTable<global::TestUniqueNotEquatable, SpacetimeDB.Internal.TableHandles.TestUniqueNotEquatable>();
142-
SpacetimeDB.Internal.Module.RegisterClientVisibilityFilter(global::Module.MY_FILTER);
143-
^^^^^^^^^
144-
SpacetimeDB.Internal.Module.RegisterClientVisibilityFilter(global::Module.MY_FOURTH_FILTER);
141+
142+
partial struct TestTypeParams<T> : System.IEquatable<TestTypeParams>, SpacetimeDB.BSATN.IStructuralReadWrite {
143+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
144+
145145
*/
146-
Message: 'Module.MY_FILTER' is inaccessible due to its protection level,
146+
Message: 'TestTypeParams<T>' does not implement interface member 'IEquatable<TestTypeParams>.Equals(TestTypeParams?)',
147147
Severity: Error,
148148
Descriptor: {
149-
Id: CS0122,
149+
Id: CS0535,
150150
Title: ,
151-
HelpLink: https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0122),
152-
MessageFormat: '{0}' is inaccessible due to its protection level,
151+
HelpLink: https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0535),
152+
MessageFormat: '{0}' does not implement interface member '{1}',
153153
Category: Compiler,
154154
DefaultSeverity: Error,
155155
IsEnabledByDefault: true,
@@ -161,18 +161,18 @@ SpacetimeDB.Internal.Module.RegisterClientVisibilityFilter(global::Module.MY_FOU
161161
}
162162
},
163163
{/*
164-
SpacetimeDB.Internal.Module.RegisterClientVisibilityFilter(global::Module.MY_SECOND_FILTER);
165-
SpacetimeDB.Internal.Module.RegisterClientVisibilityFilter(global::Module.MY_THIRD_FILTER);
166-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167-
}
164+
165+
partial struct TestTypeParams<T> : System.IEquatable<TestTypeParams>, SpacetimeDB.BSATN.IStructuralReadWrite {
166+
^^^^^^^^^^^^^^
167+
168168
*/
169-
Message: Argument 1: cannot convert from 'string' to 'SpacetimeDB.Filter',
169+
Message: Using the generic type 'TestTypeParams<T>' requires 1 type arguments,
170170
Severity: Error,
171171
Descriptor: {
172-
Id: CS1503,
172+
Id: CS0305,
173173
Title: ,
174-
HelpLink: https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS1503),
175-
MessageFormat: Argument {0}: cannot convert from '{1}' to '{2}',
174+
HelpLink: https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0305),
175+
MessageFormat: Using the generic {1} '{0}' requires {2} type arguments,
176176
Category: Compiler,
177177
DefaultSeverity: Error,
178178
IsEnabledByDefault: true,

0 commit comments

Comments
 (0)