Open
Description
Consider this query:
[Query]
private static void Test([Data] in Entity inEntity, in Entity queryEntity)
{
// Does not compile!
}
The source-generated code looks like this:
public static void TestQuery(World world, in Arch.Core.Entity @inentity)
{
if (!ReferenceEquals(_Test_Initialized, world))
{
_Test_Query = world.Query(in Test_QueryDescription);
_Test_Initialized = world;
}
foreach (ref var chunk in _Test_Query.GetChunkIterator())
{
var chunkSize = chunk.Size;
ref var entityFirstElement = ref chunk.Entity(0);
foreach (var entityIndex in chunk)
{
ref readonly var inentity = ref Unsafe.Add(ref entityFirstElement, entityIndex); // Incorrectly named variable!
Test(in @inentity, in @queryentity);
}
}
}
Note that the variable that should be called queryentity
is actually called inentity
, which conflicts with the method signature and produces an error (and queryentity
isn't created).
The workaround is to ensure the regular Entity
comes before the [Data]
entity:
[Query]
private static void Test(in Entity queryEntity, [Data] in Entity inEntity)
{
// Compiles!
}
But the order should not matter, hence the issue.
Similarly, the following will also fail, since it once again assumes the [Data] parameter is a real query entity:
[Query]
private static void Test([Data] in Entity inEntity)
{
// Does not compile!
}
Metadata
Metadata
Assignees
Labels
Projects
Status
No status