Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types, types2: allow choice between reg. expression or not in ERROR test comments #51006

Open
griesemer opened this issue Feb 4, 2022 · 0 comments
Assignees
Labels
NeedsFix
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Feb 4, 2022

go/types and types2 (and the syntax package) rely on ERROR 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 and ERRORx (the latter is for regexp. matching).

cc: @findleyr

@griesemer griesemer added the NeedsFix label Feb 4, 2022
@griesemer griesemer added this to the Go1.19 milestone Feb 4, 2022
@griesemer griesemer self-assigned this Feb 4, 2022
@griesemer griesemer removed this from the Go1.19 milestone May 11, 2022
@griesemer griesemer added this to the Go1.20 milestone May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix
Projects
None yet
Development

No branches or pull requests

1 participant