cmd/compile: //go:nointerface
mishandled for promoted methods with -G=3
#47928
Labels
Milestone
//go:nointerface
mishandled for promoted methods with -G=3
#47928
The test program below has type T that embeds type U, which has a go:nointerface method M. When compiled with GOEXPERIMENT=fieldtrack, the type assertion should fail. It correctly fails with -G=0 and GOEXPERIMENT=fieldtrack,unified; but it incorrectly succeeds with -G=3.
Notably, the test passes if
func main
is moved after theBad
method. Presumably the issue is that we don't callirgen.funcDecl
(which currently handles settingtypes.Field.Nointerface
) until aftertypes.ResumeCheckSize
. Probably we need to changeirgen.typeDecl
to settypes.Field.Nointerface
instead, so that it's already set before any method promotion happens.Alternatively, maybe we can just get rid of Field.Nointerface in favor of checking Func.Pragma directly. If this works, it seems preferable.
/cc @cuonglm @danscales @randall77
The text was updated successfully, but these errors were encountered: