x/tools/go/ssa: incomplete type parameter substitution causing panics #66783
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Hello!
When x/tools/go/ssa is instantiating generic functions, it seems that the type parameter substitution algorithm does not successfully substitute all instances of the function's parameters when there are other parameterized types involved in an expression. This is easier to explain with two examples.
In this example, the panic occurs while processing the expression
B[rune](s)
while instantiatingS[int].M
. The type argument forB
is unimportant as it's not used, but the presence of the type parameter prevents the type substitution algorithm from rewriting the underlying type ofB[rune]
fromstruct{a T}
tostruct{a int}
, and ssa generation for the conversion subsequently panics.In this second example, the panic occurs while processing the method expression
i.M
while instantiating the functionfoo[int]
. Heregolang.org/x/tools/go/ssa.(*subster).typ
panics; it seems that it cannot perform chains of substitutions through a parameterized named type to get fromI2[int]
toI1[int]
tointerface { M(int) }
.The text was updated successfully, but these errors were encountered: