Skip to content

Commit

Permalink
Fixed monumentally stupid bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
MeltyPlayer committed Apr 17, 2024
1 parent 8b98804 commit 19ca027
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
28 changes: 28 additions & 0 deletions Schema Tests/readOnly/MemberTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,34 @@ public interface IReadOnlyWrapper {
""");
}

[Test]
public void TestMultiIndexer() {
ReadOnlyGeneratorTestUtil.AssertGenerated(
"""
using schema.readOnly;
using System.Collections.Generic;

namespace foo.bar {
[GenerateReadOnly]
public partial interface IWrapper {
public bool this[int x, int y] { get; set; }
}
}
""",
"""
namespace foo.bar {
public partial interface IWrapper : IReadOnlyWrapper {
bool IReadOnlyWrapper.this[int x, int y] => this[x, y];
}

public interface IReadOnlyWrapper {
public bool this[int x, int y] { get; }
}
}

""");
}

[Test]
public void TestNamelessTuple() {
ReadOnlyGeneratorTestUtil.AssertGenerated(
Expand Down
2 changes: 1 addition & 1 deletion Schema/Schema.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Description>Library for converting classes to and from binary. Provides a C# Roslyn generator that automatically implements conversion logic for simple classes.</Description>
<PackageId>schema</PackageId>
<Title>schema</Title>
<Version>0.4.4</Version>
<Version>0.4.5</Version>
<Authors>MeltyPlayer</Authors>
</PropertyGroup>

Expand Down
3 changes: 1 addition & 2 deletions Schema/src/readOnly/ReadOnlyTypeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,8 @@ private static void WriteMembers_(
if (!isIndexer) {
cbsb.Write(memberSymbol.Name.Substring(4).EscapeKeyword());
} else {
cbsb.Write("this[");
for (var i = 0; i < methodSymbol.Parameters.Length; ++i) {
cbsb.Write("this[");

if (i > 0) {
cbsb.Write(", ");
}
Expand Down

0 comments on commit 19ca027

Please sign in to comment.