diff --git a/.gitattributes b/.gitattributes index 67a8cf8ca..c2317a3a1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1 @@ **/module_bindings/** linguist-generated=true eol=lf -*.verified.* linguist-generated=true eol=lf -/crates/bindings-csharp/Runtime/Internal/Autogen/*.cs linguist-generated=true diff --git a/crates/bindings-csharp/Codegen.Tests/TestInit.cs b/crates/bindings-csharp/Codegen.Tests/TestInit.cs index a066bcc69..17b229a8d 100644 --- a/crates/bindings-csharp/Codegen.Tests/TestInit.cs +++ b/crates/bindings-csharp/Codegen.Tests/TestInit.cs @@ -43,7 +43,11 @@ static class TestInit } writer.WriteComment(comment.ToString()); } - writer.WriteMember(diag, diag.Location, nameof(diag.Location)); + else + { + // Write location only when we don't have the source code snippet to make snapshots more stable. + writer.WriteMember(diag, diag.Location, nameof(diag.Location)); + } writer.WriteMember(diag, diag.GetMessage(), "Message"); writer.WriteMember(diag, diag.Severity, nameof(diag.Severity)); writer.WriteMember(diag, diag.Descriptor, nameof(diag.Descriptor)); diff --git a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/.gitattributes b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/.gitattributes new file mode 100644 index 000000000..d2add91c0 --- /dev/null +++ b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/.gitattributes @@ -0,0 +1 @@ +/snapshots/*.verified.cs linguist-generated=true eol=lf diff --git a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/Lib.cs b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/Lib.cs index a340a5d3f..33c00c39c 100644 --- a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/Lib.cs +++ b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/Lib.cs @@ -1,4 +1,4 @@ -using SpacetimeDB; +using SpacetimeDB; public enum LocalEnum { } @@ -322,10 +322,10 @@ public static partial class Reducers } [SpacetimeDB.Reducer] - public static void TestIncompatibleScheduleReducer( - ReducerContext ctx, - TestIncompatibleSchedule table - ) { } + public static void OnReducerWithReservedPrefix(ReducerContext ctx) { } + + [SpacetimeDB.Reducer] + public static void __ReducerWithReservedPrefix(ReducerContext ctx) { } } [SpacetimeDB.Table] @@ -363,7 +363,14 @@ public static partial class InAnotherNamespace [SpacetimeDB.Table( Name = "TestIncompatibleSchedule1", - Scheduled = nameof(Reducers.TestIncompatibleScheduleReducer) + Scheduled = nameof(TestIncompatibleScheduleReducer) )] [SpacetimeDB.Table(Name = "TestIncompatibleSchedule2")] -public partial struct TestIncompatibleSchedule { } +public partial struct TestIncompatibleSchedule +{ + [SpacetimeDB.Reducer] + public static void TestIncompatibleScheduleReducer( + ReducerContext ctx, + TestIncompatibleSchedule table + ) { } +} diff --git a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/ExtraCompilationErrors.verified.txt b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/ExtraCompilationErrors.verified.txt index 365c3ccb9..39f1bc63b 100644 --- a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/ExtraCompilationErrors.verified.txt +++ b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/ExtraCompilationErrors.verified.txt @@ -5,7 +5,6 @@ ^^^^^^^^^^^^^^ public LocalEnum UnsupportedEnum; */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (9,11)-(9,25), Message: The type or namespace name 'UnresolvedType' could not be found (are you missing a using directive or an assembly reference?), Severity: Error, Descriptor: { @@ -29,7 +28,6 @@ ^^^ */ - Location: SpacetimeDB.BSATN.Codegen\SpacetimeDB.Codegen.Type\TestTypeParams_T_.cs: (13,29)-(13,32), Message: The type or namespace name 'TRW' could not be found (are you missing a using directive or an assembly reference?), Severity: Error, Descriptor: { @@ -53,7 +51,6 @@ internal static readonly SpacetimeDB.BSATN.IReadWrite Unsuppor ^^^^^ internal static readonly SpacetimeDB.BSATN.IReadWrite UnresolvedType = new(); */ - Location: SpacetimeDB.BSATN.Codegen\SpacetimeDB.Codegen.Type\TestUnsupportedType.cs: (20,96)-(20,101), Message: Cannot create an instance of the abstract type or interface 'IReadWrite', Severity: Error, Descriptor: { @@ -77,7 +74,6 @@ internal static readonly SpacetimeDB.BSATN.IReadWrite Unresolved ^^^^^^^^^^^^^^ internal static readonly SpacetimeDB.BSATN.IReadWrite UnsupportedEnum = new(); */ - Location: SpacetimeDB.BSATN.Codegen\SpacetimeDB.Codegen.Type\TestUnsupportedType.cs: (21,54)-(21,68), Message: The type or namespace name 'UnresolvedType' could not be found (are you missing a using directive or an assembly reference?), Severity: Error, Descriptor: { @@ -101,7 +97,6 @@ internal static readonly SpacetimeDB.BSATN.IReadWrite Unresolved ^^^^^ internal static readonly SpacetimeDB.BSATN.IReadWrite UnsupportedEnum = new(); */ - Location: SpacetimeDB.BSATN.Codegen\SpacetimeDB.Codegen.Type\TestUnsupportedType.cs: (21,87)-(21,92), Message: Cannot create an instance of the abstract type or interface 'IReadWrite', Severity: Error, Descriptor: { @@ -125,7 +120,6 @@ internal static readonly SpacetimeDB.BSATN.IReadWrite UnsupportedEnum ^^^^^ */ - Location: SpacetimeDB.BSATN.Codegen\SpacetimeDB.Codegen.Type\TestUnsupportedType.cs: (22,83)-(22,88), Message: Cannot create an instance of the abstract type or interface 'IReadWrite', Severity: Error, Descriptor: { @@ -149,7 +143,6 @@ internal static readonly SpacetimeDB.BSATN.IReadWrite UnsupportedEnum ^^^^^ internal static readonly SpacetimeDB.BSATN.IReadWrite UnsupportedSystemType = new(); */ - Location: SpacetimeDB.BSATN.Codegen\SpacetimeDB.Codegen.Type\TestUnsupportedType.cs: (19,100)-(19,105), Message: Cannot create an instance of the abstract type or interface 'IReadWrite', Severity: Error, Descriptor: { @@ -173,7 +166,6 @@ internal static readonly SpacetimeDB.BSATN.IReadWrite Unsuppor ^^^^^^^^^^^^^^^^^^^^^^^^^ } */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (196,17)-(196,42), Message: No overload for method 'TestReducerWithoutContext' takes 1 arguments, Severity: Error, Descriptor: { @@ -197,7 +189,6 @@ SpacetimeDB.Internal.Module.RegisterTable(); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SpacetimeDB.Internal.Module.RegisterTable(); */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (219,28)-(219,70), Message: The type 'TestTableTaggedEnum' cannot be used as type parameter 'T' in the generic type or method 'Module.RegisterTable()'. There is no implicit reference conversion from 'TestTableTaggedEnum' to 'SpacetimeDB.Internal.ITable'., Severity: Error, Descriptor: { @@ -221,7 +212,6 @@ SpacetimeDB.Internal.Module.RegisterTable(); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SpacetimeDB.Internal.Module.RegisterTable(); */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (219,28)-(219,70), Message: 'TestTableTaggedEnum' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'Module.RegisterTable()', Severity: Error, Descriptor: { @@ -245,7 +235,6 @@ public readonly struct TestTableTaggedEnum : SpacetimeDB.Internal.ITableView.ReadGenFields(System.IO.BinaryReader reader, global::TestTableTaggedEnum row) { */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (105,23)-(105,42), Message: The type 'TestTableTaggedEnum' cannot be used as type parameter 'T' in the generic type or method 'ITableView'. There is no implicit reference conversion from 'TestTableTaggedEnum' to 'SpacetimeDB.Internal.ITable'., Severity: Error, Descriptor: { @@ -269,7 +258,6 @@ public readonly struct TestTableTaggedEnum : SpacetimeDB.Internal.ITableView.ReadGenFields(System.IO.BinaryReader reader, global::TestTableTaggedEnum row) { */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (105,23)-(105,42), Message: 'TestTableTaggedEnum' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'ITableView', Severity: Error, Descriptor: { @@ -293,7 +281,6 @@ public readonly struct TestTableTaggedEnum : SpacetimeDB.Internal.ITableView'. There is no implicit reference conversion from 'TestTableTaggedEnum' to 'SpacetimeDB.Internal.ITable'., Severity: Error, Descriptor: { @@ -317,7 +304,6 @@ public readonly struct TestTableTaggedEnum : SpacetimeDB.Internal.ITableView', Severity: Error, Descriptor: { @@ -341,7 +327,6 @@ public readonly struct TestTableTaggedEnum : SpacetimeDB.Internal.ITableView SpacetimeDB.Internal.ITableView.Insert(row); */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (110,115)-(110,142), Message: The type 'TestTableTaggedEnum' cannot be used as type parameter 'T' in the generic type or method 'ITableView'. There is no implicit reference conversion from 'TestTableTaggedEnum' to 'SpacetimeDB.Internal.ITable'., Severity: Error, Descriptor: { @@ -365,7 +350,6 @@ public readonly struct TestTableTaggedEnum : SpacetimeDB.Internal.ITableView SpacetimeDB.Internal.ITableView.Insert(row); */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (110,115)-(110,142), Message: 'TestTableTaggedEnum' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'ITableView', Severity: Error, Descriptor: { @@ -389,7 +373,6 @@ public readonly struct TestTableTaggedEnum : SpacetimeDB.Internal.ITableView FilterByX(int X) => */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (111,135)-(111,162), Message: The type 'TestTableTaggedEnum' cannot be used as type parameter 'T' in the generic type or method 'ITableView'. There is no implicit reference conversion from 'TestTableTaggedEnum' to 'SpacetimeDB.Internal.ITable'., Severity: Error, Descriptor: { @@ -413,7 +396,6 @@ public readonly struct TestTableTaggedEnum : SpacetimeDB.Internal.ITableView FilterByX(int X) => */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (111,135)-(111,162), Message: 'TestTableTaggedEnum' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'ITableView', Severity: Error, Descriptor: { @@ -437,7 +419,6 @@ public readonly struct TestTableTaggedEnum : SpacetimeDB.Internal.ITableView FilterByY(int Y) => */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (113,57)-(113,84), Message: The type 'TestTableTaggedEnum' cannot be used as type parameter 'T' in the generic type or method 'ITableView'. There is no implicit reference conversion from 'TestTableTaggedEnum' to 'SpacetimeDB.Internal.ITable'., Severity: Error, Descriptor: { @@ -461,7 +442,6 @@ public IEnumerable FilterByY(int Y) => ^^^^^^^^^^^^^^^^^^^^^^^^^^^ public IEnumerable FilterByY(int Y) => */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (113,57)-(113,84), Message: 'TestTableTaggedEnum' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'ITableView', Severity: Error, Descriptor: { @@ -485,7 +465,6 @@ public IEnumerable FilterByY(int Y) => ^^^^^^^^^^^^^^^^^^^^^^^^^^^ } */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (115,57)-(115,84), Message: The type 'TestTableTaggedEnum' cannot be used as type parameter 'T' in the generic type or method 'ITableView'. There is no implicit reference conversion from 'TestTableTaggedEnum' to 'SpacetimeDB.Internal.ITable'., Severity: Error, Descriptor: { @@ -509,7 +488,6 @@ public IEnumerable FilterByY(int Y) => ^^^^^^^^^^^^^^^^^^^^^^^^^^^ } */ - Location: SpacetimeDB.Codegen\SpacetimeDB.Codegen.Module\FFI.cs: (115,57)-(115,84), Message: 'TestTableTaggedEnum' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'ITableView', Severity: Error, Descriptor: { diff --git a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#FFI.verified.cs b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#FFI.verified.cs index 3dcef8edc..dc21fb694 100644 --- a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#FFI.verified.cs +++ b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#FFI.verified.cs @@ -391,6 +391,30 @@ static class ModuleRegistration } } + class __ReducerWithReservedPrefix : SpacetimeDB.Internal.IReducer + { + public SpacetimeDB.Internal.ReducerDef MakeReducerDef( + SpacetimeDB.BSATN.ITypeRegistrar registrar + ) => new("__ReducerWithReservedPrefix", []); + + public void Invoke(BinaryReader reader, SpacetimeDB.Internal.IReducerContext ctx) + { + Reducers.__ReducerWithReservedPrefix((SpacetimeDB.ReducerContext)ctx); + } + } + + class OnReducerWithReservedPrefix : SpacetimeDB.Internal.IReducer + { + public SpacetimeDB.Internal.ReducerDef MakeReducerDef( + SpacetimeDB.BSATN.ITypeRegistrar registrar + ) => new("OnReducerWithReservedPrefix", []); + + public void Invoke(BinaryReader reader, SpacetimeDB.Internal.IReducerContext ctx) + { + Reducers.OnReducerWithReservedPrefix((SpacetimeDB.ReducerContext)ctx); + } + } + class TestDuplicateReducerName : SpacetimeDB.Internal.IReducer { public SpacetimeDB.Internal.ReducerDef MakeReducerDef( @@ -417,7 +441,7 @@ static class ModuleRegistration public void Invoke(BinaryReader reader, SpacetimeDB.Internal.IReducerContext ctx) { - Reducers.TestIncompatibleScheduleReducer( + TestIncompatibleSchedule.TestIncompatibleScheduleReducer( (SpacetimeDB.ReducerContext)ctx, table.Read(reader) ); @@ -467,6 +491,8 @@ static class ModuleRegistration ); SpacetimeDB.Internal.Module.RegisterReducer(); + SpacetimeDB.Internal.Module.RegisterReducer<__ReducerWithReservedPrefix>(); + SpacetimeDB.Internal.Module.RegisterReducer(); SpacetimeDB.Internal.Module.RegisterReducer(); SpacetimeDB.Internal.Module.RegisterReducer(); SpacetimeDB.Internal.Module.RegisterReducer(); diff --git a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#Reducers.OnReducerWithReservedPrefix.verified.cs b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#Reducers.OnReducerWithReservedPrefix.verified.cs new file mode 100644 index 000000000..e1bb60b45 --- /dev/null +++ b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#Reducers.OnReducerWithReservedPrefix.verified.cs @@ -0,0 +1,18 @@ +//HintName: Reducers.OnReducerWithReservedPrefix.cs +// +#nullable enable + +partial class Reducers +{ + [System.Diagnostics.CodeAnalysis.Experimental("STDB_UNSTABLE")] + public static void VolatileNonatomicScheduleImmediateOnReducerWithReservedPrefix() + { + using var stream = new MemoryStream(); + using var writer = new BinaryWriter(stream); + + SpacetimeDB.Internal.IReducer.VolatileNonatomicScheduleImmediate( + "OnReducerWithReservedPrefix", + stream + ); + } +} // Reducers diff --git a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#Reducers.__ReducerWithReservedPrefix.verified.cs b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#Reducers.__ReducerWithReservedPrefix.verified.cs new file mode 100644 index 000000000..e7cbe63e3 --- /dev/null +++ b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#Reducers.__ReducerWithReservedPrefix.verified.cs @@ -0,0 +1,18 @@ +//HintName: Reducers.__ReducerWithReservedPrefix.cs +// +#nullable enable + +partial class Reducers +{ + [System.Diagnostics.CodeAnalysis.Experimental("STDB_UNSTABLE")] + public static void VolatileNonatomicScheduleImmediate__ReducerWithReservedPrefix() + { + using var stream = new MemoryStream(); + using var writer = new BinaryWriter(stream); + + SpacetimeDB.Internal.IReducer.VolatileNonatomicScheduleImmediate( + "__ReducerWithReservedPrefix", + stream + ); + } +} // Reducers diff --git a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#Reducers.TestIncompatibleScheduleReducer.verified.cs b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#TestIncompatibleSchedule.TestIncompatibleScheduleReducer.verified.cs similarity index 79% rename from crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#Reducers.TestIncompatibleScheduleReducer.verified.cs rename to crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#TestIncompatibleSchedule.TestIncompatibleScheduleReducer.verified.cs index b0004155d..226f5a450 100644 --- a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#Reducers.TestIncompatibleScheduleReducer.verified.cs +++ b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module#TestIncompatibleSchedule.TestIncompatibleScheduleReducer.verified.cs @@ -1,8 +1,8 @@ -//HintName: Reducers.TestIncompatibleScheduleReducer.cs +//HintName: TestIncompatibleSchedule.TestIncompatibleScheduleReducer.cs // #nullable enable -partial class Reducers +partial struct TestIncompatibleSchedule { [System.Diagnostics.CodeAnalysis.Experimental("STDB_UNSTABLE")] public static void VolatileNonatomicScheduleImmediateTestIncompatibleScheduleReducer( @@ -17,4 +17,4 @@ partial class Reducers stream ); } -} // Reducers +} // TestIncompatibleSchedule diff --git a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module.verified.txt b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module.verified.txt index 290e5b6d1..c9a5b6617 100644 --- a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module.verified.txt +++ b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Module.verified.txt @@ -6,7 +6,6 @@ ^^^^^^^^^^^^ */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (334,17)-(334,29), Message: Field AutoIncField is marked as AutoInc but it has a non-integer type float., Severity: Error, Descriptor: { @@ -24,7 +23,6 @@ ^^^^^^^^^^^^^ } */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (338,18)-(338,31), Message: Field IdentityField is marked as AutoInc but it has a non-integer type string., Severity: Error, Descriptor: { @@ -42,7 +40,6 @@ ^^^^^^^^^^^ */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (345,16)-(345,27), Message: Field UniqueField is marked as Unique but it has a type int? which is not an equatable primitive., Severity: Error, Descriptor: { @@ -60,7 +57,6 @@ ^^^^^^^^^^^^^^^ } */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (348,38)-(348,53), Message: Field PrimaryKeyField is marked as Unique but it has a type TestEnumWithExplicitValues which is not an equatable primitive., Severity: Error, Descriptor: { @@ -78,7 +74,6 @@ public partial record TestTableTaggedEnum : SpacetimeDB.TaggedEnum<(int X, int Y ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (352,42)-(352,82), Message: Table TestTableTaggedEnum is a tagged enum, which is not allowed., Severity: Error, Descriptor: { @@ -96,15 +91,14 @@ public partial record TestTableTaggedEnum : SpacetimeDB.TaggedEnum<(int X, int Y ^^^^^^^^^^^^^^^^^^^ Name = "TestIncompatibleSchedule1", ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Scheduled = nameof(Reducers.TestIncompatibleScheduleReducer) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Scheduled = nameof(TestIncompatibleScheduleReducer) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ )] ^^ [SpacetimeDB.Table(Name = "TestIncompatibleSchedule2")] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -public partial struct TestIncompatibleSchedule { } +public partial struct TestIncompatibleSchedule */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (363,0)-(367,55), Message: Schedule adds extra fields to the row type. Either all `[Table]` attributes should have a `Schedule`, or none of them., Severity: Error, Descriptor: { @@ -122,7 +116,6 @@ public partial struct TestIncompatibleSchedule { } ^^^ */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (303,18)-(303,21), Message: Reducer method TestReducerReturnType returns int instead of void., Severity: Error, Descriptor: { @@ -140,7 +133,6 @@ public partial struct TestIncompatibleSchedule { } ^^ */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (306,48)-(306,50), Message: Reducer method TestReducerWithoutContext does not have a ReducerContext parameter., Severity: Error, Descriptor: { @@ -152,6 +144,40 @@ public partial struct TestIncompatibleSchedule { } IsEnabledByDefault: true } }, + {/* + [SpacetimeDB.Reducer] + public static void OnReducerWithReservedPrefix(ReducerContext ctx) { } + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +*/ + Message: Reducer method OnReducerWithReservedPrefix starts with 'On', which is a reserved prefix., + Severity: Error, + Descriptor: { + Id: STDB0007, + Title: Reducer method has a reserved name prefix, + MessageFormat: Reducer method {0} starts with '{1}', which is a reserved prefix., + Category: SpacetimeDB, + DefaultSeverity: Error, + IsEnabledByDefault: true + } + }, + {/* + [SpacetimeDB.Reducer] + public static void __ReducerWithReservedPrefix(ReducerContext ctx) { } + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +} +*/ + Message: Reducer method __ReducerWithReservedPrefix starts with '__', which is a reserved prefix., + Severity: Error, + Descriptor: { + Id: STDB0007, + Title: Reducer method has a reserved name prefix, + MessageFormat: Reducer method {0} starts with '{1}', which is a reserved prefix., + Category: SpacetimeDB, + DefaultSeverity: Error, + IsEnabledByDefault: true + } + }, { Location: , Message: Reducer with the same export name __init__ is registered in multiple places: Reducers.TestDuplicateReducerKind1, Reducers.TestDuplicateReducerKind2, diff --git a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Type.verified.txt b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Type.verified.txt index 5f7eac1f6..a707dbe28 100644 --- a/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Type.verified.txt +++ b/crates/bindings-csharp/Codegen.Tests/fixtures/diag/snapshots/Type.verified.txt @@ -6,7 +6,6 @@ ^^^ EnumVariant2 = 2, */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (16,17)-(16,20), Message: TestEnumWithExplicitValues.EnumVariant1 has an explicit value 1 which is not allowed in SpacetimeDB enums., Severity: Error, Descriptor: { @@ -24,7 +23,6 @@ ^^^ } */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (17,17)-(17,20), Message: TestEnumWithExplicitValues.EnumVariant2 has an explicit value 2 which is not allowed in SpacetimeDB enums., Severity: Error, Descriptor: { @@ -42,7 +40,6 @@ ^^^^^^^^^^^^^^ } */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (279,4)-(279,18), Message: TestEnumWithTooManyVariants has 257 variants which is more than the allowed 256 variants for SpacetimeDB enums., Severity: Error, Descriptor: { @@ -60,7 +57,6 @@ ^^^^^^^^^^^^^^^^^^^^^^ public Exception UnsupportedSystemType; */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (7,20)-(7,42), Message: BSATN implementation for System.DateTime is not found: Unsupported special type System.DateTime (System_DateTime), Severity: Error, Descriptor: { @@ -78,7 +74,6 @@ ^^^^^^^^^^^^^^^^^^^^^ public UnresolvedType UnresolvedType; */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (8,21)-(8,42), Message: BSATN implementation for System.Exception is not found: Unsupported system type System.Exception, Severity: Error, Descriptor: { @@ -96,7 +91,6 @@ ^^^^^^^^^^^^^^ public LocalEnum UnsupportedEnum; */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (9,26)-(9,40), Message: BSATN implementation for UnresolvedType is not found: Could not resolve type UnresolvedType, Severity: Error, Descriptor: { @@ -114,7 +108,6 @@ ^^^^^^^^^^^^^^^ } */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (10,21)-(10,36), Message: BSATN implementation for LocalEnum is not found: Enum LocalEnum does not have a [SpacetimeDB.Type] attribute, Severity: Error, Descriptor: { @@ -132,7 +125,6 @@ ^^^^^^^^^^^^^^^^^^^^^^^^ } */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (285,15)-(285,39), Message: ForbiddenTaggedEnumField is an instance field, which are not permitted inside SpacetimeDB tagged enums., Severity: Error, Descriptor: { @@ -150,7 +142,6 @@ ^^^^^^^^^^^^^^ } */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (291,15)-(291,29), Message: ForbiddenField is an instance field, which are not permitted inside SpacetimeDB tagged enums., Severity: Error, Descriptor: { @@ -168,7 +159,6 @@ public partial struct TestTypeParams ^^^ { */ - Location: {ProjectDirectory}fixtures\diag\Lib.cs: (295,36)-(295,39), Message: Type parameters are not supported in SpacetimeDB types., Severity: Error, Descriptor: { diff --git a/crates/bindings-csharp/Runtime/Internal/.gitattributes b/crates/bindings-csharp/Runtime/Internal/.gitattributes new file mode 100644 index 000000000..53f14a40c --- /dev/null +++ b/crates/bindings-csharp/Runtime/Internal/.gitattributes @@ -0,0 +1 @@ +/Autogen/*.cs linguist-generated=true