Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type parameters are not lowered into generated code #16

Open
joelverhagen opened this issue Jan 8, 2024 · 0 comments
Open

Type parameters are not lowered into generated code #16

joelverhagen opened this issue Jan 8, 2024 · 0 comments

Comments

@joelverhagen
Copy link

Repro:

using System.Collections;
using Cathei.LinqGen;

var input = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 };

foreach (var item in GenericTest.Caster<string, ArrayList>(input, "foo"))
{
    Console.WriteLine($"{item.Item1} {(item.Item2?.ToString() ?? "(null)")}");
}

public static class GenericTest
{
    public static List<(int, TOut?)> Caster<TIn, TOut>(IEnumerable<int> source, TIn value) where TOut : class
    {
        return source
            .Gen()
            .Where(x => x >= 10)
            .Where(x => x <= 20)
            .Select(x => (Int: x, Value: value as TOut))
            .ToList();
    }
}

Errors: Error CS0246: The type or namespace name 'TOut' could not be found

1>------ Build started: Project: LinqGenTest, Configuration: Debug Any CPU ------
1>C:\z\Trash\2024-01-03\LuaTest\LinqGenTest\LinqGen.Generator\Cathei.LinqGen.Generator.LinqGenIncrementalGenerator\LinqGen.Select_2338007894.g.cs(15,61,15,65): error CS0246: The type or namespace name 'TOut' could not be found (are you missing a using directive or an assembly reference?)
1>C:\z\Trash\2024-01-03\LuaTest\LinqGenTest\LinqGen.Generator\Cathei.LinqGen.Generator.LinqGenIncrementalGenerator\LinqGen.Where_3084620607.g.cs(26,57,26,61): error CS0246: The type or namespace name 'TOut' could not be found (are you missing a using directive or an assembly reference?)
1>C:\z\Trash\2024-01-03\LuaTest\LinqGenTest\LinqGen.Generator\Cathei.LinqGen.Generator.LinqGenIncrementalGenerator\LinqGen.Select_2338007894.g.cs(27,31,27,35): error CS0246: The type or namespace name 'TOut' could not be found (are you missing a using directive or an assembly reference?)
1>C:\z\Trash\2024-01-03\LuaTest\LinqGenTest\LinqGen.Generator\Cathei.LinqGen.Generator.LinqGenIncrementalGenerator\LinqGen.Select_2338007894.g.cs(18,76,18,80): error CS0246: The type or namespace name 'TOut' could not be found (are you missing a using directive or an assembly reference?)
1>C:\z\Trash\2024-01-03\LuaTest\LinqGenTest\LinqGen.Generator\Cathei.LinqGen.Generator.LinqGenIncrementalGenerator\LinqGen.Select_2338007894.g.cs(54,38,54,42): error CS0246: The type or namespace name 'TOut' could not be found (are you missing a using directive or an assembly reference?)
1>Done building project "LinqGenTest.csproj" -- FAILED.

Love the project. I am trying it with https://github.com/yanghuan/CSharp.lua and it mostly working except for some minor bugs and shim implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant