cmd/go: check that test funcs have no type parameters #48953
Labels
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
release-blocker
Milestone
Currently, when writing a test function with type parameters, cmd/go produces an error like this:
Presumably because the generated code tries to call the generic test func without type arguments.
We should provide a more helpful error message, to the effect of "test functions cannot have type parameters". It looks like it would suffice to add this check here:
https://cs.opensource.google/go/go/+/master:src/cmd/go/internal/load/test.go;l=680;drc=5abfd2379b2e7319d3f08f496c12acdb50e1065a
(note that we probably want to continue matching these funcs in
isTestFunc
, specifically so that we can provide a useful error)@bcmills @matloob does this make sense? Did you have a different behavior in mind? Shall I send a CL?
The text was updated successfully, but these errors were encountered: