You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cannot use x (variable of type parameter P constrained by interface{}) as int value in argument to g[int]
[edited]: This looks like a correct error message after all: If g is called as g[string]("foo"), the type of x would be string and the local call g[int](x) would be incorrect.
The text was updated successfully, but these errors were encountered:
Agreed that this code should not be permitted because the argument x in the local call of g is of type P (which we don't know anything about) but that call requires the argument to be of type int (per the instantiation of g). In the first recursive call, x will be of type int but that's "too late".
In short, type-checking this function should fail, and thus this is not an issue.
does not type-check:
[edited]: This looks like a correct error message after all: If
g
is called asg[string]("foo")
, the type ofx
would bestring
and the local callg[int](x)
would be incorrect.The text was updated successfully, but these errors were encountered: