This may be complicated, but the mechanism is simple: force an expansion of T before R[int] is resolved. In this case, this is forced by the call to var x = T[int]{}.F. We currently lack controls to ensure that inference happens before substitution. I am not sure whether it is trivial to introduce such a mechanism.
This is a follow-up on #51233: in type declarations, it is possible to substitute for type arguments before they are fully resolved.
While investigating this afternoon I was able to construct another crasher:
https://go.dev/play/p/V5Jl7-WDV4K?v=gotip
This may be complicated, but the mechanism is simple: force an expansion of T before R[int] is resolved. In this case, this is forced by the call to
var x = T[int]{}.F
. We currently lack controls to ensure that inference happens before substitution. I am not sure whether it is trivial to introduce such a mechanism.CC @griesemer
The text was updated successfully, but these errors were encountered: