C#: Add test for implicit index usage.

This commit is contained in:
Michael Nebel
2025-01-22 15:33:54 +01:00
parent 9286596c1e
commit 0430a9ee3f
3 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
using System;
public class Container
{
public object[] Buffer { get; } = new object[10];
}
public class TestIndex
{
public void M()
{
var c = new Container()
{
Buffer =
{
[0] = new object(),
[1] = new object(),
[^1] = new object()
}
};
c.Buffer[4] = new object();
c.Buffer[^3] = new object();
}
}

View File

@@ -0,0 +1,2 @@
| Index.cs:18:18:18:19 | ^... | Index.cs:18:19:18:19 | 1 |
| Index.cs:22:18:22:19 | ^... | Index.cs:22:19:22:19 | 3 |

View File

@@ -0,0 +1,4 @@
import csharp
from IndexExpr e
select e, e.getExpr()