Skip to content

Commit 8cfbea8

Browse files
committed
chore: merge golang master
2 parents cb8ccea + 01d183b commit 8cfbea8

323 files changed

Lines changed: 76534 additions & 36052 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

doc/go_spec.html

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--{
22
"Title": "The Go Programming Language Specification",
3-
"Subtitle": "Language version go1.27 (April 9, 2026)",
3+
"Subtitle": "Language version go1.27 (May 26, 2026)",
44
"Path": "/ref/spec"
55
}-->
66

@@ -1987,6 +1987,13 @@ <h3 id="Assignability">Assignability</h3>
19871987
<code>x</code> <a href="#Implementing_an_interface">implements</a> <code>T</code>.
19881988
</li>
19891989
<li>
1990+
<code>x</code> is a (possibly partially instantiated) generic function, <code>T</code>
1991+
is a function type, and any type arguments not provided explicitly for <code>x</code>
1992+
can be <a href="#Type_inference">inferred</a> such that (after full instantiation)
1993+
<code>x</code> and <code>T</code> have identical underlying types
1994+
[<a href="#Go_1.27">Go 1.27</a>].
1995+
</li>
1996+
<li>
19901997
<code>x</code> is the predeclared identifier <code>nil</code> and <code>T</code>
19911998
is a pointer, function, slice, map, channel, or interface type,
19921999
but not a type parameter.
@@ -2947,7 +2954,7 @@ <h3 id="Function_declarations">Function declarations</h3>
29472954

29482955
<p>
29492956
If the function declaration specifies <a href="#Type_parameter_declarations">type parameters</a>,
2950-
the function name denotes a <i>generic function</i>.
2957+
the function name denotes a <i>generic function</i> [<a href="#Go_1.18">Go 1.18</a>].
29512958
A generic function must be <a href="#Instantiations">instantiated</a> before it can be
29522959
called or used as a value.
29532960
</p>
@@ -3076,7 +3083,7 @@ <h3 id="Method_declarations">Method declarations</h3>
30763083
<p>
30773084
If the method declaration specifies <a href="#Type_parameter_declarations">type parameters</a>
30783085
(possibly in addition to type parameters declared by the receiver specification), the method name denotes
3079-
a <i>generic method</i>.
3086+
a <i>generic method</i> [<a href="#Go_1.27">Go 1.27</a>].
30803087
Like a generic function, a generic method must be <a href="#Instantiations">instantiated</a> before it can
30813088
be called or used as a value.
30823089
</p>
@@ -4378,7 +4385,7 @@ <h3 id="Instantiations">Instantiations</h3>
43784385

43794386
<p>
43804387
A generic function, method, or type is <i>instantiated</i> by substituting <i>type arguments</i>
4381-
for the type parameters [<a href="#Go_1.18">Go 1.18</a>].
4388+
for the type parameters [<a href="#Go_1.18">Go 1.18</a>][<a href="#Go_1.27">Go 1.27</a>].
43824389
Instantiation proceeds in two steps:
43834390
</p>
43844391

@@ -4575,11 +4582,16 @@ <h3 id="Type_inference">Type inference</h3>
45754582
</p>
45764583

45774584
<p>
4578-
Type inference supports calls of generic functions and assignments
4579-
of generic functions to (explicitly function-typed) variables.
4580-
This includes passing generic functions as arguments to other
4581-
(possibly also generic) functions, and returning generic functions
4582-
as results.
4585+
Type inference supports calls of generic functions and any use of
4586+
a generic function in a context where the function must be
4587+
<a href="#Assignability">assignable</a> to a (non-generic)
4588+
function type.
4589+
The latter includes assigning a generic function to a variable
4590+
(including passing it as an argument to another function),
4591+
converting a generic function to a function type, and others.
4592+
</p>
4593+
4594+
<p>
45834595
Type inference operates on a set of equations specific to each of
45844596
these cases.
45854597
The equations are as follows (type argument lists are omitted for clarity):
@@ -4588,12 +4600,12 @@ <h3 id="Type_inference">Type inference</h3>
45884600
<ul>
45894601
<li>
45904602
<p>
4591-
For a function call <code>f(a<sub>0</sub>, a<sub>1</sub>, …)</code> where
4603+
In a function call <code>f(a<sub>0</sub>, a<sub>1</sub>, …)</code> where
45924604
<code>f</code> or a function argument <code>a<sub>i</sub></code> is
45934605
a generic function:
45944606
<br>
45954607
Each pair <code>(a<sub>i</sub>, p<sub>i</sub>)</code> of corresponding
4596-
function arguments and parameters where <code>a<sub>i</sub></code> is not an
4608+
function arguments and parameters of <code>f</code>where <code>a<sub>i</sub></code> is not an
45974609
<a href="#Constants">untyped constant</a> yields an equation
45984610
<code>typeof(p<sub>i</sub>) ≡<sub>A</sub> typeof(a<sub>i</sub>)</code>.
45994611
<br>
@@ -4605,19 +4617,10 @@ <h3 id="Type_inference">Type inference</h3>
46054617
</li>
46064618
<li>
46074619
<p>
4608-
For an assignment <code>v = f</code> of a generic function <code>f</code> to a
4609-
(non-generic) variable <code>v</code> of function type:
4610-
<br>
4611-
<code>typeof(v) ≡<sub>A</sub> typeof(f)</code>.
4612-
</p>
4613-
</li>
4614-
<li>
4615-
<p>
4616-
For a return statement <code>return …, f, … </code> where <code>f</code> is a
4617-
generic function returned as a result to a (non-generic) result variable
4618-
<code>r</code> of function type:
4620+
In a context where a generic function <code>f</code> must be
4621+
<a href="#Assignability">assignable</a> to a (non-generic) function type <code>T</code>:
46194622
<br>
4620-
<code>typeof(r) ≡<sub>A</sub> typeof(f)</code>.
4623+
<code>typeof(f) ≡<sub>A</sub> T</code>.
46214624
</p>
46224625
</li>
46234626
</ul>
@@ -8839,6 +8842,10 @@ <h4 id="Go_1.24">Go 1.24</h4>
88398842
<h4 id="Go_1.27">Go 1.27</h4>
88408843
<ul>
88418844
<li>
8845+
Function <a href="#Type_inference">type inference</a> applies in all
8846+
<a href="#Assignability">assignment contexts</a> involving functions.
8847+
</li>
8848+
<li>
88428849
A <a href="#Method_declarations">method declaration</a> may declare
88438850
<a href="#Type_parameter_declarations">type parameters</a>.
88448851
</li>

doc/godebug.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ Go 1.27 removed the `tls10server` setting, as noted in the [Go 1.22](#go-122) se
168168

169169
Go 1.27 removed the `x509keypairleaf` setting, as noted in the [Go 1.23](#go-123) section.
170170

171+
Go 1.27 removed the `asynctimerchan` setting, as noted in the [Go 1.23](#go-123) section.
172+
171173
Go 1.27 added a new `htmlmetacontenturlescape` setting that controls whether
172174
html/template will escape URLs in the `url=` portion of the content attribute of
173175
HTML meta tags. The default `htmlmetacontentescape=1` will cause URLs to be
@@ -347,7 +349,7 @@ Go 1.23 changed the channels created by package time to be unbuffered
347349
(synchronous), which makes correct use of the [`Timer.Stop`](/pkg/time/#Timer.Stop)
348350
and [`Timer.Reset`](/pkg/time/#Timer.Reset) method results much easier.
349351
The [`asynctimerchan` setting](/pkg/time/#NewTimer) disables this change.
350-
There are no runtime metrics for this change,
352+
There are no runtime metrics for this change.
351353
This setting will be removed in Go 1.27.
352354

353355
Go 1.23 changed the mode bits reported by [`os.Lstat`](/pkg/os#Lstat) and [`os.Stat`](/pkg/os#Stat)

doc/next/2-language.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
11
## Changes to the language {#language}
22

3+
<!-- go.dev/issue/9859 -->
34

5+
A key in a [struct literal](/ref/spec#Composite_literals) may be any
6+
valid [field selector](/issue/9859) for the struct type, not just a
7+
(top-level) field name of the struct.
8+
9+
<!-- go.dev/issue/77273 -->
10+
11+
Go 1.27 now supports [generic methods](/issue/77273):
12+
a [method declaration](/ref/spec#Method_declarations) may declare its own
13+
[type parameters](/ref/spec#Type_parameter_declarations).
14+
This widely anticipated change allows adding generic functions within
15+
the namespace of a particular data type where before one had to declare
16+
such functions with a scope of the entire package.
17+
Note that methods of [interfaces](/ref/spec#Interface_types) may not declare
18+
type parameters nor can interface types be implemented by generic methods.
19+
20+
<!-- go.dev/issue/77245 -->
21+
22+
Function type inference has been [generalized](/issue/77245) to apply in all
23+
contexts where a generic function is [assigned](/ref/spec#Assignability) to a
24+
variable of (or converted to) a matching function type.

doc/next/4-runtime.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ the header line. This behavior can be disabled with `GODEBUG=tracebacklabels=0`
88
(added in [Go 1.26](/doc/godebug#go-126)). This opt-out is expected to be
99
kept indefinitely in case goroutine labels acquire sensitive information that
1010
shouldn't be made available in tracebacks.
11+
12+
<!-- CL 781580 -->
13+
14+
The `asynctimerchan` GODEBUG setting (added in [Go 1.23](/doc/godebug#go-123))
15+
has been removed permanently. Channels created by package [time](https://pkg.go.dev/time)
16+
are now always unbuffered (synchronous), irrespective of GODEBUG settings.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!-- CL 736441 -->
2+
3+
The `gotypesalias` GODEBUG setting (added in [Go 1.22](/doc/godebug#go-122))
4+
has been removed permanently and the package [go/types](https://pkg.go.dev/go/types)
5+
now always produces an [Alias](https://pkg.go.dev/go/types#Alias) type node for
6+
[alias declarations](/ref/spec#Alias_declarations) irrespective of GODEBUG settings.

src/cmd/asm/internal/asm/testdata/arm64.s

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,36 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
322322
VUXTL2 V30.H8, V30.S4 // dea7106f
323323
VUXTL2 V29.S4, V2.D2 // a2a7206f
324324
VUXTL2 V30.B16, V2.H8 // c2a7086f
325+
VSXTL V1.B8, V2.H8 // 22a4080f
326+
VSXTL V1.H4, V2.S4 // 22a4100f
327+
VSXTL V1.S2, V2.D2 // 22a4200f
328+
VSXTL2 V1.B16, V2.H8 // 22a4084f
329+
VSXTL2 V1.H8, V2.S4 // 22a4104f
330+
VSXTL2 V1.S4, V2.D2 // 22a4204f
331+
VXTN V1.H8, V2.B8 // 2228210e
332+
VXTN V1.S4, V2.H4 // 2228610e
333+
VXTN V1.D2, V2.S2 // 2228a10e
334+
VXTN2 V1.H8, V2.B16 // 2228214e
335+
VXTN2 V1.S4, V2.H8 // 2228614e
336+
VXTN2 V1.D2, V2.S4 // 2228a14e
337+
VSQXTN V1.H8, V2.B8 // 2248210e
338+
VSQXTN V1.S4, V2.H4 // 2248610e
339+
VSQXTN V1.D2, V2.S2 // 2248a10e
340+
VSQXTN2 V1.H8, V2.B16 // 2248214e
341+
VSQXTN2 V1.S4, V2.H8 // 2248614e
342+
VSQXTN2 V1.D2, V2.S4 // 2248a14e
343+
VSQXTUN V1.H8, V2.B8 // 2228212e
344+
VSQXTUN V1.S4, V2.H4 // 2228612e
345+
VSQXTUN V1.D2, V2.S2 // 2228a12e
346+
VSQXTUN2 V1.H8, V2.B16 // 2228216e
347+
VSQXTUN2 V1.S4, V2.H8 // 2228616e
348+
VSQXTUN2 V1.D2, V2.S4 // 2228a16e
349+
VUQXTN V1.H8, V2.B8 // 2248212e
350+
VUQXTN V1.S4, V2.H4 // 2248612e
351+
VUQXTN V1.D2, V2.S2 // 2248a12e
352+
VUQXTN2 V1.H8, V2.B16 // 2248216e
353+
VUQXTN2 V1.S4, V2.H8 // 2248616e
354+
VUQXTN2 V1.D2, V2.S4 // 2248a16e
325355
VBIT V21.B16, V25.B16, V4.B16 // 241fb56e
326356
VBSL V23.B16, V3.B16, V7.B16 // 671c776e
327357
VCMTST V2.B8, V29.B8, V2.B8 // a28f220e
@@ -345,6 +375,15 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
345375
VUSHLL $7, V30.B8, V30.H8 // dea70f2f
346376
VUSHLL $15, V30.H4, V29.S4 // dda71f2f
347377
VUSHLL2 $31, V30.S4, V2.D2 // c2a73f6f
378+
VSSHLL $0, V1.B8, V2.H8 // 22a4080f
379+
VSSHLL $0, V1.H4, V2.S4 // 22a4100f
380+
VSSHLL $0, V1.S2, V2.D2 // 22a4200f
381+
VSSHLL2 $0, V1.B16, V2.H8 // 22a4084f
382+
VSSHLL2 $0, V1.H8, V2.S4 // 22a4104f
383+
VSSHLL2 $0, V1.S4, V2.D2 // 22a4204f
384+
VSSHLL $7, V1.B8, V2.H8 // 22a40f0f
385+
VSSHLL $15, V1.H4, V2.S4 // 22a41f0f
386+
VSSHLL2 $31, V1.S4, V2.D2 // 22a43f4f
348387
VBIF V0.B8, V30.B8, V1.B8 // c11fe02e
349388
VBIF V30.B16, V0.B16, V2.B16 // 021cfe6e
350389
FMOVS $(4.0), F0 // 0010221e
@@ -2144,5 +2183,17 @@ next:
21442183
VFMINV V0.S4, V0 // 00f8b06e
21452184
VFMAXNMV V0.S4, V0 // 00c8306e
21462185
VFMINNMV V0.S4, V0 // 00c8b06e
2186+
VFCVTZS V1.S4, V2.S4 // 22b8a14e
2187+
VFCVTZS V1.D2, V2.D2 // 22b8e14e
2188+
VFCVTZU V1.S4, V2.S4 // 22b8a16e
2189+
VFCVTZU V1.D2, V2.D2 // 22b8e16e
2190+
VSCVTF V1.S4, V2.S4 // 22d8214e
2191+
VSCVTF V1.D2, V2.D2 // 22d8614e
2192+
VUCVTF V1.S4, V2.S4 // 22d8216e
2193+
VUCVTF V1.D2, V2.D2 // 22d8616e
2194+
VFCVTN V1.D2, V2.S2 // 2268610e
2195+
VFCVTN2 V1.D2, V2.S4 // 2268614e
2196+
VFCVTL V1.S2, V2.D2 // 2278610e
2197+
VFCVTL2 V1.S4, V2.D2 // 2278614e
21472198

21482199
END

src/cmd/asm/internal/asm/testdata/arm64error.s

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@ TEXT errors(SB),$0
378378
VUXTL V30.D2, V30.H8 // ERROR "operand mismatch"
379379
VUXTL2 V20.B8, V21.H8 // ERROR "operand mismatch"
380380
VUXTL V3.D2, V4.B8 // ERROR "operand mismatch"
381+
VSXTL V3.D2, V4.B8 // ERROR "operand mismatch"
382+
VSXTL2 V20.B8, V21.H8 // ERROR "operand mismatch"
381383
VUZP1 V0.B8, V30.B8, V1.B16 // ERROR "operand mismatch"
382384
VUZP2 V0.Q1, V30.Q1, V1.Q1 // ERROR "invalid arrangement"
383385
VUSHLL $0, V30.D2, V30.H8 // ERROR "operand mismatch"
@@ -502,11 +504,25 @@ TEXT errors(SB),$0
502504
VFMINNMV V0.H4, V0 // ERROR "invalid arrangement"
503505
VFMINNMV V0.H8, V0 // ERROR "invalid arrangement"
504506

505-
// VSHRN/VSHRN2 error test cases - invalid arrangements
507+
// Shifts and misc. conversion error test cases
508+
VXTN V1.B8, V0.B8 // ERROR "invalid arrangement"
509+
VXTN2 V1.H8, V0.B8 // ERROR "invalid arrangement"
506510
VSHRN $8, V1.B8, V0.B8 // ERROR "invalid arrangement"
507511
VSHRN $8, V1.S4, V0.S4 // ERROR "invalid arrangement"
508512
VSHRN $8, V1.H8, V0.H8 // ERROR "invalid arrangement"
509513
VSHRN2 $8, V1.B8, V0.B16 // ERROR "invalid arrangement"
510514
VSHRN2 $8, V1.S4, V0.S4 // ERROR "invalid arrangement"
511515
VSHRN2 $8, V1.H8, V0.H8 // ERROR "invalid arrangement"
516+
VSSHLL $0, V1.D2, V2.H8 // ERROR "operand mismatch"
517+
VSSHLL2 $0, V1.B8, V2.H8 // ERROR "operand mismatch"
518+
VSSHLL $8, V1.B8, V2.H8 // ERROR "shift amount out of range"
519+
VSQXTN V1.B8, V0.B8 // ERROR "invalid arrangement"
520+
VSQXTN2 V1.H8, V0.B8 // ERROR "invalid arrangement"
521+
VSQXTUN V1.B8, V0.B8 // ERROR "invalid arrangement"
522+
VUQXTN V1.B8, V0.B8 // ERROR "invalid arrangement"
523+
VFCVTZS V1.B8, V2.B8 // ERROR "invalid arrangement"
524+
VFCVTZU V1.H4, V2.H4 // ERROR "invalid arrangement"
525+
VSCVTF V1.B8, V2.B8 // ERROR "invalid arrangement"
526+
VFCVTN V1.B8, V2.B8 // ERROR "invalid arrangement"
527+
VFCVTL V1.H4, V2.S4 // ERROR "operand mismatch"
512528
RET

0 commit comments

Comments
 (0)