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

types2, go/types: share tests #54511

Closed
griesemer opened this issue Aug 17, 2022 · 42 comments
Closed

types2, go/types: share tests #54511

griesemer opened this issue Aug 17, 2022 · 42 comments
Assignees
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

Share and factor out the test files used by types2 and go/types as they are almost identical.
Tracking issue for the work needed to make the files identical.

cc: @findleyr

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 17, 2022
@griesemer griesemer added this to the Go1.20 milestone Aug 17, 2022
@griesemer griesemer self-assigned this Aug 17, 2022
@gopherbot
Copy link

Change https://go.dev/cl/424537 mentions this issue: go/types: match types2 error msg formatting for conversion errors

@gopherbot
Copy link

Change https://go.dev/cl/424654 mentions this issue: cmd/compile/internal/syntax: handle missing index like in go/parser

@gopherbot
Copy link

Change https://go.dev/cl/424674 mentions this issue: go/types, types2: consolidate testdata/examples test files

@gopherbot
Copy link

Change https://go.dev/cl/424675 mentions this issue: go/types, types2: consolidate testdata/spec test files

@gopherbot
Copy link

Change https://go.dev/cl/424676 mentions this issue: cmd/compile/internal/types2: use go/types/testdata/spec tests

@gopherbot
Copy link

Change https://go.dev/cl/424714 mentions this issue: go/types: remove TODO in testdata/examples/types.go

@gopherbot
Copy link

Change https://go.dev/cl/424695 mentions this issue: cmd/compile/internal/types2: use go/types/testdata/examples tests

@gopherbot
Copy link

Change https://go.dev/cl/424818 mentions this issue: cmd/compile/internal/types2: match go/types for "..." related error msg

@gopherbot
Copy link

Change https://go.dev/cl/424855 mentions this issue: go/parser: remove import path string syntax checking

gopherbot pushed a commit that referenced this issue Aug 18, 2022
This resolves a TODO. Also, it allows go/types and types2 to use
identical test files in testdata/spec, a prerequisition for sharing
them eventually.

For #54511.

Change-Id: Ia9d11b15ada237c18b6ce8f72732f70134a1a06f
Reviewed-on: https://go-review.googlesource.com/c/go/+/424537
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 18, 2022
Instead of simply reporting an error but otherwise dropping the
index expression from the parse tree when an index is missing
(as in: x[]), create an index expression with a "bad expression"
as index. This matches the behavior of go/parser and permits the
use of the same test case for both parsers.

(It would be simpler to adjust the go/parser to match the syntax
parser's behavior, but that would break backward-compatibility
of the go/parser.)

Adjust the affected test files.

For #54511.

