Closed jvasileff closed 9 years ago
Foo.U
only works on instances of Foo
, not on the type directly, because it requires the instance's type arguments.
According to 3.2.10 in the spec, isn't all of this supposed to be resolved at compile time?
Although, I guess it's not clear to me whether making the original example work would be enough to also make higher order generics with type aliases for type lambdas work.
For reference, the use case is exactly the toString
call at line 100 https://github.com/ceylon/ceylon-spec/blob/master/test/main/functor/functors.ceylon#L100, which is parameterized like:
toString<String, MapFunctor<Integer,String>.Mapish>(MapFunctor(map));
@jvasileff Well this is a pretty interesting one which I had forgotten was even possible.
The typechecker definitely knows how to handle it, and clearly sees that the type Foot<String>.U
is exactly the type String
. But it doesn't do that replacement automatically.
What I'm thinking is that @chochos just needs to explicitly call resolveAliases()
somewhere, to replace the alias at compile time.
OK I'll look into it
Cool, so this works for me now.
But the type lambda use case still fails. Should I create an issue for that? (Not sure if you guys are looking for bug reports on experimental features...)
@jvasileff I figure we may as well start collecting the bugs as issues, though they aren't a priority for 1.2, of course.
This:
results in:
BTW - I think I have some really cool higher order generics code that would work if just this one issue were fixed!