go/types, types2: allow choice between reg. expression or not in ERROR test comments #51006
Labels
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
go/types
andtypes2
(and thesyntax
package) rely onERROR
comments in test cases. Such a comment accepts a regular expression pattern that is then matched against the expected error:// ERROR regexp pattern
Often we just want to see if the error string appears verbatim (as a substring) in the error output, we don't need reg. expression matching. If we could choose a non-regexp string in those cases, we wouldn't need to escape various characters, which would make these
ERROR
comments more readable.Example:
// ERROR \*T2 does not implement I1 \(wrong type for method foo\)\n\t\thave foo\(x int\)\n\t\twant foo\(\)
would become
// ERROR *T2 does not implement I1 (wrong type for method foo)\n\t\thave foo(x int)\n\t\twant foo()
The non-regexp pattern might be the more common case. Maybe we could have
ERROR
andERRORx
(the latter is for regexp. matching).cc: @findleyr
The text was updated successfully, but these errors were encountered: