Splat generics with proc

https://play.crystal-lang.org/#/r/82p1

class Foo(R, *A)
  def initialize(@action : Proc(*A, R)); end
end
 
 
pp Foo(String, Int32, Bool).new ->(a : Int32, b : Bool) { "foo" }
Showing last frame. Use --error-trace for full trace.

error in line 2
Error: instance variable '@action' of Foo(String, Int32, Bool) must be Proc(*A, String), not Proc(Int32, Bool, String)

From the error message it seems *A is being expanded correctly, however it doesn’t seem to work when used within the Proc type declaration.

Is this a limitation of Generics or a bug?

I think it’s a bug.

1 Like

:+1: I’ll make an issue on Github to track it.

Which issue did this become, for us followers? :)

1 Like