mirror of https://github.com/golang/go.git
spec: be more precise with rules on specific types
Problem pointed out on golang-nuts mailing list. Change-Id: If1c9b22e1ed7b4ec7ebcaadc80fa450333e6856c Reviewed-on: https://go-review.googlesource.com/c/go/+/375799 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
2bb7f6b4f1
commit
40afced8d7
|
|
@ -1,6 +1,6 @@
|
|||
<!--{
|
||||
"Title": "The Go Programming Language Specification - Go 1.18 Draft (incomplete)",
|
||||
"Subtitle": "Version of Dec 16, 2021",
|
||||
"Subtitle": "Version of Jan 6, 2022",
|
||||
"Path": "/ref/spec"
|
||||
}-->
|
||||
|
||||
|
|
@ -1988,7 +1988,8 @@ More precisely, for a given interface, the set 𝑆 of specific types is defined
|
|||
</li>
|
||||
|
||||
<li>For an interface with type elements, 𝑆 is the intersection
|
||||
of the specific types of its type elements.
|
||||
of the specific types of its type elements with specific types
|
||||
(type elements that have no specific types are ignored).
|
||||
</li>
|
||||
|
||||
<li>For a non-interface type term <code>T</code>
|
||||
|
|
@ -2021,7 +2022,7 @@ interface{ ~string } // string
|
|||
interface{ int|~string } // int, string
|
||||
interface{ Celsius|Kelvin } // Celsius, Kelvin
|
||||
interface{ int; m() } // int (but type set is empty because int has no method m)
|
||||
interface{ int; any } // no specific types (intersection is empty)
|
||||
interface{ int; any } // int (any has no specific types and is ignored)
|
||||
interface{ int; string } // no specific types (intersection is empty)
|
||||
</pre>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue