1
0
mirror of https://github.com/golang/go synced 2024-11-17 07:14:45 -07:00
Commit Graph

51366 Commits

Author SHA1 Message Date
Ian Lance Taylor
d588f48770 runtime: change sys.PtrSize to goarch.PtrSize in comments
The code was updated, the comments were not.

Change-Id: If387779f3abd5e8a1b487fe34c33dcf9ce5fa7ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/383495
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-05 06:14:58 +00:00
Robert Griesemer
7c9885def5 go/types, types2: use identical missingMethod in both type checkers
Further simplify and regularize Checker.missingMethod and use the
same code in both type checkers.

This enables case-folding lookup for go/types.

Adjusted test case that looks for alternative methods.

Change-Id: I5b8cc598c295c329ff93b1c65787cc6140f0900e
Reviewed-on: https://go-review.googlesource.com/c/go/+/382858
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-02-04 23:42:58 +00:00
Robert Griesemer
aadbfc30af go/types, types2: always use missingMethodReason in checker.Implements
Remove special case where we don't have a *Checker and always use
Checker.missingMethodReason in Checker.implements.

Look for zero methods rather than empty interface to exit early
from Checker.missingMethod, and remove the extra test in
Checker.implements.

With this change we get consistent and more detailed error messages
from all places where we do a form of the "implements" test.

To make this possible, allow for the receiver to be nil in
- Checker.sprintf
- Checker.missingMethodReason
- Checker.interfacePtrError
- Checker.funcString

Allowing Checker.sprintf with nil Checker permits further simplifying
in a couple of places.

Change-Id: I0ea7178c9efbcd4a25ded2a66e2b058db52dc4d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/383054
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-02-04 23:42:54 +00:00
Robert Griesemer
f1903fd4ec go/types, types2: simplify Checker.typeAssertion, use same code in both type checkers
- Remove the xtyp argument from the Checker.typeAssertion parameter
  list; it was confusing and not needed. Adjusted call sites.

- Simplify logic in Checker.typeAssertion.

- Use the same code in both types2 and go/types, specifically
  use the same error positions.

- Adjust error messages as needed.

This removes another subtle discrepancy between types2 and go/types.
The go/types error messages don't have the have/want appendix for
the affected error messages yet because we don't use case folding
in lookups yet.

Change-Id: Id39f5c473da36c9baad60082f85cf1f34dc26c50
Reviewed-on: https://go-review.googlesource.com/c/go/+/383014
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-02-04 23:42:50 +00:00
Robert Griesemer
ef843ae49c go/types, types2: simplify missingMethodReason
Added a funcString helper so we don't need to rewrite strings
with strings.Replace.

Use compiler format for error message about wrong method type;
this removes another unnecessary variation.

Simplify conditions for pointer-to-interface related error:
if one of the involved types is an interface pointer, it can't
have any methods.

Rewrite logic so we don't need all the else-if branches.

Adjusted a test case for types2 accordingly. The go/types version
of this test case has a different error because the implementation
of Checker.typeAssertion is different in the two type checkers
(the types2 version gives errors closer to the 1.17 compiler).

Change-Id: I19e604d7063c3e31e8290bd78384a9f38bb0d740
Reviewed-on: https://go-review.googlesource.com/c/go/+/382694
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-02-04 23:42:47 +00:00
Robert Griesemer
d9eba71a64 go/types, types2: fix bug in types2.MissingMethod
Because Checker.missingMethod also looks up methods matching
matching case-folded names, when Checker.missingMethod returns
an alternative method, that method does not automatically have
the wrong type. It may be a method with a different name.

Adjust types2.MissingMethod to check the alternative method
name before reporting a wrong type.

Add API test that verifies (now correct) behavior for this
case.

Ported the code also to go/types, though it was not a bug
there yet because looking up with case-folding is not yet
enabled.

Change-Id: Iaa48808535c9265a9879338ea666c6c021e93a2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/382634
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-02-04 23:42:43 +00:00
Robert Griesemer
727790a2fd go/types, types2: remove superflous type parameter length checks
There is no need to check for length equality of type parameter
lists in Checker.missingMethod: the Identical predicate does
this check. Furthermore, we don't have methods with their own
type parameters. Remove the unnecessary (duplicate) code.

Also, update doc string on missingMethod and rename the 2nd
result parameter for clarity, and clarify internal comments.

For go/types, include the same case-folding code as for types2
but leave it disabled or now. Adjust any other differences in
the missingMethod implementation.

With this change, the types2 and go/types code of missingMethod
is identical again except for the disabled case-folding lookup.

No functionality changes.

Preparation for fixing some of the outstanding error reporting issues.

Change-Id: I4778d006c17f4e084ecc2cac7386c68e86aa49eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/382614
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-02-04 23:42:38 +00:00
Robert Griesemer
d5bd3f9a6c go/types, types2: use same method lookup code in both type checkers
types2 has some code to handle case-folding when doing method lookups
which was missing in go/types. This change is a first step to match
the implementations. Specifically:

In types2:
- remove the lookupMethodFold names in favor of just lookupMethod,
  but with the foldCase flag (e.g., instead if lookupMethodFold,
  we just use lookupMethod)
- rename checkFold to foldCase everywhere
- add foldCase parameter where it was missing
- moved foldCase paremeter to the end in lookupFieldOrMethod
- no functionality changes

In go/types:
- match function signatures with types2 use
- always provide false as argument for foldCase for now
- no functionality changes

Preparation for fixing some of the outstanding error reporting issues.

Change-Id: If129a5feb89ddf96a3596e8d73b23afa591875a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/382461
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-02-04 23:42:35 +00:00
Robert Griesemer
63e833154c go/types, types2: better error messages for expression switches
Fixes #50965.

Change-Id: I61a74bdb46cf5e72ab94dbe8bd114704282b6211
Reviewed-on: https://go-review.googlesource.com/c/go/+/382354
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-02-04 23:42:29 +00:00
Robert Griesemer
e052044d6b go/types, types2: better error messages for comparisons
Refactor Checker.comparison such that its logic is easier to reason
about and so that special cases can be handled more directly.

Use the appropriate operand (of 1st or 2nd operand) for error
reporting (position and type), rather than always using the
first operand.

Use an extra parameter to indicate a switch case
comparison; in this case the error is always reported at
the position of the first operand. (The error messages are
not yet adjusted for switches; see next CL.)

Introduce a new kindString function which is used to print simplified
types in error messages (related to comparisons only): instead of
printing the details of a struct type, we just print "struct" where
the details are not relevant. This matches the 1.17 compiler behavior.

Added a "reportf" parameter to the internal comparable function so we
can report an error cause in addition to the boolean result. Rather
than passing a *string for cause, we pass a function to record the
cause so that we can use the *Checker context for printing (needed
for proper type qualification). This mechanism reports the same
details now as the 1.17 compiler.

Adjusted various tests as needed added new test files.

Fixes #50918.

Change-Id: I1f0e7af22f09db4d31679c667c71a9038a8dc9d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/381964
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-02-04 23:42:25 +00:00
Katie Hockman
f9763a648b internal/fuzz: change meaning of "total" in output
Fixes #51023

Change-Id: I7dd9f7c696e15ba9c6c887d4c4e0f4d281a82b17
Reviewed-on: https://go-review.googlesource.com/c/go/+/383414
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-04 22:34:05 +00:00
Katie Hockman
56a5397248 testing: remove TODO and link to fuzz docs
Change-Id: I3f5ee9629b0b0f3f29a021a656dbf3bca27e582d
Reviewed-on: https://go-review.googlesource.com/c/go/+/383415
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-04 22:27:25 +00:00
Brandon Bennett
2aafd9ea17 cmd/go: preserve LIBRARY_PATH and C_INCLUDE_PATH for script tests
In bespoke build environments default libraries may be specificied with
LIBRARY_PATH, C_INCLUDE_PATH enviroment variables to overide the system
(i.e glibc). Allow them though to allow cgo testing of these enviroments.

Fixes #50985

Change-Id: I7497a7715d9b635a6ae97efaab94a7ff01cdf8e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/383334
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Trust: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-04 20:50:14 +00:00
Ian Lance Taylor
02224c8ce4 cmd/go: accept "-F dir" in compiler flags
Fixes #51008

Change-Id: I5e47c7be59d4aae1d5059d99231422212cffa23a
Reviewed-on: https://go-review.googlesource.com/c/go/+/383217
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-02-04 20:44:18 +00:00
Kevin Burke
6e56fcedfb internal/nettrace: fix spelling error
Change-Id: Ibf51c0687197c0d791916b21cba7f8408aa5300a
Reviewed-on: https://go-review.googlesource.com/c/go/+/383216
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Kevin Burke <kevin@burke.dev>
2022-02-04 20:20:02 +00:00
Robert Findley
4afcc9f35e go/parser, go/types: don't parse type parameters on methods
The go/parser package is updated to report an error on method type
parameters, and to not store them in the AST. Tests are updated
accordingly, and error messages are normalized accross go/parser and the
compiler syntax package.

Before this CL, go/parser would parse type parameters on method
declarations and interface methods, leaving it to go/types to complain.
There are several problems with this:

- Interface Methods and Method declarations do not have type parameters
  in the spec. We try to align the parser with the productions in the
  spec.
- Parsing method type parameters means that downstream libraries
  (go/doc, go/format, etc.) theoretically need to handle them, even
  though they are not part of the language.
- Relatedly, go/types has inconsistent handling of method type
  parameters due to support being removed, leading to the crasher in
  #50427.

It is more consistent and safer to disallow type parameters on methods
in the parser.

Fixes #50427

Change-Id: I555766da0c76c4cf1cfe0baa9416863088088b4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/382538
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-04 00:43:57 +00:00
Keith Randall
4e2410617d cmd/compile: restrict generics test to -G=3
Change-Id: Ifdb4f4f4fab8d45847ca525198b3960f87799f0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/383034
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
2022-02-03 23:55:05 +00:00
Ian Lance Taylor
248ad855b7 misc/cgo/test: disable unhelpful GCC warning
GCC 9 warns about a change in the ABI of passing structs with bitfields,
but we don't care.

Fixes #50987

Change-Id: Ica658d04172a42a7be788f94d31a714bb8c4766f
Reviewed-on: https://go-review.googlesource.com/c/go/+/382956
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>
2022-02-03 22:55:24 +00:00
Roland Shoemaker
896df422a7 crypto/x509: support NumericString in DN components
Fixes #48171

Change-Id: Ia2e1920c0938a1f8659935a4f725a7e5090ef2c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/347034
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2022-02-03 19:55:40 +00:00
Keith Randall
1ab8273718 cmd/compile: ensure size is computed for shape types
Fixes #50993

Change-Id: I5f1bf5a8375c3da3203083b11de26962523ccb36
Reviewed-on: https://go-review.googlesource.com/c/go/+/382874
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
2022-02-03 18:23:55 +00:00
Filippo Valsorda
7f9494c277 crypto/elliptic: make IsOnCurve return false for invalid field elements
Thanks to Guido Vranken for reporting this issue.

Fixes #50974
Fixes CVE-2022-23806

Change-Id: I0201c2c88f13dd82910985a495973f1683af9259
Reviewed-on: https://go-review.googlesource.com/c/go/+/382455
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
2022-02-03 17:24:54 +00:00
Roland Shoemaker
0003d9da09 doc/go1.18: add crypto/x509 verifier notes
Change-Id: If3e835e868ae695ba232b57096c135ce2e73305b
Reviewed-on: https://go-review.googlesource.com/c/go/+/365835
Trust: Roland Shoemaker <roland@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2022-02-03 17:15:11 +00:00
Michael Pratt
f9b761aa76 runtime: regression test for issue 50936
Add a regression test for issue 50936 which coerces the runtime into
frequent execution of the cgocall dropg/execute curg assignment race by
making many concurrent cgo calls eligible for P retake by sysmon. This
results in no P during exitsyscall, at which point they will update curg
and will crash if SIGPROF arrives in between updating mp.curg and
mp.curg.m.

This test is conceptually similar to the basic cgo callback test in
aprof.go but with additional concurrency and a sleep in C.

On my machine this test fails ~5% of the time prior to CL 382079.

For #50936.

Change-Id: I21b6c7f2594f9a615a64580ef70a88b692505678
Reviewed-on: https://go-review.googlesource.com/c/go/+/382244
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-02-03 16:58:29 +00:00
Bryan C. Mills
bec8a108b3 runtime: skip TestSegv failures with "morestack on g0" on darwin/amd64
This failure mode has been present since at least 2020-06-08. We have
enough information to diagnose it, and further failures don't seem to
be adding any new information at this point: they can only add noise,
both on the Go project's builders and in users' own modules (for
example, when run as part of 'go test all').

For #39457

Change-Id: I2379631da0c8af69598fa61c0cc5ac0ea6ba8267
Reviewed-on: https://go-review.googlesource.com/c/go/+/382395
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-02-03 16:53:55 +00:00
Bryan C. Mills
fa4d9b8e2b cmd/go/internal/modfetch: do not short-circuit canonical versions
Since at least CL 121857, the conversion logic in
(*modfetch).codeRepo.Stat has had a short-circuit to use the version
requested by the caller if it successfully resolves and is already
canonical.

However, we should not use that version if it refers to a branch
instead of a tag, because branches (unlike tags) usually do not refer
to a single, stable release: a branch named "v1.0.0" may be for the
development of the v1.0.0 release, or for the development of patches
based on v1.0.0, but only one commit (perhaps at the end of that
branch — but possibly not even written yet!) can be that specific
version.

We already have some logic to prefer tags that are semver-equivalent
to the version requested by the caller. That more general case
suffices for exact equality too — so we can eliminate the
special-case, fixing the bug and (happily!) also somewhat simplifying
the code.

Fixes #35671
Updates #41512

Change-Id: I2fd290190b8a99a580deec7e26d15659b58a50b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/378400
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-03 16:42:26 +00:00
Robert Griesemer
b00447038a go/types, types2: shorter list for 2nd phase of function type inference
In the 2nd phase of function argument type inference we only
consider parameters with types that are single type parameters.
Thus there is no need to collect anything else in the first
phase.

This matches the algorithm description in the forthcoming spec
more closely.

Change-Id: Ie5c29f30ff43b1e37d719ecbe1688b50ed2177f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/381554
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-02-03 16:13:58 +00:00
Bryan C. Mills
475ce826b7 net: remove an arbitrary timeout in TestUDPReadSizeError
Looking at the condition actually exercised by the test it seems
unnecessary: assuming that the Write succeeds (checked earlier in the
test), the Read must have a nonzero number of bytes available to read
immediately. (That is not the case in TestUDPZeroByteBuffer, from
which this test appears to have been derived.)

Fixes #50870

Change-Id: Ia6040a2d5dc320f0b86ec9d6f6b91dc72e8f3b84
Reviewed-on: https://go-review.googlesource.com/c/go/+/382537
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-02-03 05:57:46 +00:00
Bryan C. Mills
d0a0606841 cmd/go: fail 'go work' subcommands with a more helpful error if no go.work file exists
Otherwise, the failure mode for these subcommands refers to an empty file path:
	go: open : no such file or directory

Fixes #50964

Change-Id: I8776431a294d2b2246d7d147b6059054f31bc255
Reviewed-on: https://go-review.googlesource.com/c/go/+/382246
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2022-02-03 05:54:02 +00:00
Bryan C. Mills
54b2a75406 cmd/go/internal/modload: skip deleted entries in UpdateWorkFile
Fixes #50958

Change-Id: I25b4f34bea7705525217296471ce97e6a2ab99f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/382245
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2022-02-03 05:53:37 +00:00
Ian Lance Taylor
1c6426505e net/netip: correct ipv6 address in ParsePrefix comment
Fixes #50950

Change-Id: Iea94dba6e57d7e7985d4ae06a9b59ad126568599
Reviewed-on: https://go-review.googlesource.com/c/go/+/382294
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2022-02-03 03:21:15 +00:00
Ian Lance Taylor
070951c5dc constraints: remove package
It has moved to golang.org/x/exp/constraints. Perhaps it will move
back to the standard library in a future release.

For golang/go#45458
Fixes golang/go#50792

Change-Id: I93aa251a7afe7b329a3d3faadc0c5d6388b1f0e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/382460
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-03 03:13:33 +00:00
Filippo Valsorda
8384fe86a5 crypto/ecdsa,crypto/elliptic: update docs and spec references
crypto/ecdsa was long overdue a cleanup. Bump the FIPS 186 version, and
make sure we consistently reference that and SEC 1, not the paywalled
ANSI standard.

Change-Id: Idd90bd6c14b334941fdcd829d89b796a60a8b174
Reviewed-on: https://go-review.googlesource.com/c/go/+/352529
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2022-02-03 01:07:27 +00:00
Filippo Valsorda
a9384eef7a doc/go1.18: add crypto/tls, crypto/x509, and crypto/elliptic release notes
Updates #45428
Updates #41682

Change-Id: I811bc4f8ec8de6b6db6a2917e265a72134a05e78
Reviewed-on: https://go-review.googlesource.com/c/go/+/382454
Trust: Filippo Valsorda <filippo@golang.org>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2022-02-02 23:37:18 +00:00
Ian Lance Taylor
53d6a725f8 runtime: update _defer comment to not mention freedefer
CL 339669 changed freedefer to not mention every field of _defer,
so no need to call it out in the _defer comment.

Change-Id: Id8b67ba2298685f609bf901b5948fd30666bd6e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/382251
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2022-02-02 21:12:39 +00:00
Robert Findley
77eff30ec0 go/types, types2: add a const to control recursion panics in unification
Add a panicAtUnificationDepthLimit const to replace the use of the debug
const to control whether to panic when the unification recursion depth
is reached. Our tests should pass when debug==true.

Change-Id: I58847f49d66010bd4ca01c0408ec10acac95cba6
Reviewed-on: https://go-review.googlesource.com/c/go/+/382534
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-02 19:37:44 +00:00
pierwill
edbe4742a2 cmd/compile: edit README
Make some small edits for clarification of important concepts.

Change-Id: I1f78f2a59489ac71e3948dc924641540508613ce
GitHub-Last-Rev: 1819140ee6
GitHub-Pull-Request: golang/go#50980
Reviewed-on: https://go-review.googlesource.com/c/go/+/382458
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-02-02 19:20:26 +00:00
Katie Hockman
9784ef8ab1 internal/fuzz: small cleanups
Change-Id: I9fc12f352d57db776d176990277e104f64f9908d
Reviewed-on: https://go-review.googlesource.com/c/go/+/382238
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-02 16:21:08 +00:00
Ian Lance Taylor
36b81acfa1 cmd/go: document that GOENV=off disables the default config file
Fixes #46840

Change-Id: Icc5475e312003e316dc039413a35089485163ba6
Reviewed-on: https://go-review.googlesource.com/c/go/+/381894
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Trust: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-01 21:46:52 +00:00
Bryan C. Mills
a6a7c7a1fd cmd/go: add detail to test failures
For #50892

Change-Id: I14ff1c43b39687a0ba5e668ee962cecfb49e4beb
Reviewed-on: https://go-review.googlesource.com/c/go/+/381836
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-01 20:55:43 +00:00
Bryan C. Mills
5522f8c8e6 cmd/go: fix relative-path normalization in go.work files
We had been statting 'dir' instead of 'absDir', which statted the
wrong directory if 'dir' was made relative to the location of the
go.work file and that location was different from the current working
directory.

While we're here, I also noticed some other dir-vs.-absDir
discrepancies. The haveDirs map had assumed relative, slash-separated
filesystem paths, but absolute paths on Windows are not
slash-separated and we do retain those. Moreover, if users hand-edit
the go.work file they may introduce non-canonical paths.
I have changed the haveDirs logic to retain absolute paths in their
platform-specific forms, and to call DropUse with the original path
from the go.work file instead of the newly-resolved path.

Fixes #50931
Updates #48257

Change-Id: Ib0a46179aa20c99f045aac5c7c02dbb55da455c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/382240
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-01 20:35:43 +00:00
Bryan C. Mills
e22a14b7eb cmd/go: add missing newlines in TestScript '? cmp' output
Change-Id: I0314c2e9073b162119060a23c5eee9a78ca08ebf
Reviewed-on: https://go-review.googlesource.com/c/go/+/382239
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-02-01 19:09:20 +00:00
Robert Griesemer
a42bbf47d6 doc/go1.18: explain changes to compiler error messages
For #47694.
For #50954.

Change-Id: I3789e145d64025fe2bf787fa5d01a21832903586
Reviewed-on: https://go-review.googlesource.com/c/go/+/381968
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-02-01 18:15:11 +00:00
Robert Griesemer
125c5a3d69 doc/go1.18: document restrictions for real, imag, complex
For #47694.
For #50912.
For #50937.

Change-Id: I3fae6c8dbbd61a45e669b8fb0c18ac76f2183963
Reviewed-on: https://go-review.googlesource.com/c/go/+/381967
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-02-01 18:15:07 +00:00
Dan Scales
902dc38212 go/types, types2: tweak missingMethodReason logic to improve message
This makes the error case pointed out in the issue like the current
message in Go 1.17 or -G=0 mode. The priority is to point out the
similar but wrong method name, rather than a difference in type.

Made changes to both cmd/compile/internal/types2 and go/types.
Added in a missing tab in an error message in go/types.

At the same time, removed the extra "at info" on the have lines (and
pointer receiver lines) of error messages, as requested in #50907.

Fixes #50816
Fixes #50907

Change-Id: I04f8151955bdb6192246cbcb59adc1c4b8a2c4e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/381774
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-01 16:52:46 +00:00
Roland Shoemaker
93fe469de5 internal/fuzz: properly handle duplicates during cache loading
When loading the corpus, if the cache contained an entry which was a
duplicate of an entry added using f.Add, coordinator.addCorpusEntries
would return early, ignoring everything after this entry in the cache.

Instead, skip duplicates as intended, and continue to load the rest of
the cache.

Fixes #50913

Change-Id: I3a64b93cbb217c5c364a9f8d0005752e9e9d10ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/381960
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-01 16:10:04 +00:00
Bryan C. Mills
f1e7dcb49c cmd/go/internal/workcmd: fix typo in help string
Fixes #50945

Change-Id: Ib6251a5be09f4c6ba428ef4c97fe23ebffca3506
Reviewed-on: https://go-review.googlesource.com/c/go/+/382118
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-02-01 15:40:31 +00:00
Robert Griesemer
9152e21132 spec: add section on comparable constraint
For #50646.
Fixes #50791.

Change-Id: I8fec25ae3f0280c5b5a778011d23842b886ba79e
Reviewed-on: https://go-review.googlesource.com/c/go/+/381896
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-02-01 15:39:16 +00:00
Robert Griesemer
4fea5935f5 go/types, types2: disallow real, imag, complex on type parameters
We can type-check these fine but the API implications are unclear.

Fixes #50912.
For #50937.

Change-Id: If29bbb4a257ff6a85e3bfcd4755fd8f90c80fb87
Reviewed-on: https://go-review.googlesource.com/c/go/+/382116
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-02-01 01:07:25 +00:00
Robert Griesemer
eab9a77a60 go/types, types2: fix unification code for defined types
Fixes #50929.

Change-Id: I65b8eaf5e4b423839bc53c7b1db3679961498c8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/382076
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-01-31 23:15:54 +00:00
Ian Lance Taylor
d3f5cf9d28 cmd/go: update go work edit -json types to final version
For #45713

Change-Id: Ia55a96702b99cccaf5d96c2125ee513700658444
Reviewed-on: https://go-review.googlesource.com/c/go/+/381874
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Trust: Michael Matloob <matloob@golang.org>
2022-01-31 22:55:32 +00:00