Change-Id: If7668973794604593e869a24b560da92e100b812
Reviewed-on: https://go-review.googlesource.com/c/go/+/424654
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Aug 18, 2022
Besides applying gofmt (which doesn't damage the tests in this case),
the ERROR comments in the types2 files now match the go/types files.
But because types2 still reports some errors are different positions,
the checking code now allows for some position discrepancy (similar
to what we do for other tests).

Except for an outstanding TODO in go/types/testdata/examples/types.go
the test files are now identical.

For #54511.

Change-Id: I5748e0f678d11c5c0bdf4fdf28bd04f0b11b5b23
Reviewed-on: https://go-review.googlesource.com/c/go/+/424674
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Aug 18, 2022
Besides applying gofmt (which doesn't damage the tests in this case),
this removes a TODO for a set of nil-related tests.

The test files are now identical.

For #54511.

Change-Id: I0a286ad607f317f43972c1f5ee741b4f5bc9576d
Reviewed-on: https://go-review.googlesource.com/c/go/+/424675
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Aug 18, 2022
Since the spec tests are now identical between the two type checkers,
remove the local copy of the spec tests and (for now) use the tests
in go/types/testdata/spec instead. Eventually we may decide to move
all tests out of the type checker directories and place them in a
shared space (e.g. internal/types/testdata).

For #54511.

Change-Id: Ibc62230553a5ff215160dcc97696b333ae9cf685
Reviewed-on: https://go-review.googlesource.com/c/go/+/424676
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
@gopherbot
Copy link

Change https://go.dev/cl/424904 mentions this issue: go/parser: match const/var decl parsing of syntax package

@gopherbot
Copy link

Change https://go.dev/cl/424905 mentions this issue: cmd/compile/internal/types2: match go/types error for invalid map key

@gopherbot
Copy link

Change https://go.dev/cl/424906 mentions this issue: go/types: match types2 error for missing index expressions

@gopherbot
Copy link

Change https://go.dev/cl/424934 mentions this issue: go/types: match types2 errors for incorrect method receiver count

gopherbot pushed a commit that referenced this issue Aug 19, 2022
Follow-up on CL 424674. With this change, the files in
testdata/examples are identical to the corresponding
files for types2.

For #54511.

Change-Id: Ic61c089bbf61492094e31057ad2635803f50a30d
Reviewed-on: https://go-review.googlesource.com/c/go/+/424714
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 19, 2022
Since the examples tests are now identical between the two type checkers,
remove the local copy of the examples tests and (for now) use the tests
in go/types/testdata/examples instead. Eventually we may decide to move
all tests out of the type checker directories and place them in a
shared space (e.g. internal/types/testdata).

For #54511.

Change-Id: Ibd8599d09e781b2219a23114b4b2049757971181
Reviewed-on: https://go-review.googlesource.com/c/go/+/424695
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Aug 19, 2022
For #54511.

Change-Id: I571680dfc25d7b7198e84e11bd311ab8b24d72d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/424818
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Aug 19, 2022
The validity of an import path string is checked by the type checker
(and possibly other tools); it doesn't need to be done by the parser.
Remove the respective code and tests.

Also, adjust a corresponding go/types test which resolves a TODO.

For #54511.

Change-Id: Id1fc80df4e3e83be3ef123da3946ccb8f759779f
Reviewed-on: https://go-review.googlesource.com/c/go/+/424855
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopherbot pushed a commit that referenced this issue Aug 19, 2022
Use same approach to parsing const and var declarations
as the syntax package. Specifically, don't complain if
the first const specification in a const declaration
doesn't have a type and initialization expression. This
removes some duplicate errors when combined with the
type checker.

Adjust corresponding type checker tests accordingly.

For #54511.

Change-Id: I96702eba51dda6b581dad44577a7f93e4c02c857
Reviewed-on: https://go-review.googlesource.com/c/go/+/424904
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Aug 19, 2022
Use "invalid" rather than "incomparable" in error message for map key
types that are not comparable. This is the original compiler error
message and many tests check for this specific message. The type
checker does provide an additional explanation if the reason for
the error is not obvious (e.g. for type parameters).

For #54511.

Change-Id: Idb76c48b4dfbfd66a7deac728a552e07f14e06d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/424905
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Aug 19, 2022
Use "middle" and "final" rather than "2nd" and "3rd" in error messages
for invalid slice expressions. This is the original compiler error
message and many tests check for this specific message.

For #54511.

Change-Id: I86eb739aa7218b7f393fab1ab402732cb9e9a1f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/424906
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Aug 19, 2022
Use "method has no receiver" and "method has multiple receivers"
in error messages for invalid receiver counts, matching the
corresponding types2 errors.

For #54511.

Change-Id: I96fc99440d6206c74e9416069db052234baa8248
Reviewed-on: https://go-review.googlesource.com/c/go/+/424934
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
@gopherbot
Copy link

Change https://go.dev/cl/425006 mentions this issue: go/types: match types2 string when printing composite literals

rajbarik pushed a commit to rajbarik/go that referenced this issue Sep 1, 2022
The change in typexpr.go matches types2 behavior.

For golang#54511.

Change-Id: I79c922a94f2ee0440c1814140935c321439c7d25
Reviewed-on: https://go-review.googlesource.com/c/go/+/425714
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
rajbarik pushed a commit to rajbarik/go that referenced this issue Sep 1, 2022
This matches types2 behavior.

For golang#54511.

Change-Id: Iea906e9fec7e334b7aa7f481de87373fa93d1c7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/425715
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@gopherbot
Copy link

Change https://go.dev/cl/427654 mentions this issue: x/tools/internal/lsp/source: disable some tests for std lib changes

@gopherbot
Copy link

Change https://go.dev/cl/427674 mentions this issue: go/types, types2: move shared tests into internal/types/testdata

gopherbot pushed a commit to golang/tools that referenced this issue Sep 1, 2022
CL 425716 changes parser behavior for incorrect code (it is more
lenient) which breaks a few lsp tests. Disable them for now so we
can submit CL 425716.

For golang/go#54511.
For golang/go#54822.

Change-Id: I00fa67e29628137f3e4e44c38e92094ea581a61b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/427654
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopherbot pushed a commit that referenced this issue Sep 1, 2022
Remove the code that verifies that an expression is a type or non-type
expression. For one, it cannot be done perfectly accurate
(e.g., consider *p which could be an indirection or a pointer type),
it also unnecessarily slows down parsing. It's simpler to leave the
verification to the type checker which has all the information needed.

Remove short compiler tests that tested the expression/type property.
Adjust a couple of go/types tests which now trigger because the parser
doesn't complain anymore.

Change file for benchmark from "parser.go" to "../printer/nodes.go"
to avoid a moving target when benchmarking.

The parser may be marginally faster when tested on nodes.go:

name          old time/op    new time/op    delta
ParseOnly-12    1.35ms ± 0%    1.31ms ± 0%   ~     (p=0.100 n=3+3)

name          old speed      new speed      delta
ParseOnly-12  39.9MB/s ± 0%  41.0MB/s ± 0%   ~     (p=0.100 n=3+3)

For #54511.

Change-Id: I9a32c24c2c6e843c3d1af4587651c352f378b490
Reviewed-on: https://go-review.googlesource.com/c/go/+/425716
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Sep 1, 2022
…bad go/defer

If the go/defer syntax is bad, using a fake CallExpr may produce
a follow-on error in the type checker. Instead store a BadExpr
in the syntax tree (since an error has already been reported).

Adjust various tests.

For #54511.

Change-Id: Ib2d25f8eab7d5745275188d83d11620cad6ef47c
Reviewed-on: https://go-review.googlesource.com/c/go/+/425675
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Sep 1, 2022
- Use "expected X" rather then "expecting X".
- Report a better error when a type argument list is expected.
- Adjust various tests.

For #54511.

Change-Id: I0c5ca66ecbbdcae1a8f67377682aae6b0b6ab89a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425734
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Sep 1, 2022
Use the go/types version of testdata/check tests where the diffs
are only in the error positions (the types2 test harness allows
for some position tolerance). Consolidate files where there are
other minor differences.

Comment out a couple of tests that are different between the two
type checkers.

With this CL, the testdata/check files are identical between the
two type checkers.

For #54511.

Change-Id: Ibdff2ca3ec9bdaca3aa84029a7883bb83d2d2060
Reviewed-on: https://go-review.googlesource.com/c/go/+/425735
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Sep 1, 2022
Since the check tests are now identical between the two type checkers,
remove the local copy of the check tests and (for now) use the tests
in go/types/testdata/check instead. Eventually we may decide to move
all tests out of the type checker directories and place them in a
shared space (e.g. internal/types/testdata).

For #54511.

Change-Id: Id3a97593f6c705c5eda4566089ddc7aeb7b47337
Reviewed-on: https://go-review.googlesource.com/c/go/+/425736
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Sep 1, 2022
Logic matches the code in the syntax package.
This error was missing from go/parser and go/types.
Added some tests.

For #54511.

Change-Id: I418de4bd4c7169457b424366caae70227a92a761
Reviewed-on: https://go-review.googlesource.com/c/go/+/425795
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Sep 1, 2022
Instead of checking at parse-time that the LHS of a short variable
declaration contains only identifiers, leave the check to the the
type checker which tests this already.

This removes a duplicate error and matches the behavior of the
syntax package.

For #54511.

Change-Id: I4c68f2bd8a0e015133685f9308beb98e714a83fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/426476
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
@gopherbot
Copy link

Change https://go.dev/cl/427736 mentions this issue: tools/gopls/internal/regtest/diagnostics: handle new error message

gopherbot pushed a commit to golang/tools that referenced this issue Sep 2, 2022
Pending CL 426477 changes go/types error messages containing the phrase:

	type parameters require

to:

	type parameter requires

Adjust diagnostics test accordingly (note that regular expressions are
currently not supported).

For golang/go#54511.

Change-Id: I561cb940a41cb6cc949c44e0d4b8f009336a46cd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/427736
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Sep 2, 2022
This matches the majority use case as well as types2.

For #54511.

Change-Id: If800afc35db8d32cca8329ed9d6a80b4a15c4878
Reviewed-on: https://go-review.googlesource.com/c/go/+/426477
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Sep 2, 2022
…iations

Also: add a missing test.

For #54511.

Change-Id: Ie9828c6ba5186feb5a79db0d58beb2cda2beae56
Reviewed-on: https://go-review.googlesource.com/c/go/+/426478
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Sep 2, 2022
For #54511.

Change-Id: I317c5f9beed7f1de4979ec12c6ec8d5de71bac1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/426554
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Sep 2, 2022
This results in better error recovery and allows us to use the
same tests for go/types and types2.

For #54511.

Change-Id: Ic11a9dafb8c62e0cb952b3924d55a28b438241c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/427154
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Sep 2, 2022
This is a port of CL 427156 from the syntax package's parser
to go/parser.

While at it, remove an unused token.Pos parameter from
parseSpecFunction and dependent declarations.

Also, consolidate the respective test file.

For #54511.

Change-Id: Id6a28eb3d23a46fa5fa1d85d2c4e634b7015513c
Reviewed-on: https://go-review.googlesource.com/c/go/+/427157
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopherbot pushed a commit that referenced this issue Sep 2, 2022
For #54511.

Change-Id: I1ae391b5f157bf688f9f31b1577c90e681b6df26
Reviewed-on: https://go-review.googlesource.com/c/go/+/426655
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Sep 2, 2022
Rename .../issue46404.go1 to .../issue46404.go so that it is
not skipped anymore when running tests, and copy for types2.

Disable the code for now due to a difference in error
reporting due to the slightly different handling of index
expressions. This allows us to make progress with test
consolidation.

For #54511.

Change-Id: Ib5c9ffa49b1b24ec680ddb5001bc3dcb1df7eb1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/426656
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Sep 2, 2022
Report a syntax error if the first element of a type instance is
not actually a type (but some other expression), rather then relying
on the type checker error in this case. This matches the behavior of
go/parser. Adjust the corresponding types2 test case.

For #54511.

Change-Id: Ia82b3a7d444738c56955ce6c15609470b3431fd1
Reviewed-on: https://go-review.googlesource.com/c/go/+/426657
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Sep 2, 2022
Use the go/types version of testdata/fixedbugs tests where diffs
are only in the error positions (the types2 test harness allows
for some position tolerance). Consolidate files where there are
other minor differences.

Add files to respective directories if they only existed for
one of the type checkers.

Move types2-only test issue47996.go out of testdata/fixedbugs
into testdata. Making it work for both type checkers requires
some more work.

With this CL, the testdata/fixedbugs files are identical between
the two type checkers.

For #54511.

Change-Id: I0d67f0db75ad1743c62da9181a6d0032c8bdb728
Reviewed-on: https://go-review.googlesource.com/c/go/+/427236
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopherbot pushed a commit that referenced this issue Sep 2, 2022
Since the fixedbugs tests are now identical between the two type checkers,
remove the local copy of the fixedbugs tests and (for now) use the tests
in go/types/testdata/fixedbugs instead. Eventually we may decide to move
all tests out of the type checker directories and place them in a
shared space (e.g. internal/types/testdata).

For #54511.

Change-Id: I451c20c784710c36fa50b1d24ac97af554c572af
Reviewed-on: https://go-review.googlesource.com/c/go/+/426658
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopherbot pushed a commit that referenced this issue Sep 2, 2022
Establish testdata/local directory for tests that are not (yet)
shared between the go/types and types2. Move issue47996.go into
that directory.

For #54511.

Change-Id: I274b119990a93cc3657bdddc5246948699226c21
Reviewed-on: https://go-review.googlesource.com/c/go/+/426660
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
gopherbot pushed a commit that referenced this issue Sep 2, 2022
CL 425735 consolidated the testdata/check/shifts.go files between
go/types and types2. Because some shifts don't work correctly with
types2, the corresponding tests were disabled in the shared file.
Make sure we keep testing those shifts for go/types by adding a
local test file.

For #52080.
For #54511.

Change-Id: I53507e535bf83b204eaf18fc6c2efefcebf5ebf7
Reviewed-on: https://go-review.googlesource.com/c/go/+/426661
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
@golang golang locked and limited conversation to collaborators Sep 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants